Public Member Functions | Static Private Member Functions | Private Attributes

# BuildAirportWindow Class Reference

Inheritance diagram for BuildAirportWindow:

## Public Member Functions
| BuildAirportWindow (WindowDesc *desc, Window *parent)
virtual void | SetStringParameters (int widget) const
| Initialize string parameters for a widget.
virtual void | UpdateWidgetSize (int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
| Update size and resize step of a widget in the window.
virtual void | DrawWidget (const Rect &r, int widget) const
| Draw the contents of a nested widget.
virtual void | OnPaint ()
| The window must be repainted.
void | SelectOtherAirport (int airport_index)
void | UpdateSelectSize ()
virtual void | OnClick (Point pt, int widget, int click_count)
| A click with the left mouse button has been made on the window.
void | SelectFirstAvailableAirport (bool change_class)
| Select the first available airport.
virtual void | OnDropdownSelect (int widget, int index)
| A dropdown option associated to this window has been selected.
virtual void | OnTick ()
| Called once per (game) tick.
## Static Private Member Functions
static DropDownList * | BuildAirportClassDropDown ()
| Build a dropdown list of available airport classes.
## Private Attributes
SpriteID | preview_sprite
| Cached airport preview sprite.
int | line_height
Scrollbar * | vscroll

## Detailed Description

Definition at line 197 of file airport_gui.cpp.

## Member Function Documentation

virtual void BuildAirportWindow::DrawWidget | ( | const Rect & | r,
|  | int | widget |
| ) |  |  | const`[inline, virtual]`

Draw the contents of a nested widget.

Parameters:

  | r | Rectangle occupied by the widget.
  | widget | Number of the widget to draw.

Note:
  This method may not change any state, it may only use drawing functions.

Reimplemented from Window.

Definition at line 327 of file airport_gui.cpp.

References _local_company, _selected_airport_class, _selected_airport_index, _selected_airport_layout, CBID_AIRPORT_ADDITIONAL_TEXT, DrawSprite(), DrawString(), DrawStringMultiLine(), FILLRECT_CHECKER, NewGRFClass< Tspec, Tid, Tmax >::Get(), GetAirportTextCallback(), Scrollbar::GetPosition(), NewGRFClass< Tspec, Tid, Tmax >::GetSpecCount(), GetSpriteSize(), GfxFillRect(), AirportSpec::IsAvailable(), Scrollbar::IsVisible(), AirportSpec::name, PC_BLACK, preview_sprite, SetDParam(), WD_MATRIX_LEFT, WD_MATRIX_RIGHT, WD_MATRIX_TOP, WID_AP_AIRPORT_LIST, WID_AP_AIRPORT_SPRITE, and WID_AP_EXTRA_TEXT.

virtual void BuildAirportWindow::OnClick | ( | Point | pt,
|  | int | widget,
|  | int | click_count |
| ) |  |  | `[inline, virtual]`

A click with the left mouse button has been made on the window.

Parameters:

  | pt | the point inside the window that has been clicked.
  | widget | the clicked widget.
  | click_count | Number of fast consecutive clicks at same position

Reimplemented from Window.

Definition at line 432 of file airport_gui.cpp.

References _selected_airport_class, _selected_airport_layout, _settings_client, BuildAirportClassDropDown(), SoundSettings::click_beep, NewGRFClass< Tspec, Tid, Tmax >::Get(), Scrollbar::GetCount(), Scrollbar::GetPosition(), ClientSettings::gui, AirportSpec::IsAvailable(), Window::nested_array, NWidgetBase::pos_y, Window::SetDirty(), Window::SetWidgetLoweredState(), ShowDropDownList(), ClientSettings::sound, GUISettings::station_show_coverage, WID_AP_AIRPORT_LIST, WID_AP_BTN_DOHILIGHT, WID_AP_BTN_DONTHILIGHT, WID_AP_CLASS_DROPDOWN, WID_AP_LAYOUT_DECREASE, and WID_AP_LAYOUT_INCREASE.

virtual void BuildAirportWindow::OnDropdownSelect | ( | int | widget,
|  | int | index |
| ) |  |  | `[inline, virtual]`

A dropdown option associated to this window has been selected.

Parameters:

  | widget | the widget (button) that the dropdown is associated with.
  | index | the element in the dropdown that is selected.

Reimplemented from Window.

Definition at line 505 of file airport_gui.cpp.

References _selected_airport_class, NewGRFClass< Tspec, Tid, Tmax >::Get(), SelectFirstAvailableAirport(), Scrollbar::SetCount(), and WID_AP_CLASS_DROPDOWN.

virtual void BuildAirportWindow::OnPaint | ( |  | ) | `[inline, virtual]`

The window must be repainted.

Note:
  This method should not change any state, it should only use drawing functions.

Reimplemented from Window.

Definition at line 364 of file airport_gui.cpp.

References _selected_airport_class, _selected_airport_index, _settings_game, CA_UNMODIFIED, AirportSpec::catchment, NWidgetBase::current_x, NWidgetBase::current_y, DrawStationCoverageAreaText(), DrawString(), Window::DrawWidgets(), GameSettings::economy, FONT_HEIGHT_NORMAL, NewGRFClass< Tspec, Tid, Tmax >::Get(), StationSettings::modified_catchment, AirportSpec::noise_level, NWidgetBase::pos_x, NWidgetBase::pos_y, ResizeWindow(), SCT_ALL, SetDParam(), GameSettings::station, EconomySettings::station_noise_level, Window::top, WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, and WID_AP_BTN_DOHILIGHT.

void BuildAirportWindow::SelectFirstAvailableAirport | ( | bool | change_class | ) | `[inline]`

Select the first available airport.

Parameters:

  | change_class | If true, change the class if no airport in the current class is available.

Definition at line 475 of file airport_gui.cpp.

References _selected_airport_class, APC_BEGIN, NewGRFClass< Tspec, Tid, Tmax >::Get(), NewGRFClass< Tspec, Tid, Tmax >::GetSpecCount(), and AirportSpec::IsAvailable().

Referenced by OnDropdownSelect().

virtual void BuildAirportWindow::SetStringParameters | ( | int | widget | ) | const`[inline, virtual]`

Initialize string parameters for a widget.

Calls to this function are made during initialization to measure the size (that is as part of InitNested()), during drawing, and while re-initializing the window. Only for widgets that render text initializing is requested.

Parameters:

  | widget | Widget number.

Reimplemented from Window.

Definition at line 238 of file airport_gui.cpp.

References _selected_airport_class, _selected_airport_index, _selected_airport_layout, CBID_AIRPORT_LAYOUT_NAME, NewGRFClass< Tspec, Tid, Tmax >::Get(), GetAirportTextCallback(), AirportSpec::num_table, SetDParam(), WID_AP_CLASS_DROPDOWN, and WID_AP_LAYOUT_NUM.

virtual void BuildAirportWindow::UpdateWidgetSize | ( | int | widget,
|  | Dimension * | size,
|  | const Dimension & | padding,
|  | Dimension * | fill,
|  | Dimension * | resize |
| ) |  |  | `[inline, virtual]`

Update size and resize step of a widget in the window.

After retrieval of the minimal size and the resize-steps of a widget, this function is called to allow further refinement, typically by computing the real maximal size of the content. Afterwards, size is taken to be the minimal size of the widget and resize is taken to contain the resize steps. For the convenience of the callee, padding contains the amount of padding between the content and the edge of the widget. This should be added to the returned size.

Parameters:

  | widget | Widget number.
  | size | Size of the widget.
  | padding | Recommended amount of space between the widget content and the widget edge.
  | fill | Fill step of the widget.
  | resize | Resize step of the widget.

Reimplemented from Window.

Definition at line 263 of file airport_gui.cpp.

References CBID_AIRPORT_ADDITIONAL_TEXT, AirportSpec::enabled, FONT_HEIGHT_NORMAL, AirportSpec::Get(), NewGRFClass< Tspec, Tid, Tmax >::Get(), GetAirportTextCallback(), GetSpriteSize(), GetStringBoundingBox(), GetStringMultiLineBoundingBox(), max(), maxdim(), AirportSpec::name, NEW_AIRPORT_OFFSET, AirportSpec::num_table, SetDParam(), WD_FRAMERECT_LEFT, WD_FRAMERECT_TOP, WD_MATRIX_TOP, WID_AP_AIRPORT_LIST, WID_AP_AIRPORT_SPRITE, WID_AP_CLASS_DROPDOWN, and WID_AP_EXTRA_TEXT.

The documentation for this class was generated from the following file:

- src/airport_gui.cpp