BuildRailStationWindow Struct Reference

Inheritance diagram for BuildRailStationWindow:
PickerWindowBase Window ZeroedMemoryAllocator

Public Member Functions

 BuildRailStationWindow (const WindowDesc *desc, Window *parent, bool newstation)
virtual void OnPaint ()
 The window must be repainted.
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 SetStringParameters (int widget) const
 Initialize string parameters for a widget.
virtual void OnClick (Point pt, int widget, int click_count)
 A click with the left mouse button has been made on the window.
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.

Private Member Functions

void CheckSelectedSize (const StationSpec *statspec)
 Verify whether the currently selected station size is allowed after selecting a new station class/type.

Static Private Member Functions

static DropDownListBuildStationClassDropDown ()
 Build a dropdown list of available station classes.

Private Attributes

uint line_height
 Height of a single line in the newstation selection matrix (BRSW_NEWST_LIST widget).

Detailed Description

Definition at line 968 of file rail_gui.cpp.


Member Function Documentation

void BuildRailStationWindow::CheckSelectedSize ( const StationSpec statspec  )  [inline, private]

Verify whether the currently selected station size is allowed after selecting a new station class/type.

If not, change the station size variables ( _settings_client.gui.station_numtracks and _settings_client.gui.station_platlength ).

Parameters:
statspec Specification of the new station class/type

Definition at line 977 of file rail_gui.cpp.

References _settings_client, StationSpec::disallowed_lengths, StationSpec::disallowed_platforms, ClientSettings::gui, HasBit(), Window::LowerWidget(), Window::RaiseWidget(), GUISettings::station_dragdrop, GUISettings::station_numtracks, and GUISettings::station_platlength.

Referenced by OnClick(), and OnDropdownSelect().

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

References CheckSelectedSize(), DeleteWindowById(), GetCustomStationSpec(), GetNumCustomStations(), Scrollbar::SetCount(), Window::SetDirty(), Scrollbar::SetPosition(), RailStationGUISettings::station_class, RailStationGUISettings::station_count, RailStationGUISettings::station_type, and Window::vscroll.

virtual void BuildRailStationWindow::OnPaint (  )  [inline, virtual]
virtual void BuildRailStationWindow::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 1179 of file rail_gui.cpp.

References GetStationClassName(), SetDParam(), and RailStationGUISettings::station_class.

virtual void BuildRailStationWindow::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 1096 of file rail_gui.cpp.

References FONT_HEIGHT_NORMAL, GB(), GetCustomStationSpec(), GetNumCustomStations(), GetNumStationClasses(), GetStationClassName(), GetStringBoundingBox(), line_height, MAT_ROW_BITS, MAT_ROW_START, max(), maxdim(), StationSpec::name, SetDParam(), STAT_CLASS_BEGIN, STAT_CLASS_WAYP, WD_MATRIX_BOTTOM, and WD_MATRIX_TOP.


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

Generated on Sun Nov 14 14:42:36 2010 for OpenTTD by  doxygen 1.6.1