OpenTTD Source  13.2.1
airport_gui.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of OpenTTD.
3  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6  */
7 
10 #include "stdafx.h"
11 #include "economy_func.h"
12 #include "window_gui.h"
13 #include "station_gui.h"
14 #include "terraform_gui.h"
15 #include "sound_func.h"
16 #include "window_func.h"
17 #include "strings_func.h"
18 #include "viewport_func.h"
19 #include "company_func.h"
20 #include "tilehighlight_func.h"
21 #include "company_base.h"
22 #include "station_type.h"
23 #include "newgrf_airport.h"
24 #include "newgrf_callbacks.h"
25 #include "widgets/dropdown_type.h"
26 #include "core/geometry_func.hpp"
27 #include "hotkeys.h"
28 #include "vehicle_func.h"
29 #include "gui.h"
30 #include "command_func.h"
31 #include "airport_cmd.h"
32 #include "station_cmd.h"
33 #include "zoom_func.h"
34 
35 #include "widgets/airport_widget.h"
36 
37 #include "safeguards.h"
38 
39 
43 
44 static void ShowBuildAirportPicker(Window *parent);
45 
46 SpriteID GetCustomAirportSprite(const AirportSpec *as, byte layout);
47 
48 void CcBuildAirport(Commands cmd, const CommandCost &result, TileIndex tile)
49 {
50  if (result.Failed()) return;
51 
52  if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_CONSTRUCTION_OTHER, tile);
54 }
55 
60 static void PlaceAirport(TileIndex tile)
61 {
62  if (_selected_airport_index == -1) return;
63 
64  byte airport_type = AirportClass::Get(_selected_airport_class)->GetSpec(_selected_airport_index)->GetIndex();
65  byte layout = _selected_airport_layout;
66  bool adjacent = _ctrl_pressed;
67 
68  auto proc = [=](bool test, StationID to_join) -> bool {
69  if (test) {
70  return Command<CMD_BUILD_AIRPORT>::Do(CommandFlagsToDCFlags(GetCommandFlags<CMD_BUILD_AIRPORT>()), tile, airport_type, layout, INVALID_STATION, adjacent).Succeeded();
71  } else {
72  return Command<CMD_BUILD_AIRPORT>::Post(STR_ERROR_CAN_T_BUILD_AIRPORT_HERE, CcBuildAirport, tile, airport_type, layout, to_join, adjacent);
73  }
74  };
75 
76  ShowSelectStationIfNeeded(TileArea(tile, _thd.size.x / TILE_SIZE, _thd.size.y / TILE_SIZE), proc);
77 }
78 
81  int last_user_action; // Last started user action.
82 
84  {
85  this->InitNested(window_number);
86  this->OnInvalidateData();
88  this->last_user_action = WIDGET_LIST_END;
89  }
90 
91  void Close() override
92  {
95  this->Window::Close();
96  }
97 
103  void OnInvalidateData(int data = 0, bool gui_scope = true) override
104  {
105  if (!gui_scope) return;
106 
108  this->SetWidgetsDisabledState(!can_build,
111  if (!can_build) {
113 
114  /* Show in the tooltip why this button is disabled. */
115  this->GetWidget<NWidgetCore>(WID_AT_AIRPORT)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE);
116  } else {
117  this->GetWidget<NWidgetCore>(WID_AT_AIRPORT)->SetToolTip(STR_TOOLBAR_AIRCRAFT_BUILD_AIRPORT_TOOLTIP);
118  }
119  }
120 
121  void OnClick(Point pt, int widget, int click_count) override
122  {
123  switch (widget) {
124  case WID_AT_AIRPORT:
125  if (HandlePlacePushButton(this, WID_AT_AIRPORT, SPR_CURSOR_AIRPORT, HT_RECT)) {
126  ShowBuildAirportPicker(this);
127  this->last_user_action = widget;
128  }
129  break;
130 
131  case WID_AT_DEMOLISH:
133  this->last_user_action = widget;
134  break;
135 
136  default: break;
137  }
138  }
139 
140 
141  void OnPlaceObject(Point pt, TileIndex tile) override
142  {
143  switch (this->last_user_action) {
144  case WID_AT_AIRPORT:
145  PlaceAirport(tile);
146  break;
147 
148  case WID_AT_DEMOLISH:
150  break;
151 
152  default: NOT_REACHED();
153  }
154  }
155 
156  void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) override
157  {
158  VpSelectTilesWithMethod(pt.x, pt.y, select_method);
159  }
160 
161  void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) override
162  {
163  if (pt.x != -1 && select_proc == DDSP_DEMOLISH_AREA) {
164  GUIPlaceProcDragXY(select_proc, start_tile, end_tile);
165  }
166  }
167 
168  void OnPlaceObjectAbort() override
169  {
171 
172  this->RaiseButtons();
173 
176  }
177 
178  static HotkeyList hotkeys;
179 };
180 
187 {
188  if (_game_mode != GM_NORMAL) return ES_NOT_HANDLED;
190  if (w == nullptr) return ES_NOT_HANDLED;
191  return w->OnHotkey(hotkey);
192 }
193 
194 static Hotkey airtoolbar_hotkeys[] = {
195  Hotkey('1', "airport", WID_AT_AIRPORT),
196  Hotkey('2', "demolish", WID_AT_DEMOLISH),
197  HOTKEY_LIST_END
198 };
199 HotkeyList BuildAirToolbarWindow::hotkeys("airtoolbar", airtoolbar_hotkeys, AirportToolbarGlobalHotkeys);
200 
201 static const NWidgetPart _nested_air_toolbar_widgets[] = {
203  NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
204  NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_TOOLBAR_AIRCRAFT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
205  NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
206  EndContainer(),
208  NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_AT_AIRPORT), SetFill(0, 1), SetMinimalSize(42, 22), SetDataTip(SPR_IMG_AIRPORT, STR_TOOLBAR_AIRCRAFT_BUILD_AIRPORT_TOOLTIP),
209  NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetMinimalSize(4, 22), SetFill(1, 1), EndContainer(),
210  NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_AT_DEMOLISH), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC),
211  EndContainer(),
212 };
213 
214 static WindowDesc _air_toolbar_desc(
215  WDP_ALIGN_TOOLBAR, "toolbar_air", 0, 0,
218  _nested_air_toolbar_widgets, lengthof(_nested_air_toolbar_widgets),
219  &BuildAirToolbarWindow::hotkeys
220 );
221 
230 {
231  if (!Company::IsValidID(_local_company)) return nullptr;
232 
234  return AllocateWindowDescFront<BuildAirToolbarWindow>(&_air_toolbar_desc, TRANSPORT_AIR);
235 }
236 
239  int line_height;
240  Scrollbar *vscroll;
241 
244  {
245  DropDownList list;
246 
247  for (uint i = 0; i < AirportClass::GetClassCount(); i++) {
248  list.emplace_back(new DropDownListStringItem(AirportClass::Get((AirportClassID)i)->name, i, false));
249  }
250 
251  return list;
252  }
253 
254 public:
256  {
257  this->CreateNestedTree();
258 
259  this->vscroll = this->GetScrollbar(WID_AP_SCROLLBAR);
260  this->vscroll->SetCapacity(5);
261  this->vscroll->SetPosition(0);
262 
264 
267  this->OnInvalidateData();
268 
269  /* Ensure airport class is valid (changing NewGRFs). */
270  _selected_airport_class = Clamp(_selected_airport_class, APC_BEGIN, (AirportClassID)(AirportClass::GetClassCount() - 1));
272  this->vscroll->SetCount(ac->GetSpecCount());
273 
274  /* Ensure the airport index is valid for this class (changing NewGRFs). */
276 
277  /* Only when no valid airport was selected, we want to select the first airport. */
278  bool selectFirstAirport = true;
279  if (_selected_airport_index != -1) {
280  const AirportSpec *as = ac->GetSpec(_selected_airport_index);
281  if (as->IsAvailable()) {
282  /* Ensure the airport layout is valid. */
284  selectFirstAirport = false;
285  this->UpdateSelectSize();
286  }
287  }
288 
289  if (selectFirstAirport) this->SelectFirstAvailableAirport(true);
290  }
291 
292  void Close() override
293  {
295  this->PickerWindowBase::Close();
296  }
297 
298  void SetStringParameters(int widget) const override
299  {
300  switch (widget) {
303  break;
304 
305  case WID_AP_LAYOUT_NUM:
306  SetDParam(0, STR_EMPTY);
307  if (_selected_airport_index != -1) {
310  if (string != STR_UNDEFINED) {
311  SetDParam(0, string);
312  } else if (as->num_table > 1) {
313  SetDParam(0, STR_STATION_BUILD_AIRPORT_LAYOUT_NAME);
315  }
316  }
317  break;
318 
319  default: break;
320  }
321  }
322 
323  void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
324  {
325  switch (widget) {
326  case WID_AP_CLASS_DROPDOWN: {
327  Dimension d = {0, 0};
328  for (uint i = 0; i < AirportClass::GetClassCount(); i++) {
330  d = maxdim(d, GetStringBoundingBox(STR_BLACK_STRING));
331  }
332  d.width += padding.width;
333  d.height += padding.height;
334  *size = maxdim(*size, d);
335  break;
336  }
337 
338  case WID_AP_AIRPORT_LIST: {
339  for (int i = 0; i < NUM_AIRPORTS; i++) {
340  const AirportSpec *as = AirportSpec::Get(i);
341  if (!as->enabled) continue;
342 
343  size->width = std::max(size->width, GetStringBoundingBox(as->name).width + padding.width);
344  }
345 
346  this->line_height = FONT_HEIGHT_NORMAL + padding.height;
347  size->height = 5 * this->line_height;
348  break;
349  }
350 
352  for (int i = 0; i < NUM_AIRPORTS; i++) {
353  const AirportSpec *as = AirportSpec::Get(i);
354  if (!as->enabled) continue;
355  for (byte layout = 0; layout < as->num_table; layout++) {
356  SpriteID sprite = GetCustomAirportSprite(as, layout);
357  if (sprite != 0) {
358  Dimension d = GetSpriteSize(sprite);
361  *size = maxdim(d, *size);
362  }
363  }
364  }
365  break;
366 
367  case WID_AP_EXTRA_TEXT:
368  for (int i = NEW_AIRPORT_OFFSET; i < NUM_AIRPORTS; i++) {
369  const AirportSpec *as = AirportSpec::Get(i);
370  if (!as->enabled) continue;
371  for (byte layout = 0; layout < as->num_table; layout++) {
373  if (string == STR_UNDEFINED) continue;
374 
375  /* STR_BLACK_STRING is used to start the string with {BLACK} */
376  SetDParam(0, string);
377  Dimension d = GetStringMultiLineBoundingBox(STR_BLACK_STRING, *size);
378  *size = maxdim(d, *size);
379  }
380  }
381  break;
382 
383  default: break;
384  }
385  }
386 
387  void DrawWidget(const Rect &r, int widget) const override
388  {
389  switch (widget) {
390  case WID_AP_AIRPORT_LIST: {
391  Rect row = r.WithHeight(this->line_height).Shrink(WidgetDimensions::scaled.bevel);
392  Rect text = r.WithHeight(this->line_height).Shrink(WidgetDimensions::scaled.matrix);
394  for (uint i = this->vscroll->GetPosition(); this->vscroll->IsVisible(i) && i < apclass->GetSpecCount(); i++) {
395  const AirportSpec *as = apclass->GetSpec(i);
396  if (!as->IsAvailable()) {
398  }
399  DrawString(text, as->name, ((int)i == _selected_airport_index) ? TC_WHITE : TC_BLACK);
400  row = row.Translate(0, this->line_height);
401  text = text.Translate(0, this->line_height);
402  }
403  break;
404  }
405 
407  if (this->preview_sprite != 0) {
408  Dimension d = GetSpriteSize(this->preview_sprite);
409  DrawSprite(this->preview_sprite, COMPANY_SPRITE_COLOUR(_local_company), CenterBounds(r.left, r.right, d.width), CenterBounds(r.top, r.bottom, d.height));
410  }
411  break;
412 
413  case WID_AP_EXTRA_TEXT:
414  if (_selected_airport_index != -1) {
417  if (string != STR_UNDEFINED) {
418  SetDParam(0, string);
419  DrawStringMultiLine(r.left, r.right, r.top, r.bottom, STR_BLACK_STRING);
420  }
421  }
422  break;
423  }
424  }
425 
426  void OnPaint() override
427  {
428  this->DrawWidgets();
429 
430  Rect r = this->GetWidget<NWidgetBase>(WID_AP_ACCEPTANCE)->GetCurrentRect();
432 
433  if (_selected_airport_index != -1) {
436 
437  /* only show the station (airport) noise, if the noise option is activated */
439  /* show the noise of the selected airport */
440  SetDParam(0, as->noise_level);
441  DrawString(r.left, r.right, top, STR_STATION_BUILD_NOISE);
443  }
444 
446  Money monthly = _price[PR_INFRASTRUCTURE_AIRPORT] * as->maintenance_cost >> 3;
447  SetDParam(0, monthly * 12);
448  DrawString(r.left, r.right, top, STR_STATION_BUILD_INFRASTRUCTURE_COST);
450  }
451 
452  /* strings such as 'Size' and 'Coverage Area' */
455  }
456 
457  /* Resize background if the window is too small.
458  * Never make the window smaller to avoid oscillating if the size change affects the acceptance.
459  * (This is the case, if making the window bigger moves the mouse into the window.) */
460  if (top > r.bottom) {
461  ResizeWindow(this, 0, top - r.bottom, false);
462  }
463  }
464 
465  void SelectOtherAirport(int airport_index)
466  {
467  _selected_airport_index = airport_index;
469 
470  this->UpdateSelectSize();
471  this->SetDirty();
472  }
473 
474  void UpdateSelectSize()
475  {
476  if (_selected_airport_index == -1) {
477  SetTileSelectSize(1, 1);
480  } else {
482  int w = as->size_x;
483  int h = as->size_y;
485  if (rotation == DIR_E || rotation == DIR_W) Swap(w, h);
486  SetTileSelectSize(w, h);
487 
488  this->preview_sprite = GetCustomAirportSprite(as, _selected_airport_layout);
489 
492 
494  if (_settings_client.gui.station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
495  }
496  }
497 
498  void OnClick(Point pt, int widget, int click_count) override
499  {
500  switch (widget) {
503  break;
504 
505  case WID_AP_AIRPORT_LIST: {
506  int num_clicked = this->vscroll->GetPosition() + (pt.y - this->GetWidget<NWidgetBase>(widget)->pos_y) / this->line_height;
507  if (num_clicked >= this->vscroll->GetCount()) break;
508  const AirportSpec *as = AirportClass::Get(_selected_airport_class)->GetSpec(num_clicked);
509  if (as->IsAvailable()) this->SelectOtherAirport(num_clicked);
510  break;
511  }
512 
517  this->SetDirty();
519  this->UpdateSelectSize();
520  SetViewportCatchmentStation(nullptr, true);
521  break;
522 
525  this->UpdateSelectSize();
526  this->SetDirty();
527  break;
528 
531  this->UpdateSelectSize();
532  this->SetDirty();
533  break;
534  }
535  }
536 
542  void SelectFirstAvailableAirport(bool change_class)
543  {
544  /* First try to select an airport in the selected class. */
546  for (uint i = 0; i < sel_apclass->GetSpecCount(); i++) {
547  const AirportSpec *as = sel_apclass->GetSpec(i);
548  if (as->IsAvailable()) {
549  this->SelectOtherAirport(i);
550  return;
551  }
552  }
553  if (change_class) {
554  /* If that fails, select the first available airport
555  * from a random class. */
556  for (AirportClassID j = APC_BEGIN; j < APC_MAX; j++) {
557  AirportClass *apclass = AirportClass::Get(j);
558  for (uint i = 0; i < apclass->GetSpecCount(); i++) {
559  const AirportSpec *as = apclass->GetSpec(i);
560  if (as->IsAvailable()) {
562  this->SelectOtherAirport(i);
563  return;
564  }
565  }
566  }
567  }
568  /* If all airports are unavailable, select nothing. */
569  this->SelectOtherAirport(-1);
570  }
571 
572  void OnDropdownSelect(int widget, int index) override
573  {
574  assert(widget == WID_AP_CLASS_DROPDOWN);
577  this->SelectFirstAvailableAirport(false);
578  }
579 
580  void OnRealtimeTick(uint delta_ms) override
581  {
583  }
584 };
585 
586 static const NWidgetPart _nested_build_airport_widgets[] = {
588  NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
589  NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_AIRPORT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
590  EndContainer(),
591  NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetFill(1, 0), SetPIP(2, 0, 2),
592  NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_AIRPORT_CLASS_LABEL, STR_NULL), SetFill(1, 0),
593  NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_AP_CLASS_DROPDOWN), SetFill(1, 0), SetDataTip(STR_BLACK_STRING, STR_STATION_BUILD_AIRPORT_TOOLTIP),
594  NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, WID_AP_AIRPORT_SPRITE), SetFill(1, 0),
596  NWidget(WWT_MATRIX, COLOUR_GREY, WID_AP_AIRPORT_LIST), SetFill(1, 0), SetMatrixDataTip(1, 5, STR_STATION_BUILD_AIRPORT_TOOLTIP), SetScrollbar(WID_AP_SCROLLBAR),
598  EndContainer(),
601  NWidget(WWT_LABEL, COLOUR_GREY, WID_AP_LAYOUT_NUM), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_BLACK_STRING, STR_NULL),
603  EndContainer(),
604  NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, WID_AP_EXTRA_TEXT), SetFill(1, 0), SetMinimalSize(150, 0),
605  EndContainer(),
606  /* Bottom panel. */
607  NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_AP_BOTTOMPANEL),
608  NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetPadding(WidgetDimensions::unscaled.framerect), SetDataTip(STR_STATION_BUILD_COVERAGE_AREA_TITLE, STR_NULL), SetFill(1, 0),
610  NWidget(NWID_SPACER), SetMinimalSize(14, 0), SetFill(1, 0),
612  NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_AP_BTN_DONTHILIGHT), SetMinimalSize(60, 12), SetFill(1, 0),
613  SetDataTip(STR_STATION_BUILD_COVERAGE_OFF, STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP),
614  NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_AP_BTN_DOHILIGHT), SetMinimalSize(60, 12), SetFill(1, 0),
615  SetDataTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP),
616  EndContainer(),
617  NWidget(NWID_SPACER), SetMinimalSize(14, 0), SetFill(1, 0),
618  EndContainer(),
619  NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, WID_AP_ACCEPTANCE), SetPadding(WidgetDimensions::unscaled.framerect), SetResize(0, 1), SetFill(1, 0),
620  EndContainer(),
621 };
622 
623 static WindowDesc _build_airport_desc(
624  WDP_AUTO, "build_station_air", 0, 0,
627  _nested_build_airport_widgets, lengthof(_nested_build_airport_widgets)
628 );
629 
630 static void ShowBuildAirportPicker(Window *parent)
631 {
632  new BuildAirportWindow(&_build_airport_desc, parent);
633 }
634 
635 void InitializeAirportGui()
636 {
639 }
VEH_AIRCRAFT
@ VEH_AIRCRAFT
Aircraft vehicle type.
Definition: vehicle_type.h:27
WID_AP_BOTTOMPANEL
@ WID_AP_BOTTOMPANEL
Panel at the bottom.
Definition: airport_widget.h:29
SetTileSelectSize
void SetTileSelectSize(int w, int h)
Highlight w by h tiles at the cursor.
Definition: viewport.cpp:2483
PickerWindowBase::Close
void Close() override
Hide the window and all its child windows, and mark them for a later deletion.
Definition: window.cpp:3563
DDSP_DEMOLISH_AREA
@ DDSP_DEMOLISH_AREA
Clear area.
Definition: viewport_type.h:108
CA_UNMODIFIED
@ CA_UNMODIFIED
Catchment for all stations with "modified catchment" disabled.
Definition: station_type.h:83
BuildAirportWindow::OnClick
void OnClick(Point pt, int widget, int click_count) override
A click with the left mouse button has been made on the window.
Definition: airport_gui.cpp:498
sound_func.h
TileHighlightData::size
Point size
Size, in tile "units", of the white/red selection area.
Definition: tilehighlight_type.h:48
WID_AP_SCROLLBAR
@ WID_AP_SCROLLBAR
Scrollbar of the list.
Definition: airport_widget.h:23
GUISettings::station_show_coverage
bool station_show_coverage
whether to highlight coverage area
Definition: settings_type.h:166
WC_BUILD_TOOLBAR
@ WC_BUILD_TOOLBAR
Build toolbar; Window numbers:
Definition: window_type.h:66
BuildAirportWindow::Close
void Close() override
Hide the window and all its child windows, and mark them for a later deletion.
Definition: airport_gui.cpp:292
BuildAirportWindow::SetStringParameters
void SetStringParameters(int widget) const override
Initialize string parameters for a widget.
Definition: airport_gui.cpp:298
WID_AP_CLASS_DROPDOWN
@ WID_AP_CLASS_DROPDOWN
Dropdown of airport classes.
Definition: airport_widget.h:21
Direction
Direction
Defines the 8 directions on the map.
Definition: direction_type.h:24
GameSettings::station
StationSettings station
settings related to station management
Definition: settings_type.h:598
WID_AT_AIRPORT
@ WID_AT_AIRPORT
Build airport button.
Definition: airport_widget.h:15
SetScrollbar
static NWidgetPart SetScrollbar(int index)
Attach a scrollbar to a widget.
Definition: widget_type.h:1210
HotkeyList
List of hotkeys for a window.
Definition: hotkeys.h:40
BuildAirportWindow::UpdateWidgetSize
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
Update size and resize step of a widget in the window.
Definition: airport_gui.cpp:323
Dimension
Dimensions (a width and height) of a rectangle in 2D.
Definition: geometry_type.hpp:27
command_func.h
airport_cmd.h
WWT_STICKYBOX
@ WWT_STICKYBOX
Sticky box (at top-right of a window, after WWT_DEFSIZEBOX)
Definition: widget_type.h:64
_selected_airport_layout
static byte _selected_airport_layout
selected airport layout number.
Definition: airport_gui.cpp:42
SetPadding
static NWidgetPart SetPadding(uint8 top, uint8 right, uint8 bottom, uint8 left)
Widget part function for setting additional space around a widget.
Definition: widget_type.h:1143
Window::GetScrollbar
const Scrollbar * GetScrollbar(uint widnum) const
Return the Scrollbar to a widget index.
Definition: window.cpp:319
WDF_CONSTRUCTION
@ WDF_CONSTRUCTION
This window is used for construction; close it whenever changing company.
Definition: window_gui.h:144
ShowBuildAirToolbar
Window * ShowBuildAirToolbar()
Open the build airport toolbar window.
Definition: airport_gui.cpp:229
Commands
Commands
List of commands.
Definition: command_type.h:176
Rect::Shrink
Rect Shrink(int s) const
Copy and shrink Rect by s pixels.
Definition: geometry_type.hpp:92
_selected_airport_class
static AirportClassID _selected_airport_class
the currently visible airport class
Definition: airport_gui.cpp:40
AirportToolbarGlobalHotkeys
static EventState AirportToolbarGlobalHotkeys(int hotkey)
Handler for global hotkeys of the BuildAirToolbarWindow.
Definition: airport_gui.cpp:186
GetAirportTextCallback
StringID GetAirportTextCallback(const AirportSpec *as, byte layout, uint16 callback)
Get a custom text for the airport.
Definition: newgrf_airport.cpp:295
company_base.h
WidgetDimensions::unscaled
static const WidgetDimensions unscaled
Unscaled widget dimensions.
Definition: window_gui.h:67
ViewportDragDropSelectionProcess
ViewportDragDropSelectionProcess
Drag and drop selection process, or, what to do with an area of land when you've selected it.
Definition: viewport_type.h:107
CommandFlagsToDCFlags
static constexpr DoCommandFlag CommandFlagsToDCFlags(CommandFlags cmd_flags)
Extracts the DC flags needed for DoCommand from the flags returned by GetCommandFlags.
Definition: command_func.h:59
AirportSpec::size_y
byte size_y
size of airport in y direction
Definition: newgrf_airport.h:106
WWT_CAPTION
@ WWT_CAPTION
Window caption (window title between closebox and stickybox)
Definition: widget_type.h:59
NewGRFClass::GetSpecCount
uint GetSpecCount() const
Get the number of allocated specs within the class.
Definition: newgrf_class.h:44
CheckRedrawStationCoverage
void CheckRedrawStationCoverage(const Window *w)
Check whether we need to redraw the station coverage text.
Definition: station_gui.cpp:127
WWT_IMGBTN
@ WWT_IMGBTN
(Toggle) Button with image
Definition: widget_type.h:50
AirportSpec::name
StringID name
name of this airport
Definition: newgrf_airport.h:111
WWT_LABEL
@ WWT_LABEL
Centered label.
Definition: widget_type.h:55
DropDownList
std::vector< std::unique_ptr< const DropDownListItem > > DropDownList
A drop down list is a collection of drop down list items.
Definition: dropdown_type.h:99
Window::CreateNestedTree
void CreateNestedTree(bool fill_nested=true)
Perform the first part of the initialization of a nested widget tree.
Definition: window.cpp:1775
BuildAirToolbarWindow::OnInvalidateData
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
Definition: airport_gui.cpp:103
WDP_ALIGN_TOOLBAR
@ WDP_ALIGN_TOOLBAR
Align toward the toolbar.
Definition: window_gui.h:92
NWID_HORIZONTAL
@ NWID_HORIZONTAL
Horizontal container.
Definition: widget_type.h:73
maxdim
Dimension maxdim(const Dimension &d1, const Dimension &d2)
Compute bounding box of both dimensions.
Definition: geometry_func.cpp:22
WWT_MATRIX
@ WWT_MATRIX
Grid of rows and columns.
Definition: widget_type.h:57
AirportSpec::noise_level
byte noise_level
noise that this airport generates
Definition: newgrf_airport.h:107
WID_AP_BTN_DOHILIGHT
@ WID_AP_BTN_DOHILIGHT
Show the coverage button.
Definition: airport_widget.h:32
PlaceProc_DemolishArea
void PlaceProc_DemolishArea(TileIndex tile)
Start a drag for demolishing an area.
Definition: terraform_gui.cpp:150
TileIndex
The index/ID of a Tile.
Definition: tile_type.h:85
Scrollbar::SetCount
void SetCount(int num)
Sets the number of elements in the list.
Definition: widget_type.h:717
_ctrl_pressed
bool _ctrl_pressed
Is Ctrl pressed?
Definition: gfx.cpp:38
SND_15_BEEP
@ SND_15_BEEP
19 == 0x13 GUI button click
Definition: sound_type.h:58
FILLRECT_CHECKER
@ FILLRECT_CHECKER
Draw only every second pixel, used for greying-out.
Definition: gfx_type.h:294
SetResize
static NWidgetPart SetResize(int16 dx, int16 dy)
Widget part function for setting the resize step.
Definition: widget_type.h:997
Window::OnInvalidateData
virtual void OnInvalidateData(int data=0, bool gui_scope=true)
Some data on this window has become invalid.
Definition: window_gui.h:676
zoom_func.h
TILE_SIZE
static const uint TILE_SIZE
Tile size in world coordinates.
Definition: tile_type.h:15
Window::RaiseButtons
void RaiseButtons(bool autoraise=false)
Raise the buttons of the window.
Definition: window.cpp:597
newgrf_airport.h
_settings_client
ClientSettings _settings_client
The current settings for this game.
Definition: settings.cpp:53
newgrf_callbacks.h
DrawString
int DrawString(int left, int right, int top, const char *str, TextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw string, possibly truncated to make it fit in its allocated space.
Definition: gfx.cpp:644
WWT_EMPTY
@ WWT_EMPTY
Empty widget, place holder to reserve space in widget array.
Definition: widget_type.h:46
ANIMCURSOR_DEMOLISH
static const CursorID ANIMCURSOR_DEMOLISH
704 - 707 - demolish dynamite
Definition: sprites.h:1496
WWT_PUSHARROWBTN
@ WWT_PUSHARROWBTN
Normal push-button (no toggle button) with arrow caption.
Definition: widget_type.h:106
WindowNumber
int32 WindowNumber
Number to differentiate different windows of the same class.
Definition: window_type.h:713
_selected_airport_index
static int _selected_airport_index
the index of the selected airport in the current class or -1
Definition: airport_gui.cpp:41
DIR_W
@ DIR_W
West.
Definition: direction_type.h:32
WC_BUILD_STATION
@ WC_BUILD_STATION
Build station; Window numbers:
Definition: window_type.h:390
economy_func.h
ViewportPlaceMethod
ViewportPlaceMethod
Viewport place method (type of highlighted area and placed objects)
Definition: viewport_type.h:88
Scrollbar
Scrollbar data structure.
Definition: widget_type.h:636
Window::OnHotkey
virtual EventState OnHotkey(int hotkey)
A hotkey has been pressed.
Definition: window.cpp:634
AirportSpec
Defines the data structure for an airport.
Definition: newgrf_airport.h:98
Rect::WithHeight
Rect WithHeight(int height, bool end=false) const
Copy Rect and set its height.
Definition: geometry_type.hpp:205
Window::Window
Window(WindowDesc *desc)
Empty constructor, initialization has been moved to InitNested() called from the constructor of the d...
Definition: window.cpp:1814
SetDParam
static void SetDParam(uint n, uint64 v)
Set a string parameter v at index n in the global string parameter array.
Definition: strings_func.h:196
NWidgetPart
Partial widget specification to allow NWidgets to be written nested.
Definition: widget_type.h:975
SetDataTip
static NWidgetPart SetDataTip(uint32 data, StringID tip)
Widget part function for setting the data and tooltip.
Definition: widget_type.h:1111
WID_AP_AIRPORT_SPRITE
@ WID_AP_AIRPORT_SPRITE
A visual display of the airport currently selected.
Definition: airport_widget.h:27
AirportSpec::maintenance_cost
uint16 maintenance_cost
maintenance cost multiplier
Definition: newgrf_airport.h:115
GetStringBoundingBox
Dimension GetStringBoundingBox(const char *str, FontSize start_fontsize)
Return the string dimension in pixels.
Definition: gfx.cpp:890
DrawStringMultiLine
int DrawStringMultiLine(int left, int right, int top, int bottom, const char *str, TextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw string, possibly over multiple lines.
Definition: gfx.cpp:789
WID_AT_DEMOLISH
@ WID_AT_DEMOLISH
Demolish button.
Definition: airport_widget.h:16
CBID_AIRPORT_ADDITIONAL_TEXT
@ CBID_AIRPORT_ADDITIONAL_TEXT
This callback is called from airport list.
Definition: newgrf_callbacks.h:248
SpriteID
uint32 SpriteID
The number of a sprite, without mapping bits and colourtables.
Definition: gfx_type.h:17
WID_AP_LAYOUT_INCREASE
@ WID_AP_LAYOUT_INCREASE
Increase the layout number.
Definition: airport_widget.h:26
WindowDesc
High level window description.
Definition: window_gui.h:102
window_gui.h
NC_EQUALSIZE
@ NC_EQUALSIZE
Value of the NCB_EQUALSIZE flag.
Definition: widget_type.h:469
AirportSpec::rotation
const Direction * rotation
the rotation of each tiletable
Definition: newgrf_airport.h:101
EconomySettings::station_noise_level
bool station_noise_level
build new airports when the town noise level is still within accepted limits
Definition: settings_type.h:530
WDP_AUTO
@ WDP_AUTO
Find a place automatically.
Definition: window_gui.h:90
Window::resize
ResizeInfo resize
Resize information.
Definition: window_gui.h:251
CommandCost
Common return value for all commands.
Definition: command_type.h:24
AirportSpec::Get
static const AirportSpec * Get(byte type)
Retrieve airport spec for the given airport.
Definition: newgrf_airport.cpp:97
Scrollbar::GetCount
uint16 GetCount() const
Gets the number of elements in the list.
Definition: widget_type.h:660
tilehighlight_func.h
ClientSettings::sound
SoundSettings sound
sound effect settings
Definition: settings_type.h:607
Rect::Translate
Rect Translate(int x, int y) const
Copy and translate Rect by x,y pixels.
Definition: geometry_type.hpp:168
Window::InitNested
void InitNested(WindowNumber number=0)
Perform complete initialization of the Window with nested widgets, to allow use.
Definition: window.cpp:1804
AirportSpec::num_table
byte num_table
number of elements in the table
Definition: newgrf_airport.h:102
DIR_E
@ DIR_E
East.
Definition: direction_type.h:28
Window::SetDirty
void SetDirty() const
Mark entire window as dirty (in need of re-paint)
Definition: window.cpp:1008
HT_DIAGONAL
@ HT_DIAGONAL
Also allow 'diagonal rectangles'. Only usable in combination with HT_RECT or HT_POINT.
Definition: tilehighlight_type.h:28
RectPadding::Horizontal
uint Horizontal() const
Get total horizontal padding of RectPadding.
Definition: geometry_type.hpp:59
station_cmd.h
ES_NOT_HANDLED
@ ES_NOT_HANDLED
The passed event is not handled.
Definition: window_type.h:721
CommandCost::Failed
bool Failed() const
Did this command fail?
Definition: command_type.h:160
ShowDropDownList
void ShowDropDownList(Window *w, DropDownList &&list, int selected, int button, uint width, bool auto_width, bool instant_close)
Show a drop down list.
Definition: dropdown.cpp:444
VpSelectTilesWithMethod
void VpSelectTilesWithMethod(int x, int y, ViewportPlaceMethod method)
Selects tiles while dragging.
Definition: viewport.cpp:3150
BuildAirportWindow::OnRealtimeTick
void OnRealtimeTick(uint delta_ms) override
Called periodically.
Definition: airport_gui.cpp:580
SetMatrixDataTip
static NWidgetPart SetMatrixDataTip(uint8 cols, uint8 rows, StringID tip)
Widget part function for setting the data and tooltip of WWT_MATRIX widgets.
Definition: widget_type.h:1129
NewGRFClass
Struct containing information relating to NewGRF classes for stations and airports.
Definition: newgrf_class.h:19
dropdown_type.h
ShowSelectStationIfNeeded
void ShowSelectStationIfNeeded(TileArea ta, StationPickerCmdProc proc)
Show the station selection window when needed.
Definition: station_gui.cpp:2435
_settings_game
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition: settings.cpp:54
BuildAirportWindow::preview_sprite
SpriteID preview_sprite
Cached airport preview sprite.
Definition: airport_gui.cpp:238
GameSettings::economy
EconomySettings economy
settings to change the economy
Definition: settings_type.h:596
Window::SetWidgetDisabledState
void SetWidgetDisabledState(byte widget_index, bool disab_stat)
Sets the enabled/disabled status of a widget.
Definition: window_gui.h:321
Window::parent
Window * parent
Parent window.
Definition: window_gui.h:266
_local_company
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
Definition: company_cmd.cpp:46
DropDownListStringItem
Common string list item.
Definition: dropdown_type.h:39
safeguards.h
HandlePlacePushButton
bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, HighLightStyle mode)
This code is shared for the majority of the pushbuttons.
Definition: main_gui.cpp:62
CBID_AIRPORT_LAYOUT_NAME
@ CBID_AIRPORT_LAYOUT_NAME
Called to determine text to show as airport layout name.
Definition: newgrf_callbacks.h:251
NUM_AIRPORTS
@ NUM_AIRPORTS
Maximal number of airports in total.
Definition: airport.h:41
DrawSprite
void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub, ZoomLevel zoom)
Draw a sprite, not in a viewport.
Definition: gfx.cpp:1058
GetStringMultiLineBoundingBox
Dimension GetStringMultiLineBoundingBox(StringID str, const Dimension &suggestion)
Calculate string bounding box for multi-line strings.
Definition: gfx.cpp:755
Point
Coordinates of a point in 2D.
Definition: geometry_type.hpp:21
PlaceAirport
static void PlaceAirport(TileIndex tile)
Place an airport.
Definition: airport_gui.cpp:60
stdafx.h
PC_BLACK
static const uint8 PC_BLACK
Black palette colour.
Definition: gfx_func.h:242
Window::window_number
WindowNumber window_number
Window number within the window class.
Definition: window_gui.h:241
GUISettings::link_terraform_toolbar
bool link_terraform_toolbar
display terraform toolbar when displaying rail, road, water and airport toolbars
Definition: settings_type.h:119
GfxFillRect
void GfxFillRect(int left, int top, int right, int bottom, int colour, FillRectMode mode)
Applies a certain FillRectMode-operation to a rectangle [left, right] x [top, bottom] on the screen.
Definition: gfx.cpp:116
RectPadding::Vertical
uint Vertical() const
Get total vertical padding of RectPadding.
Definition: geometry_type.hpp:65
AirportSpec::IsAvailable
bool IsAvailable() const
Check whether this airport is available to build.
Definition: newgrf_airport.cpp:124
viewport_func.h
WC_NONE
@ WC_NONE
No window, redirects to WC_MAIN_WINDOW.
Definition: window_type.h:38
CanBuildVehicleInfrastructure
bool CanBuildVehicleInfrastructure(VehicleType type, byte subtype)
Check whether we can build infrastructure for the given vehicle type.
Definition: vehicle.cpp:1835
AirportSpec::size_x
byte size_x
size of airport in x direction
Definition: newgrf_airport.h:105
GetSpriteSize
Dimension GetSpriteSize(SpriteID sprid, Point *offset, ZoomLevel zoom)
Get the size of a sprite.
Definition: gfx.cpp:993
WWT_CLOSEBOX
@ WWT_CLOSEBOX
Close box (at top-left of a window)
Definition: widget_type.h:67
DrawStationCoverageAreaText
int DrawStationCoverageAreaText(int left, int right, int top, StationCoverageType sct, int rad, bool supplies)
Calculates and draws the accepted or supplied cargo around the selected tile(s)
Definition: station_gui.cpp:55
EconomySettings::infrastructure_maintenance
bool infrastructure_maintenance
enable monthly maintenance fee for owner infrastructure
Definition: settings_type.h:533
Scrollbar::SetCapacity
void SetCapacity(int capacity)
Set the capacity of visible elements.
Definition: widget_type.h:733
SCT_ALL
@ SCT_ALL
Draw all cargoes.
Definition: station_gui.h:24
StringID
uint32 StringID
Numeric value that represents a string, independent of the selected language.
Definition: strings_type.h:16
BuildAirToolbarWindow::OnPlaceMouseUp
void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) override
The user has dragged over the map when the tile highlight mode has been set.
Definition: airport_gui.cpp:161
SoundSettings::confirm
bool confirm
Play sound effect on successful constructions or other actions.
Definition: settings_type.h:216
WID_AP_BTN_DONTHILIGHT
@ WID_AP_BTN_DONTHILIGHT
Don't show the coverage button.
Definition: airport_widget.h:31
vehicle_func.h
EndContainer
static NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME,...
Definition: widget_type.h:1096
WC_SELECT_STATION
@ WC_SELECT_STATION
Select station (when joining stations); Window numbers:
Definition: window_type.h:235
Clamp
static T Clamp(const T a, const T min, const T max)
Clamp a value between an interval.
Definition: math_func.hpp:77
strings_func.h
NWID_VSCROLLBAR
@ NWID_VSCROLLBAR
Vertical scrollbar.
Definition: widget_type.h:82
AirportSpec::enabled
bool enabled
Entity still available (by default true). Newgrf can disable it, though.
Definition: newgrf_airport.h:117
terraform_gui.h
BuildAirportWindow::OnPaint
void OnPaint() override
The window must be repainted.
Definition: airport_gui.cpp:426
NEW_AIRPORT_OFFSET
@ NEW_AIRPORT_OFFSET
Number of the first newgrf airport.
Definition: airport.h:39
AirportClassID
AirportClassID
List of default airport classes.
Definition: newgrf_airport.h:68
WIDGET_LIST_END
static const int WIDGET_LIST_END
indicate the end of widgets' list for vararg functions
Definition: widget_type.h:20
BuildAirToolbarWindow::OnPlaceObjectAbort
void OnPlaceObjectAbort() override
The user cancelled a tile highlight mode that has been set.
Definition: airport_gui.cpp:168
FONT_HEIGHT_NORMAL
#define FONT_HEIGHT_NORMAL
Height of characters in the normal (FS_NORMAL) font.
Definition: gfx_func.h:206
WC_SCEN_LAND_GEN
@ WC_SCEN_LAND_GEN
Landscape generation (in Scenario Editor); Window numbers:
Definition: window_type.h:442
NWidget
static NWidgetPart NWidget(WidgetType tp, Colours col, int16 idx=-1)
Widget part function for starting a new 'real' widget.
Definition: widget_type.h:1229
WID_AP_LAYOUT_DECREASE
@ WID_AP_LAYOUT_DECREASE
Decrease the layout number.
Definition: airport_widget.h:25
geometry_func.hpp
WID_AP_EXTRA_TEXT
@ WID_AP_EXTRA_TEXT
Additional text about the airport.
Definition: airport_widget.h:28
CloseWindowByClass
void CloseWindowByClass(WindowClass cls)
Close all windows of a given class.
Definition: window.cpp:1203
SetMinimalSize
static NWidgetPart SetMinimalSize(int16 x, int16 y)
Widget part function for setting the minimal size.
Definition: widget_type.h:1014
APC_MAX
@ APC_MAX
maximum number of airport classes
Definition: newgrf_airport.h:74
WWT_PANEL
@ WWT_PANEL
Simple depressed panel.
Definition: widget_type.h:48
airport_widget.h
BuildAirToolbarWindow::Close
void Close() override
Hide the window and all its child windows, and mark them for a later deletion.
Definition: airport_gui.cpp:91
Window::SetWidgetsDisabledState
void CDECL SetWidgetsDisabledState(bool disab_stat, int widgets,...)
Sets the enabled/disabled status of a list of widgets.
Definition: window.cpp:560
Window::IsWidgetLowered
bool IsWidgetLowered(byte widget_index) const
Gets the lowered state of a widget.
Definition: window_gui.h:422
EventState
EventState
State of handling an event.
Definition: window_type.h:719
HT_RECT
@ HT_RECT
rectangle (stations, depots, ...)
Definition: tilehighlight_type.h:21
Scrollbar::GetPosition
uint16 GetPosition() const
Gets the position of the first visible element in the list.
Definition: widget_type.h:678
BuildAirToolbarWindow::OnPlaceObject
void OnPlaceObject(Point pt, TileIndex tile) override
The user clicked some place on the map when a tile highlight mode has been set.
Definition: airport_gui.cpp:141
BuildAirportWindow::SelectFirstAvailableAirport
void SelectFirstAvailableAirport(bool change_class)
Select the first available airport.
Definition: airport_gui.cpp:542
TRANSPORT_AIR
@ TRANSPORT_AIR
Transport through air.
Definition: transport_type.h:30
Window::FinishInitNested
void FinishInitNested(WindowNumber window_number=0)
Perform the second part of the initialization of a nested widget tree.
Definition: window.cpp:1791
NWID_SPACER
@ NWID_SPACER
Invisible widget that takes some space.
Definition: widget_type.h:77
company_func.h
PickerWindowBase
Base class for windows opened from a toolbar.
Definition: window_gui.h:874
SetViewportCatchmentStation
void SetViewportCatchmentStation(const Station *st, bool sel)
Select or deselect station for coverage area highlight.
Definition: viewport.cpp:3533
BuildAirToolbarWindow::OnPlaceDrag
void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) override
The user is dragging over the map when the tile highlight mode has been set.
Definition: airport_gui.cpp:156
Window::top
int top
y position of top edge of the window
Definition: window_gui.h:247
WidgetDimensions::framerect
RectPadding framerect
Offsets within frame area.
Definition: window_gui.h:47
TileArea
OrthogonalTileArea TileArea
Shorthand for the much more common orthogonal tile area.
Definition: tilearea_type.h:102
BuildAirportWindow::OnDropdownSelect
void OnDropdownSelect(int widget, int index) override
A dropdown option associated to this window has been selected.
Definition: airport_gui.cpp:572
CommandHelper
Definition: command_func.h:94
window_func.h
CenterBounds
static int CenterBounds(int min, int max, int size)
Determine where to draw a centred object inside a widget.
Definition: gfx_func.h:178
SoundSettings::click_beep
bool click_beep
Beep on a random selection of buttons.
Definition: settings_type.h:217
lengthof
#define lengthof(x)
Return the length of an fixed size array.
Definition: stdafx.h:386
NewGRFClass::Get
static NewGRFClass * Get(Tid cls_id)
Get a particular class.
Definition: newgrf_class_func.h:103
ShowTerraformToolbar
Window * ShowTerraformToolbar(Window *link)
Show the toolbar for terraforming in the game.
Definition: terraform_gui.cpp:371
SetPIP
static NWidgetPart SetPIP(uint8 pre, uint8 inter, uint8 post)
Widget part function for setting a pre/inter/post spaces.
Definition: widget_type.h:1191
SND_1F_CONSTRUCTION_OTHER
@ SND_1F_CONSTRUCTION_OTHER
29 == 0x1D Construction: other (non-water, non-rail, non-bridge)
Definition: sound_type.h:68
OverflowSafeInt< int64 >
CloseWindowById
void CloseWindowById(WindowClass cls, WindowNumber number, bool force)
Close a window by its class and window number (if it is open).
Definition: window.cpp:1191
BuildAirToolbarWindow::OnClick
void OnClick(Point pt, int widget, int click_count) override
A click with the left mouse button has been made on the window.
Definition: airport_gui.cpp:121
SetFill
static NWidgetPart SetFill(uint fill_x, uint fill_y)
Widget part function for setting filling.
Definition: widget_type.h:1080
WID_AP_AIRPORT_LIST
@ WID_AP_AIRPORT_LIST
List of airports.
Definition: airport_widget.h:22
gui.h
BuildAirportWindow
Definition: airport_gui.cpp:237
Window
Data structure for an opened window.
Definition: window_gui.h:213
Pool::PoolItem<&_company_pool >::IsValidID
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-nullptr) Titem.
Definition: pool_type.hpp:326
Window::DrawWidgets
void DrawWidgets() const
Paint all widgets of a window.
Definition: widget.cpp:858
BuildAirportWindow::DrawWidget
void DrawWidget(const Rect &r, int widget) const override
Draw the contents of a nested widget.
Definition: airport_gui.cpp:387
WID_AP_ACCEPTANCE
@ WID_AP_ACCEPTANCE
Acceptance info.
Definition: airport_widget.h:33
Swap
static void Swap(T &a, T &b)
Type safe swap operation.
Definition: math_func.hpp:241
WidgetDimensions::scaled
static WidgetDimensions scaled
Widget dimensions scaled for current zoom level.
Definition: window_gui.h:68
APC_BEGIN
@ APC_BEGIN
Lowest valid airport class id.
Definition: newgrf_airport.h:69
Rect
Specification of a rectangle with absolute coordinates of all edges.
Definition: geometry_type.hpp:69
BuildAirportWindow::BuildAirportClassDropDown
static DropDownList BuildAirportClassDropDown()
Build a dropdown list of available airport classes.
Definition: airport_gui.cpp:243
AWV_INCREASE
@ AWV_INCREASE
Arrow to the right or in case of RTL to the left.
Definition: widget_type.h:36
Window::DisableWidget
void DisableWidget(byte widget_index)
Sets a widget to disabled.
Definition: window_gui.h:331
BuildAirToolbarWindow
Airport build toolbar window handler.
Definition: airport_gui.cpp:80
ResetObjectToPlace
void ResetObjectToPlace()
Reset the cursor and mouse mode handling back to default (normal cursor, only clicking in windows).
Definition: viewport.cpp:3434
Window::SetWidgetLoweredState
void SetWidgetLoweredState(byte widget_index, bool lowered_stat)
Sets the lowered/raised status of a widget.
Definition: window_gui.h:382
AirportSpec::catchment
byte catchment
catchment area of this airport
Definition: newgrf_airport.h:108
station_gui.h
WWT_TEXTBTN
@ WWT_TEXTBTN
(Toggle) Button with text
Definition: widget_type.h:53
ClientSettings::gui
GUISettings gui
settings related to the GUI
Definition: settings_type.h:604
Scrollbar::SetPosition
bool SetPosition(int position)
Sets the position of the first visible element.
Definition: widget_type.h:749
AWV_DECREASE
@ AWV_DECREASE
Arrow to the left or in case of RTL to the right.
Definition: widget_type.h:35
WWT_DROPDOWN
@ WWT_DROPDOWN
Drop down list.
Definition: widget_type.h:68
GUISettings::persistent_buildingtools
bool persistent_buildingtools
keep the building tools active after usage
Definition: settings_type.h:167
station_type.h
StationSettings::modified_catchment
bool modified_catchment
different-size catchment areas
Definition: settings_type.h:558
Hotkey
All data for a single hotkey.
Definition: hotkeys.h:22
hotkeys.h
ResizeWindow
void ResizeWindow(Window *w, int delta_x, int delta_y, bool clamp_to_screen)
Resize the window.
Definition: window.cpp:2088
Window::Close
virtual void Close()
Hide the window and all its child windows, and mark them for a later deletion.
Definition: window.cpp:1107
WID_AP_LAYOUT_NUM
@ WID_AP_LAYOUT_NUM
Current number of the layout.
Definition: airport_widget.h:24
WidgetDimensions::vsep_normal
int vsep_normal
Normal vertical spacing.
Definition: window_gui.h:61
GUIPlaceProcDragXY
bool GUIPlaceProcDragXY(ViewportDragDropSelectionProcess proc, TileIndex start_tile, TileIndex end_tile)
A central place to handle all X_AND_Y dragged GUI functions.
Definition: terraform_gui.cpp:111