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 221 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 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, Scrollbar::GetPosition(), GetSpriteSize(), GfxFillRect(), AirportSpec::IsAvailable(), Scrollbar::IsVisible(), AirportSpec::name, 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.

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 456 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.

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 527 of file airport_gui.cpp.

References _selected_airport_class, SelectFirstAvailableAirport(), and Scrollbar::SetCount().

virtual void BuildAirportWindow::OnPaint (  )  [inline, virtual]
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 499 of file airport_gui.cpp.

References _selected_airport_class, APC_BEGIN, APC_MAX, 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 262 of file airport_gui.cpp.

References _selected_airport_class, _selected_airport_index, _selected_airport_layout, CBID_AIRPORT_LAYOUT_NAME, 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.

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 287 of file airport_gui.cpp.

References CBID_AIRPORT_ADDITIONAL_TEXT, AirportSpec::enabled, FONT_HEIGHT_NORMAL, AirportSpec::Get(), Scrollbar::GetCapacity(), GetSpriteSize(), GetStringBoundingBox(), GetStringMultiLineBoundingBox(), max(), maxdim(), AirportSpec::name, NEW_AIRPORT_OFFSET, NUM_AIRPORTS, AirportSpec::num_table, SetDParam(), WD_FRAMERECT_BOTTOM, WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, WD_FRAMERECT_TOP, WD_MATRIX_BOTTOM, and WD_MATRIX_TOP.


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

Generated on Wed Apr 13 00:48:29 2011 for OpenTTD by  doxygen 1.6.1