Public Member Functions | |
BuildAirportWindow (const 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 |
Definition at line 221 of file airport_gui.cpp.
virtual void BuildAirportWindow::DrawWidget | ( | const Rect & | r, | |
int | widget | |||
) | const [inline, virtual] |
Draw the contents of a nested widget.
r | Rectangle occupied by the widget. | |
widget | Number of the widget to draw. |
Reimplemented from Window.
Definition at line 351 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, GetAirportTextCallback(), Scrollbar::GetPosition(), GetSpriteSize(), GfxFillRect(), AirportSpec::IsAvailable(), Scrollbar::IsVisible(), AirportSpec::name, PC_BLACK, preview_sprite, SetDParam(), WD_MATRIX_LEFT, WD_MATRIX_RIGHT, and WD_MATRIX_TOP.
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.
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 453 of file airport_gui.cpp.
References _selected_airport_class, _selected_airport_layout, _settings_client, BuildAirportClassDropDown(), Scrollbar::GetCount(), Scrollbar::GetPosition(), ClientSettings::gui, AirportSpec::IsAvailable(), Window::nested_array, NWidgetBase::pos_y, Window::SetDirty(), Window::SetWidgetLoweredState(), ShowDropDownList(), and GUISettings::station_show_coverage.
virtual void BuildAirportWindow::OnDropdownSelect | ( | int | widget, | |
int | index | |||
) | [inline, virtual] |
A dropdown option associated to this window has been selected.
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 524 of file airport_gui.cpp.
References _selected_airport_class, SelectFirstAvailableAirport(), and Scrollbar::SetCount().
virtual void BuildAirportWindow::OnPaint | ( | ) | [inline, virtual] |
The window must be repainted.
Reimplemented from Window.
Definition at line 387 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, StationSettings::modified_catchment, AirportSpec::noise_level, NWidgetBase::pos_x, NWidgetBase::pos_y, ResizeWindow(), SCT_ALL, SetDParam(), NWidgetBase::smallest_y, GameSettings::station, EconomySettings::station_noise_level, Window::top, WD_FRAMERECT_LEFT, and WD_FRAMERECT_RIGHT.
void BuildAirportWindow::SelectFirstAvailableAirport | ( | bool | change_class | ) | [inline] |
Select the first available airport.
change_class | If true, change the class if no airport in the current class is available. |
Definition at line 496 of file airport_gui.cpp.
References _selected_airport_class, APC_BEGIN, 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.
widget | Widget number. |
Reimplemented from Window.
Definition at line 262 of file airport_gui.cpp.
References _selected_airport_class, _selected_airport_index, _selected_airport_layout, CBID_AIRPORT_LAYOUT_NAME, GetAirportTextCallback(), AirportSpec::num_table, and SetDParam().
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.
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 287 of file airport_gui.cpp.
References CBID_AIRPORT_ADDITIONAL_TEXT, AirportSpec::enabled, FONT_HEIGHT_NORMAL, AirportSpec::Get(), GetAirportTextCallback(), Scrollbar::GetCapacity(), GetSpriteSize(), GetStringBoundingBox(), GetStringMultiLineBoundingBox(), max(), maxdim(), AirportSpec::name, NEW_AIRPORT_OFFSET, AirportSpec::num_table, SetDParam(), WD_FRAMERECT_LEFT, WD_FRAMERECT_TOP, and WD_MATRIX_TOP.