Public Member Functions | Static Private Member Functions | Private Attributes

BuildAirportWindow Class Reference

Inheritance diagram for BuildAirportWindow:
PickerWindowBase Window ZeroedMemoryAllocator

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 DropDownListBuildAirportClassDropDown ()
 Build a dropdown list of available airport classes.

Private Attributes

SpriteID preview_sprite
 Cached airport preview sprite.
int line_height
Scrollbarvscroll

Detailed Description

Definition at line 200 of file airport_gui.cpp.


Member Function Documentation

virtual void BuildAirportWindow::DrawWidget ( const Rect r,
int  widget 
) const [inline, virtual]
virtual void BuildAirportWindow::OnClick ( Point  pt,
int  widget,
int  click_count 
) [inline, virtual]
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 508 of file airport_gui.cpp.

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

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 478 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 241 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 266 of file airport_gui.cpp.

References CBID_AIRPORT_ADDITIONAL_TEXT, AirportSpec::enabled, FONT_HEIGHT_NORMAL, AirportSpec::Get(), NewGRFClass< Tspec, Tid, Tmax >::Get(), GetAirportTextCallback(), Scrollbar::GetCapacity(), 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: