OpenTTD Source  1.11.2
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 "window_gui.h"
12 #include "station_gui.h"
13 #include "terraform_gui.h"
14 #include "sound_func.h"
15 #include "window_func.h"
16 #include "strings_func.h"
17 #include "viewport_func.h"
18 #include "company_func.h"
19 #include "tilehighlight_func.h"
20 #include "company_base.h"
21 #include "station_type.h"
22 #include "newgrf_airport.h"
23 #include "newgrf_callbacks.h"
24 #include "widgets/dropdown_type.h"
25 #include "core/geometry_func.hpp"
26 #include "hotkeys.h"
27 #include "vehicle_func.h"
28 #include "gui.h"
29 
30 #include "widgets/airport_widget.h"
31 
32 #include "safeguards.h"
33 
34 
38 
39 static void ShowBuildAirportPicker(Window *parent);
40 
41 SpriteID GetCustomAirportSprite(const AirportSpec *as, byte layout);
42 
43 void CcBuildAirport(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, uint32 cmd)
44 {
45  if (result.Failed()) return;
46 
47  if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_CONSTRUCTION_OTHER, tile);
49 }
50 
55 static void PlaceAirport(TileIndex tile)
56 {
57  if (_selected_airport_index == -1) return;
58  uint32 p2 = _ctrl_pressed;
59  SB(p2, 16, 16, INVALID_STATION); // no station to join
60 
61  uint32 p1 = AirportClass::Get(_selected_airport_class)->GetSpec(_selected_airport_index)->GetIndex();
62  p1 |= _selected_airport_layout << 8;
63  CommandContainer cmdcont = { tile, p1, p2, CMD_BUILD_AIRPORT | CMD_MSG(STR_ERROR_CAN_T_BUILD_AIRPORT_HERE), CcBuildAirport, "" };
64  ShowSelectStationIfNeeded(cmdcont, TileArea(tile, _thd.size.x / TILE_SIZE, _thd.size.y / TILE_SIZE));
65 }
66 
69  int last_user_action; // Last started user action.
70 
72  {
73  this->InitNested(window_number);
74  this->OnInvalidateData();
76  this->last_user_action = WIDGET_LIST_END;
77  }
78 
80  {
83  }
84 
90  void OnInvalidateData(int data = 0, bool gui_scope = true) override
91  {
92  if (!gui_scope) return;
93 
95  this->SetWidgetsDisabledState(!can_build,
98  if (!can_build) {
100 
101  /* Show in the tooltip why this button is disabled. */
102  this->GetWidget<NWidgetCore>(WID_AT_AIRPORT)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE);
103  } else {
104  this->GetWidget<NWidgetCore>(WID_AT_AIRPORT)->SetToolTip(STR_TOOLBAR_AIRCRAFT_BUILD_AIRPORT_TOOLTIP);
105  }
106  }
107 
108  void OnClick(Point pt, int widget, int click_count) override
109  {
110  switch (widget) {
111  case WID_AT_AIRPORT:
112  if (HandlePlacePushButton(this, WID_AT_AIRPORT, SPR_CURSOR_AIRPORT, HT_RECT)) {
113  ShowBuildAirportPicker(this);
114  this->last_user_action = widget;
115  }
116  break;
117 
118  case WID_AT_DEMOLISH:
120  this->last_user_action = widget;
121  break;
122 
123  default: break;
124  }
125  }
126 
127 
128  void OnPlaceObject(Point pt, TileIndex tile) override
129  {
130  switch (this->last_user_action) {
131  case WID_AT_AIRPORT:
132  PlaceAirport(tile);
133  break;
134 
135  case WID_AT_DEMOLISH:
137  break;
138 
139  default: NOT_REACHED();
140  }
141  }
142 
143  void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) override
144  {
145  VpSelectTilesWithMethod(pt.x, pt.y, select_method);
146  }
147 
148  void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) override
149  {
150  if (pt.x != -1 && select_proc == DDSP_DEMOLISH_AREA) {
151  GUIPlaceProcDragXY(select_proc, start_tile, end_tile);
152  }
153  }
154 
155  void OnPlaceObjectAbort() override
156  {
158 
159  this->RaiseButtons();
160 
163  }
164 
165  static HotkeyList hotkeys;
166 };
167 
174 {
175  if (_game_mode != GM_NORMAL) return ES_NOT_HANDLED;
177  if (w == nullptr) return ES_NOT_HANDLED;
178  return w->OnHotkey(hotkey);
179 }
180 
181 static Hotkey airtoolbar_hotkeys[] = {
182  Hotkey('1', "airport", WID_AT_AIRPORT),
183  Hotkey('2', "demolish", WID_AT_DEMOLISH),
184  HOTKEY_LIST_END
185 };
186 HotkeyList BuildAirToolbarWindow::hotkeys("airtoolbar", airtoolbar_hotkeys, AirportToolbarGlobalHotkeys);
187 
188 static const NWidgetPart _nested_air_toolbar_widgets[] = {
190  NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
191  NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_TOOLBAR_AIRCRAFT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
192  NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
193  EndContainer(),
195  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),
196  NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetMinimalSize(4, 22), SetFill(1, 1), EndContainer(),
197  NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_AT_DEMOLISH), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC),
198  EndContainer(),
199 };
200 
201 static WindowDesc _air_toolbar_desc(
202  WDP_ALIGN_TOOLBAR, "toolbar_air", 0, 0,
205  _nested_air_toolbar_widgets, lengthof(_nested_air_toolbar_widgets),
206  &BuildAirToolbarWindow::hotkeys
207 );
208 
217 {
218  if (!Company::IsValidID(_local_company)) return nullptr;
219 
221  return AllocateWindowDescFront<BuildAirToolbarWindow>(&_air_toolbar_desc, TRANSPORT_AIR);
222 }
223 
226  int line_height;
227  Scrollbar *vscroll;
228 
231  {
232  DropDownList list;
233 
234  for (uint i = 0; i < AirportClass::GetClassCount(); i++) {
235  list.emplace_back(new DropDownListStringItem(AirportClass::Get((AirportClassID)i)->name, i, false));
236  }
237 
238  return list;
239  }
240 
241 public:
243  {
244  this->CreateNestedTree();
245 
246  this->vscroll = this->GetScrollbar(WID_AP_SCROLLBAR);
247  this->vscroll->SetCapacity(5);
248  this->vscroll->SetPosition(0);
249 
251 
254  this->OnInvalidateData();
255 
256  /* Ensure airport class is valid (changing NewGRFs). */
257  _selected_airport_class = Clamp(_selected_airport_class, APC_BEGIN, (AirportClassID)(AirportClass::GetClassCount() - 1));
259  this->vscroll->SetCount(ac->GetSpecCount());
260 
261  /* Ensure the airport index is valid for this class (changing NewGRFs). */
263 
264  /* Only when no valid airport was selected, we want to select the first airport. */
265  bool selectFirstAirport = true;
266  if (_selected_airport_index != -1) {
267  const AirportSpec *as = ac->GetSpec(_selected_airport_index);
268  if (as->IsAvailable()) {
269  /* Ensure the airport layout is valid. */
271  selectFirstAirport = false;
272  this->UpdateSelectSize();
273  }
274  }
275 
276  if (selectFirstAirport) this->SelectFirstAvailableAirport(true);
277  }
278 
279  virtual ~BuildAirportWindow()
280  {
282  }
283 
284  void SetStringParameters(int widget) const override
285  {
286  switch (widget) {
289  break;
290 
291  case WID_AP_LAYOUT_NUM:
292  SetDParam(0, STR_EMPTY);
293  if (_selected_airport_index != -1) {
296  if (string != STR_UNDEFINED) {
297  SetDParam(0, string);
298  } else if (as->num_table > 1) {
299  SetDParam(0, STR_STATION_BUILD_AIRPORT_LAYOUT_NAME);
301  }
302  }
303  break;
304 
305  default: break;
306  }
307  }
308 
309  void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
310  {
311  switch (widget) {
312  case WID_AP_CLASS_DROPDOWN: {
313  Dimension d = {0, 0};
314  for (uint i = 0; i < AirportClass::GetClassCount(); i++) {
316  d = maxdim(d, GetStringBoundingBox(STR_BLACK_STRING));
317  }
318  d.width += padding.width;
319  d.height += padding.height;
320  *size = maxdim(*size, d);
321  break;
322  }
323 
324  case WID_AP_AIRPORT_LIST: {
325  for (int i = 0; i < NUM_AIRPORTS; i++) {
326  const AirportSpec *as = AirportSpec::Get(i);
327  if (!as->enabled) continue;
328 
329  size->width = std::max(size->width, GetStringBoundingBox(as->name).width);
330  }
331 
332  this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM;
333  size->height = 5 * this->line_height;
334  break;
335  }
336 
338  for (int i = 0; i < NUM_AIRPORTS; i++) {
339  const AirportSpec *as = AirportSpec::Get(i);
340  if (!as->enabled) continue;
341  for (byte layout = 0; layout < as->num_table; layout++) {
342  SpriteID sprite = GetCustomAirportSprite(as, layout);
343  if (sprite != 0) {
344  Dimension d = GetSpriteSize(sprite);
347  *size = maxdim(d, *size);
348  }
349  }
350  }
351  break;
352 
353  case WID_AP_EXTRA_TEXT:
354  for (int i = NEW_AIRPORT_OFFSET; i < NUM_AIRPORTS; i++) {
355  const AirportSpec *as = AirportSpec::Get(i);
356  if (!as->enabled) continue;
357  for (byte layout = 0; layout < as->num_table; layout++) {
359  if (string == STR_UNDEFINED) continue;
360 
361  /* STR_BLACK_STRING is used to start the string with {BLACK} */
362  SetDParam(0, string);
363  Dimension d = GetStringMultiLineBoundingBox(STR_BLACK_STRING, *size);
364  *size = maxdim(d, *size);
365  }
366  }
367  break;
368 
369  default: break;
370  }
371  }
372 
373  void DrawWidget(const Rect &r, int widget) const override
374  {
375  switch (widget) {
376  case WID_AP_AIRPORT_LIST: {
377  int y = r.top;
379  for (uint i = this->vscroll->GetPosition(); this->vscroll->IsVisible(i) && i < apclass->GetSpecCount(); i++) {
380  const AirportSpec *as = apclass->GetSpec(i);
381  if (!as->IsAvailable()) {
382  GfxFillRect(r.left + 1, y + 1, r.right - 1, y + this->line_height - 2, PC_BLACK, FILLRECT_CHECKER);
383  }
384  DrawString(r.left + WD_MATRIX_LEFT, r.right - WD_MATRIX_RIGHT, y + WD_MATRIX_TOP, as->name, ((int)i == _selected_airport_index) ? TC_WHITE : TC_BLACK);
385  y += this->line_height;
386  }
387  break;
388  }
389 
391  if (this->preview_sprite != 0) {
392  Dimension d = GetSpriteSize(this->preview_sprite);
393  DrawSprite(this->preview_sprite, COMPANY_SPRITE_COLOUR(_local_company), (r.left + r.right - d.width) / 2, (r.top + r.bottom - d.height) / 2);
394  }
395  break;
396 
397  case WID_AP_EXTRA_TEXT:
398  if (_selected_airport_index != -1) {
401  if (string != STR_UNDEFINED) {
402  SetDParam(0, string);
403  DrawStringMultiLine(r.left, r.right, r.top, r.bottom, STR_BLACK_STRING);
404  }
405  }
406  break;
407  }
408  }
409 
410  void OnPaint() override
411  {
412  this->DrawWidgets();
413 
414  uint16 top = this->GetWidget<NWidgetBase>(WID_AP_BTN_DOHILIGHT)->pos_y + this->GetWidget<NWidgetBase>(WID_AP_BTN_DOHILIGHT)->current_y + WD_PAR_VSEP_NORMAL;
415  NWidgetBase *panel_nwi = this->GetWidget<NWidgetBase>(WID_AP_BOTTOMPANEL);
416 
417  int right = panel_nwi->pos_x + panel_nwi->current_x;
418  int bottom = panel_nwi->pos_y + panel_nwi->current_y;
419 
420  if (_selected_airport_index != -1) {
423 
424  /* only show the station (airport) noise, if the noise option is activated */
426  /* show the noise of the selected airport */
427  SetDParam(0, as->noise_level);
428  DrawString(panel_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, STR_STATION_BUILD_NOISE);
430  }
431 
432  /* strings such as 'Size' and 'Coverage Area' */
435  }
436 
437  /* Resize background if the window is too small.
438  * Never make the window smaller to avoid oscillating if the size change affects the acceptance.
439  * (This is the case, if making the window bigger moves the mouse into the window.) */
440  if (top > bottom) {
441  ResizeWindow(this, 0, top - bottom, false);
442  }
443  }
444 
445  void SelectOtherAirport(int airport_index)
446  {
447  _selected_airport_index = airport_index;
449 
450  this->UpdateSelectSize();
451  this->SetDirty();
452  }
453 
454  void UpdateSelectSize()
455  {
456  if (_selected_airport_index == -1) {
457  SetTileSelectSize(1, 1);
460  } else {
462  int w = as->size_x;
463  int h = as->size_y;
465  if (rotation == DIR_E || rotation == DIR_W) Swap(w, h);
466  SetTileSelectSize(w, h);
467 
468  this->preview_sprite = GetCustomAirportSprite(as, _selected_airport_layout);
469 
472 
474  if (_settings_client.gui.station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
475  }
476  }
477 
478  void OnClick(Point pt, int widget, int click_count) override
479  {
480  switch (widget) {
483  break;
484 
485  case WID_AP_AIRPORT_LIST: {
486  int num_clicked = this->vscroll->GetPosition() + (pt.y - this->nested_array[widget]->pos_y) / this->line_height;
487  if (num_clicked >= this->vscroll->GetCount()) break;
488  const AirportSpec *as = AirportClass::Get(_selected_airport_class)->GetSpec(num_clicked);
489  if (as->IsAvailable()) this->SelectOtherAirport(num_clicked);
490  break;
491  }
492 
497  this->SetDirty();
499  this->UpdateSelectSize();
500  SetViewportCatchmentStation(nullptr, true);
501  break;
502 
505  this->UpdateSelectSize();
506  this->SetDirty();
507  break;
508 
511  this->UpdateSelectSize();
512  this->SetDirty();
513  break;
514  }
515  }
516 
522  void SelectFirstAvailableAirport(bool change_class)
523  {
524  /* First try to select an airport in the selected class. */
526  for (uint i = 0; i < sel_apclass->GetSpecCount(); i++) {
527  const AirportSpec *as = sel_apclass->GetSpec(i);
528  if (as->IsAvailable()) {
529  this->SelectOtherAirport(i);
530  return;
531  }
532  }
533  if (change_class) {
534  /* If that fails, select the first available airport
535  * from a random class. */
536  for (AirportClassID j = APC_BEGIN; j < APC_MAX; j++) {
537  AirportClass *apclass = AirportClass::Get(j);
538  for (uint i = 0; i < apclass->GetSpecCount(); i++) {
539  const AirportSpec *as = apclass->GetSpec(i);
540  if (as->IsAvailable()) {
542  this->SelectOtherAirport(i);
543  return;
544  }
545  }
546  }
547  }
548  /* If all airports are unavailable, select nothing. */
549  this->SelectOtherAirport(-1);
550  }
551 
552  void OnDropdownSelect(int widget, int index) override
553  {
554  assert(widget == WID_AP_CLASS_DROPDOWN);
557  this->SelectFirstAvailableAirport(false);
558  }
559 
560  void OnRealtimeTick(uint delta_ms) override
561  {
563  }
564 };
565 
566 static const NWidgetPart _nested_build_airport_widgets[] = {
568  NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
569  NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_AIRPORT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
570  EndContainer(),
571  NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetFill(1, 0), SetPIP(2, 0, 2),
572  NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_AIRPORT_CLASS_LABEL, STR_NULL), SetFill(1, 0),
573  NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_AP_CLASS_DROPDOWN), SetFill(1, 0), SetDataTip(STR_BLACK_STRING, STR_STATION_BUILD_AIRPORT_TOOLTIP),
574  NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, WID_AP_AIRPORT_SPRITE), SetFill(1, 0),
576  NWidget(WWT_MATRIX, COLOUR_GREY, WID_AP_AIRPORT_LIST), SetFill(1, 0), SetMatrixDataTip(1, 5, STR_STATION_BUILD_AIRPORT_TOOLTIP), SetScrollbar(WID_AP_SCROLLBAR),
578  EndContainer(),
581  NWidget(WWT_LABEL, COLOUR_GREY, WID_AP_LAYOUT_NUM), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_BLACK_STRING, STR_NULL),
583  EndContainer(),
584  NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, WID_AP_EXTRA_TEXT), SetFill(1, 0), SetMinimalSize(150, 0),
585  EndContainer(),
586  /* Bottom panel. */
587  NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_AP_BOTTOMPANEL), SetPIP(2, 2, 2),
588  NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_COVERAGE_AREA_TITLE, STR_NULL), SetFill(1, 0),
590  NWidget(NWID_SPACER), SetMinimalSize(14, 0), SetFill(1, 0),
592  NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_AP_BTN_DONTHILIGHT), SetMinimalSize(60, 12), SetFill(1, 0),
593  SetDataTip(STR_STATION_BUILD_COVERAGE_OFF, STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP),
594  NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_AP_BTN_DOHILIGHT), SetMinimalSize(60, 12), SetFill(1, 0),
595  SetDataTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP),
596  EndContainer(),
597  NWidget(NWID_SPACER), SetMinimalSize(14, 0), SetFill(1, 0),
598  EndContainer(),
599  NWidget(NWID_SPACER), SetMinimalSize(0, 10), SetResize(0, 1), SetFill(1, 0),
600  EndContainer(),
601 };
602 
603 static WindowDesc _build_airport_desc(
604  WDP_AUTO, "build_station_air", 0, 0,
607  _nested_build_airport_widgets, lengthof(_nested_build_airport_widgets)
608 );
609 
610 static void ShowBuildAirportPicker(Window *parent)
611 {
612  new BuildAirportWindow(&_build_airport_desc, parent);
613 }
614 
615 void InitializeAirportGui()
616 {
619 }
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:2470
DDSP_DEMOLISH_AREA
@ DDSP_DEMOLISH_AREA
Clear area.
Definition: viewport_type.h:116
CA_UNMODIFIED
@ CA_UNMODIFIED
Catchment for all stations with "modified catchment" disabled.
Definition: station_type.h:82
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:478
WD_FRAMERECT_TOP
@ WD_FRAMERECT_TOP
Offset at top to draw the frame rectangular area.
Definition: window_gui.h:62
CMD_MSG
#define CMD_MSG(x)
Used to combine a StringID with the command.
Definition: command_type.h:372
TileIndex
uint32 TileIndex
The index/ID of a Tile.
Definition: tile_type.h:83
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:150
WC_BUILD_TOOLBAR
@ WC_BUILD_TOOLBAR
Build toolbar; Window numbers:
Definition: window_type.h:66
BuildAirportWindow::SetStringParameters
void SetStringParameters(int widget) const override
Initialize string parameters for a widget.
Definition: airport_gui.cpp:284
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:575
WD_MATRIX_RIGHT
@ WD_MATRIX_RIGHT
Offset at right of a matrix cell.
Definition: window_gui.h:77
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:1104
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:309
Dimension
Dimensions (a width and height) of a rectangle in 2D.
Definition: geometry_type.hpp:27
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:37
Window::GetScrollbar
const Scrollbar * GetScrollbar(uint widnum) const
Return the Scrollbar to a widget index.
Definition: window.cpp:309
WDF_CONSTRUCTION
@ WDF_CONSTRUCTION
This window is used for construction; close it whenever changing company.
Definition: window_gui.h:208
ShowBuildAirToolbar
Window * ShowBuildAirToolbar()
Open the build airport toolbar window.
Definition: airport_gui.cpp:216
_selected_airport_class
static AirportClassID _selected_airport_class
the currently visible airport class
Definition: airport_gui.cpp:35
AirportToolbarGlobalHotkeys
static EventState AirportToolbarGlobalHotkeys(int hotkey)
Handler for global hotkeys of the BuildAirToolbarWindow.
Definition: airport_gui.cpp:173
GetAirportTextCallback
StringID GetAirportTextCallback(const AirportSpec *as, byte layout, uint16 callback)
Get a custom text for the airport.
Definition: newgrf_airport.cpp:307
company_base.h
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:115
WD_MATRIX_TOP
@ WD_MATRIX_TOP
Offset at top of a matrix cell.
Definition: window_gui.h:78
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:126
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:1832
BuildAirToolbarWindow::OnInvalidateData
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
Definition: airport_gui.cpp:90
WDP_ALIGN_TOOLBAR
@ WDP_ALIGN_TOOLBAR
Align toward the toolbar.
Definition: window_gui.h:156
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:145
Scrollbar::SetCount
void SetCount(int num)
Sets the number of elements in the list.
Definition: widget_type.h:679
_ctrl_pressed
bool _ctrl_pressed
Is Ctrl pressed?
Definition: gfx.cpp:35
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:288
SetResize
static NWidgetPart SetResize(int16 dx, int16 dy)
Widget part function for setting the resize step.
Definition: widget_type.h:939
Window::OnInvalidateData
virtual void OnInvalidateData(int data=0, bool gui_scope=true)
Some data on this window has become invalid.
Definition: window_gui.h:746
TILE_SIZE
static const uint TILE_SIZE
Tile size in world coordinates.
Definition: tile_type.h:13
Window::RaiseButtons
void RaiseButtons(bool autoraise=false)
Raise the buttons of the window.
Definition: window.cpp:573
CommandContainer
Structure for buffering the build command when selecting a station to join.
Definition: command_type.h:479
newgrf_airport.h
_settings_client
ClientSettings _settings_client
The current settings for this game.
Definition: settings.cpp:79
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:640
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:1492
DeleteWindowByClass
void DeleteWindowByClass(WindowClass cls)
Delete all windows of a given class.
Definition: window.cpp:1178
WWT_PUSHARROWBTN
@ WWT_PUSHARROWBTN
Normal push-button (no toggle button) with arrow caption.
Definition: widget_type.h:104
WindowNumber
int32 WindowNumber
Number to differentiate different windows of the same class.
Definition: window_type.h:711
_selected_airport_index
static int _selected_airport_index
the index of the selected airport in the current class or -1
Definition: airport_gui.cpp:36
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
ViewportPlaceMethod
ViewportPlaceMethod
Viewport place method (type of highlighted area and placed objects)
Definition: viewport_type.h:96
Scrollbar
Scrollbar data structure.
Definition: widget_type.h:598
Window::OnHotkey
virtual EventState OnHotkey(int hotkey)
A hotkey has been pressed.
Definition: window.cpp:610
AirportSpec
Defines the data structure for an airport.
Definition: newgrf_airport.h:98
Window::Window
Window(WindowDesc *desc)
Empty constructor, initialization has been moved to InitNested() called from the constructor of the d...
Definition: window.cpp:1871
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:199
NWidgetPart
Partial widget specification to allow NWidgets to be written nested.
Definition: widget_type.h:919
SetDataTip
static NWidgetPart SetDataTip(uint32 data, StringID tip)
Widget part function for setting the data and tooltip.
Definition: widget_type.h:1023
WID_AP_AIRPORT_SPRITE
@ WID_AP_AIRPORT_SPRITE
A visual display of the airport currently selected.
Definition: airport_widget.h:27
GetStringBoundingBox
Dimension GetStringBoundingBox(const char *str, FontSize start_fontsize)
Return the string dimension in pixels.
Definition: gfx.cpp:842
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:763
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:166
window_gui.h
NC_EQUALSIZE
@ NC_EQUALSIZE
Value of the NCB_EQUALSIZE flag.
Definition: widget_type.h:438
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:507
WDP_AUTO
@ WDP_AUTO
Find a place automatically.
Definition: window_gui.h:154
Window::resize
ResizeInfo resize
Resize information.
Definition: window_gui.h:323
CommandCost
Common return value for all commands.
Definition: command_type.h:23
AirportSpec::Get
static const AirportSpec * Get(byte type)
Retrieve airport spec for the given airport.
Definition: newgrf_airport.cpp:99
Scrollbar::GetCount
uint16 GetCount() const
Gets the number of elements in the list.
Definition: widget_type.h:622
tilehighlight_func.h
ClientSettings::sound
SoundSettings sound
sound effect settings
Definition: settings_type.h:584
Window::InitNested
void InitNested(WindowNumber number=0)
Perform complete initialization of the Window with nested widgets, to allow use.
Definition: window.cpp:1861
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:984
WD_FRAMERECT_LEFT
@ WD_FRAMERECT_LEFT
Offset at left to draw the frame rectangular area.
Definition: window_gui.h:60
HT_DIAGONAL
@ HT_DIAGONAL
Also allow 'diagonal rectangles'. Only usable in combination with HT_RECT or HT_POINT.
Definition: tilehighlight_type.h:28
SB
static T SB(T &x, const uint8 s, const uint8 n, const U d)
Set n bits in x starting at bit s to d.
Definition: bitmath_func.hpp:58
WD_PAR_VSEP_NORMAL
@ WD_PAR_VSEP_NORMAL
Normal amount of vertical space between two paragraphs of text.
Definition: window_gui.h:137
WD_FRAMERECT_RIGHT
@ WD_FRAMERECT_RIGHT
Offset at right to draw the frame rectangular area.
Definition: window_gui.h:61
ES_NOT_HANDLED
@ ES_NOT_HANDLED
The passed event is not handled.
Definition: window_type.h:719
WD_FRAMERECT_BOTTOM
@ WD_FRAMERECT_BOTTOM
Offset at bottom to draw the frame rectangular area.
Definition: window_gui.h:63
CommandCost::Failed
bool Failed() const
Did this command fail?
Definition: command_type.h:159
NWidgetBase
Baseclass for nested widgets.
Definition: widget_type.h:124
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:447
VpSelectTilesWithMethod
void VpSelectTilesWithMethod(int x, int y, ViewportPlaceMethod method)
Selects tiles while dragging.
Definition: viewport.cpp:3137
BuildAirportWindow::OnRealtimeTick
void OnRealtimeTick(uint delta_ms) override
Called periodically.
Definition: airport_gui.cpp:560
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:1041
NewGRFClass
Struct containing information relating to NewGRF classes for stations and airports.
Definition: newgrf_class.h:19
dropdown_type.h
_settings_game
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition: settings.cpp:80
BuildAirportWindow::preview_sprite
SpriteID preview_sprite
Cached airport preview sprite.
Definition: airport_gui.cpp:225
GameSettings::economy
EconomySettings economy
settings to change the economy
Definition: settings_type.h:573
Window::SetWidgetDisabledState
void SetWidgetDisabledState(byte widget_index, bool disab_stat)
Sets the enabled/disabled status of a widget.
Definition: window_gui.h:393
Window::parent
Window * parent
Parent window.
Definition: window_gui.h:338
_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:61
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:978
GetStringMultiLineBoundingBox
Dimension GetStringMultiLineBoundingBox(StringID str, const Dimension &suggestion)
Calculate string bounding box for multi-line strings.
Definition: gfx.cpp:729
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:55
stdafx.h
PC_BLACK
static const uint8 PC_BLACK
Black palette colour.
Definition: gfx_func.h:206
Window::window_number
WindowNumber window_number
Window number within the window class.
Definition: window_gui.h:313
GUISettings::link_terraform_toolbar
bool link_terraform_toolbar
display terraform toolbar when displaying rail, road, water and airport toolbars
Definition: settings_type.h:104
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:114
AirportSpec::IsAvailable
bool IsAvailable() const
Check whether this airport is available to build.
Definition: newgrf_airport.cpp:126
viewport_func.h
NWidgetBase::current_y
uint current_y
Current vertical size (after resizing).
Definition: widget_type.h:183
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:1817
ShowSelectStationIfNeeded
void ShowSelectStationIfNeeded(const CommandContainer &cmd, TileArea ta)
Show the station selection window when needed.
Definition: station_gui.cpp:2466
Window::nested_array
NWidgetBase ** nested_array
Array of pointers into the tree. Do not access directly, use Window::GetWidget() instead.
Definition: window_gui.h:331
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:913
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:54
Scrollbar::SetCapacity
void SetCapacity(int capacity)
Set the capacity of visible elements.
Definition: widget_type.h:695
SCT_ALL
@ SCT_ALL
Draw all cargoes.
Definition: station_gui.h:22
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:148
SoundSettings::confirm
bool confirm
Play sound effect on successful constructions or other actions.
Definition: settings_type.h:197
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:1008
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
DeleteWindowById
void DeleteWindowById(WindowClass cls, WindowNumber number, bool force)
Delete a window by its class and window number (if it is open).
Definition: window.cpp:1165
BuildAirportWindow::OnPaint
void OnPaint() override
The window must be repainted.
Definition: airport_gui.cpp:410
NEW_AIRPORT_OFFSET
@ NEW_AIRPORT_OFFSET
Number of the first newgrf airport.
Definition: airport.h:39
NWidgetBase::pos_x
int pos_x
Horizontal position of top-left corner of the widget in the window.
Definition: widget_type.h:185
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:155
Scrollbar::SetPosition
void SetPosition(int position)
Sets the position of the first visible element.
Definition: widget_type.h:710
FONT_HEIGHT_NORMAL
#define FONT_HEIGHT_NORMAL
Height of characters in the normal (FS_NORMAL) font.
Definition: gfx_func.h:179
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:1123
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
CMD_BUILD_AIRPORT
@ CMD_BUILD_AIRPORT
build an airport
Definition: command_type.h:205
SetMinimalSize
static NWidgetPart SetMinimalSize(int16 x, int16 y)
Widget part function for setting the minimal size.
Definition: widget_type.h:956
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
Window::SetWidgetsDisabledState
void CDECL SetWidgetsDisabledState(bool disab_stat, int widgets,...)
Sets the enabled/disabled status of a list of widgets.
Definition: window.cpp:536
Window::IsWidgetLowered
bool IsWidgetLowered(byte widget_index) const
Gets the lowered state of a widget.
Definition: window_gui.h:494
EventState
EventState
State of handling an event.
Definition: window_type.h:717
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:640
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:128
BuildAirportWindow::SelectFirstAvailableAirport
void SelectFirstAvailableAirport(bool change_class)
Select the first available airport.
Definition: airport_gui.cpp:522
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:1848
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:854
SetViewportCatchmentStation
void SetViewportCatchmentStation(const Station *st, bool sel)
Select or deselect station for coverage area highlight.
Definition: viewport.cpp:3522
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:143
Window::top
int top
y position of top edge of the window
Definition: window_gui.h:319
TileArea
OrthogonalTileArea TileArea
Shorthand for the much more common orthogonal tile area.
Definition: tilearea_type.h:96
BuildAirportWindow::OnDropdownSelect
void OnDropdownSelect(int widget, int index) override
A dropdown option associated to this window has been selected.
Definition: airport_gui.cpp:552
WD_MATRIX_BOTTOM
@ WD_MATRIX_BOTTOM
Offset at bottom of a matrix cell.
Definition: window_gui.h:79
window_func.h
SoundSettings::click_beep
bool click_beep
Beep on a random selection of buttons.
Definition: settings_type.h:198
lengthof
#define lengthof(x)
Return the length of an fixed size array.
Definition: stdafx.h:369
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:356
SetPIP
static NWidgetPart SetPIP(uint8 pre, uint8 inter, uint8 post)
Widget part function for setting a pre/inter/post spaces.
Definition: widget_type.h:1085
SND_1F_CONSTRUCTION_OTHER
@ SND_1F_CONSTRUCTION_OTHER
29 == 0x1D Construction: other (non-water, non-rail, non-bridge)
Definition: sound_type.h:68
NWidgetBase::pos_y
int pos_y
Vertical position of top-left corner of the widget in the window.
Definition: widget_type.h:186
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:108
SetFill
static NWidgetPart SetFill(uint fill_x, uint fill_y)
Widget part function for setting filling.
Definition: widget_type.h:992
WID_AP_AIRPORT_LIST
@ WID_AP_AIRPORT_LIST
List of airports.
Definition: airport_widget.h:22
gui.h
BuildAirportWindow
Definition: airport_gui.cpp:224
Window
Data structure for an opened window.
Definition: window_gui.h:277
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:318
WD_MATRIX_LEFT
@ WD_MATRIX_LEFT
Offset at left of a matrix cell.
Definition: window_gui.h:76
Window::DrawWidgets
void DrawWidgets() const
Paint all widgets of a window.
Definition: widget.cpp:602
BuildAirportWindow::DrawWidget
void DrawWidget(const Rect &r, int widget) const override
Draw the contents of a nested widget.
Definition: airport_gui.cpp:373
Swap
static void Swap(T &a, T &b)
Type safe swap operation.
Definition: math_func.hpp:215
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:47
BuildAirportWindow::BuildAirportClassDropDown
static DropDownList BuildAirportClassDropDown()
Build a dropdown list of available airport classes.
Definition: airport_gui.cpp:230
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:403
NWidgetBase::current_x
uint current_x
Current horizontal size (after resizing).
Definition: widget_type.h:182
BuildAirToolbarWindow
Airport build toolbar window handler.
Definition: airport_gui.cpp:68
ResetObjectToPlace
void ResetObjectToPlace()
Reset the cursor and mouse mode handling back to default (normal cursor, only clicking in windows).
Definition: viewport.cpp:3421
Window::SetWidgetLoweredState
void SetWidgetLoweredState(byte widget_index, bool lowered_stat)
Sets the lowered/raised status of a widget.
Definition: window_gui.h:454
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:581
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:151
station_type.h
StationSettings::modified_catchment
bool modified_catchment
different-size catchment areas
Definition: settings_type.h:535
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:2153
WID_AP_LAYOUT_NUM
@ WID_AP_LAYOUT_NUM
Current number of the layout.
Definition: airport_widget.h:24
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:106