Public Member Functions | Private Member Functions | Private Attributes

# BuildRailStationWindow Struct Reference

Inheritance diagram for BuildRailStationWindow:

## 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 | OnResize ()
| Called after the window got resized.
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 | 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.
## Private Attributes
uint | line_height
| Height of a single line in the newstation selection matrix (WID_BRAS_NEWST_LIST widget).
uint | coverage_height
| Height of the coverage texts.
Scrollbar * | vscroll
| Vertical scrollbar of the new station list.
Scrollbar * | vscroll2
| Vertical scrollbar of the matrix with new stations.

## Detailed Description

Definition at line 878 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 890 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, GUISettings::station_platlength, WID_BRAS_PLATFORM_LEN_BEGIN, and WID_BRAS_PLATFORM_NUM_BEGIN.

Referenced by OnClick().

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

References _cur_railtype, AXIS_X, AXIS_Y, DrawStationTile(), DrawString(), FillDrawPixelInfo(), FILLRECT_CHECKER, GB(), NewGRFClass< Tspec, Tid, Tmax >::Get(), GfxFillRect(), INVALID_ROADTYPE, IsStationAvailable(), Scrollbar::IsVisible(), RailStationGUISettings::orientation, PC_BLACK, SetDParam(), STAT_CLASS_WAYP, RailStationGUISettings::station_class, RailStationGUISettings::station_count, RailStationGUISettings::station_type, vscroll, WD_MATRIX_LEFT, WD_MATRIX_RIGHT, WD_MATRIX_TOP, WID_BRAS_IMAGE, WID_BRAS_NEWST_LIST, WID_BRAS_PLATFORM_DIR_X, and WID_BRAS_PLATFORM_DIR_Y.

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

References _settings_client, CheckSelectedSize(), SoundSettings::click_beep, DeleteWindowById(), StationSpec::disallowed_lengths, StationSpec::disallowed_platforms, GB(), NewGRFClass< Tspec, Tid, Tmax >::Get(), Scrollbar::GetScrolledRowFromWidget(), NewGRFClass< Tspec, Tid, Tmax >::GetSpecCount(), ClientSettings::gui, HasBit(), IsStationAvailable(), Window::LowerWidget(), max(), min(), RailStationGUISettings::newstations, RailStationGUISettings::orientation, Window::RaiseWidget(), NWidgetMatrix::SetCount(), Window::SetDirty(), Window::SetWidgetLoweredState(), ClientSettings::sound, STAT_CLASS_WAYP, RailStationGUISettings::station_class, RailStationGUISettings::station_count, GUISettings::station_dragdrop, GUISettings::station_numtracks, GUISettings::station_platlength, GUISettings::station_show_coverage, RailStationGUISettings::station_type, Window::ToggleWidgetLoweredState(), vscroll, WC_SELECT_STATION, WID_BRAS_HIGHLIGHT_OFF, WID_BRAS_HIGHLIGHT_ON, WID_BRAS_IMAGE, WID_BRAS_NEWST_LIST, WID_BRAS_PLATFORM_DIR_X, WID_BRAS_PLATFORM_DIR_Y, WID_BRAS_PLATFORM_DRAG_N_DROP, WID_BRAS_PLATFORM_LEN_1, WID_BRAS_PLATFORM_LEN_2, WID_BRAS_PLATFORM_LEN_3, WID_BRAS_PLATFORM_LEN_4, WID_BRAS_PLATFORM_LEN_5, WID_BRAS_PLATFORM_LEN_6, WID_BRAS_PLATFORM_LEN_7, WID_BRAS_PLATFORM_LEN_BEGIN, WID_BRAS_PLATFORM_NUM_1, WID_BRAS_PLATFORM_NUM_2, WID_BRAS_PLATFORM_NUM_3, WID_BRAS_PLATFORM_NUM_4, WID_BRAS_PLATFORM_NUM_5, WID_BRAS_PLATFORM_NUM_6, WID_BRAS_PLATFORM_NUM_7, and WID_BRAS_PLATFORM_NUM_BEGIN.

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

References _remove_button_clicked, _settings_client, _settings_game, AXIS_X, CA_TRAIN, CA_UNMODIFIED, coverage_height, NWidgetBase::current_x, NWidgetBase::current_y, StationSpec::disallowed_lengths, StationSpec::disallowed_platforms, DrawStationCoverageAreaText(), Window::DrawWidgets(), NewGRFClass< Tspec, Tid, Tmax >::Get(), ClientSettings::gui, HasBit(), Window::left, StationSettings::modified_catchment, RailStationGUISettings::newstations, RailStationGUISettings::orientation, NWidgetBase::pos_x, NWidgetBase::pos_y, Window::ReInit(), SCT_ALL, SetTileSelectSize(), Window::SetWidgetDisabledState(), GameSettings::station, RailStationGUISettings::station_class, GUISettings::station_dragdrop, GUISettings::station_numtracks, GUISettings::station_platlength, GUISettings::station_show_coverage, StationSettings::station_spread, RailStationGUISettings::station_type, Swap(), Window::top, WID_BRAS_PLATFORM_LEN_1, and WID_BRAS_PLATFORM_NUM_1.

virtual void BuildRailStationWindow::OnResize | ( |  | ) | `[inline, virtual]`

Called after the window got resized.

For nested windows with a viewport, call NWidgetViewport::UpdateViewportCoordinates.

Reimplemented from Window.

Definition at line 1143 of file rail_gui.cpp.

References Scrollbar::GetCapacity(), MAT_COL_START, Scrollbar::SetCapacityFromWidget(), vscroll, and WID_BRAS_NEWST_LIST.

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 1151 of file rail_gui.cpp.

References NewGRFClass< Tspec, Tid, Tmax >::Get(), StationSpec::name, SetDParam(), RailStationGUISettings::station_class, RailStationGUISettings::station_type, and WID_BRAS_SHOW_NEWST_TYPE.

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 1024 of file rail_gui.cpp.

References coverage_height, FONT_HEIGHT_NORMAL, GB(), NewGRFClass< Tspec, Tid, Tmax >::Get(), NewGRFClass< Tspec, Tid, Tmax >::GetSpecCount(), GetStringBoundingBox(), line_height, MAT_ROW_BITS, MAT_ROW_START, max(), maxdim(), StationSpec::name, RailStationGUISettings::newstations, SetDParam(), STAT_CLASS_BEGIN, STAT_CLASS_WAYP, WD_MATRIX_TOP, WID_BRAS_COVERAGE_TEXTS, WID_BRAS_MATRIX, WID_BRAS_NEWST_LIST, and WID_BRAS_SHOW_NEWST_TYPE.

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

- src/rail_gui.cpp