Public Member Functions | Private Member Functions | Private Attributes

# BuildSignalWindow Struct Reference

Inheritance diagram for BuildSignalWindow:

## Public Member Functions
| BuildSignalWindow (WindowDesc *desc, Window *parent)
virtual void | OnInit ()
| Notification that the nested widget tree gets initialized.
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 | SetStringParameters (int widget) const
| Initialize string parameters for a widget.
virtual void | DrawWidget (const Rect &r, int widget) const
| Draw the contents of a nested 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 | OnInvalidateData (int data=0, bool gui_scope=true)
| Some data on this window has become invalid.
## Private Member Functions
void | DrawSignalSprite (byte widget_index, SpriteID image) const
| Draw dynamic a signal-sprite in a button in the signal GUI Draw the sprite +1px to the right and down if the button is lowered.
## Private Attributes
Dimension | sig_sprite_size
| Maximum size of signal GUI sprites.
int | sig_sprite_bottom_offset
| Maximum extent of signal GUI sprite from reference point towards bottom.

## Detailed Description

Definition at line 1458 of file rail_gui.cpp.

## Member Function Documentation

void BuildSignalWindow::DrawSignalSprite | ( | byte | widget_index,
|  | SpriteID | image |
| ) |  |  | const`[inline, private]`

Draw dynamic a signal-sprite in a button in the signal GUI Draw the sprite +1px to the right and down if the button is lowered.

Parameters:

  | widget_index | index of this widget in the window
  | image | the sprite to draw

Definition at line 1470 of file rail_gui.cpp.

References NWidgetBase::current_x, NWidgetBase::current_y, DrawSprite(), GetSpriteSize(), Window::IsWidgetLowered(), NWidgetBase::pos_x, NWidgetBase::pos_y, sig_sprite_bottom_offset, sig_sprite_size, WD_IMGBTN_BOTTOM, and WD_IMGBTN_TOP.

Referenced by DrawWidget().

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

References _cur_railtype, DrawSignalSprite(), GetRailTypeInfo(), RailtypeInfo::gui_sprites, IsInsideMM(), Window::IsWidgetLowered(), SIG_SEMAPHORE, RailtypeInfo::signals, WID_BS_ELECTRIC_PBS_OWAY, and WID_BS_SEMAPHORE_NORM.

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

References _convert_signal_button, _cur_signal_type, _cur_signal_variant, _remove_button_clicked, _settings_client, GUISettings::drag_signals_density, FindWindowById(), ClientSettings::gui, Window::InvalidateData(), Window::RaiseWidget(), SetWindowDirty(), SIG_ELECTRIC, ToggleRailButton_Remove(), TRANSPORT_RAIL, WC_BUILD_TOOLBAR, WC_GAME_OPTIONS, WID_BS_CONVERT, WID_BS_DRAG_SIGNALS_DENSITY_DECREASE, WID_BS_DRAG_SIGNALS_DENSITY_INCREASE, WID_BS_ELECTRIC_COMBO, WID_BS_ELECTRIC_ENTRY, WID_BS_ELECTRIC_EXIT, WID_BS_ELECTRIC_NORM, WID_BS_ELECTRIC_PBS, WID_BS_ELECTRIC_PBS_OWAY, WID_BS_SEMAPHORE_COMBO, WID_BS_SEMAPHORE_ENTRY, WID_BS_SEMAPHORE_EXIT, WID_BS_SEMAPHORE_NORM, WID_BS_SEMAPHORE_PBS, WID_BS_SEMAPHORE_PBS_OWAY, and WN_GAME_OPTIONS_GAME_SETTINGS.

virtual void BuildSignalWindow::OnInit | ( |  | ) | `[inline, virtual]`

Notification that the nested widget tree gets initialized.

The event can be used to perform general computations.

Note:
  nested_root and/or nested_array (normally accessed via GetWidget()) may not exist during this call.

Reimplemented from Window.

Definition at line 1497 of file rail_gui.cpp.

References _cur_railtype, GetRailTypeInfo(), GetSpriteSize(), RailtypeInfo::gui_sprites, SIG_ELECTRIC, sig_sprite_bottom_offset, sig_sprite_size, RailtypeInfo::signals, and SIGTYPE_NORMAL.

virtual void BuildSignalWindow::OnInvalidateData | ( | int | data = `0`,
|  | bool | gui_scope = `true` |
| ) |  |  | `[inline, virtual]`

Some data on this window has become invalid.

Parameters:

  | data | Information about the changed data.
  | gui_scope | Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See InvalidateWindowData() for details.

Reimplemented from Window.

Definition at line 1606 of file rail_gui.cpp.

References _convert_signal_button, _cur_signal_type, _cur_signal_variant, _settings_client, GUISettings::drag_signals_density, ClientSettings::gui, Window::LowerWidget(), Window::SetWidgetDisabledState(), Window::SetWidgetLoweredState(), SIG_ELECTRIC, WID_BS_CONVERT, WID_BS_DRAG_SIGNALS_DENSITY_DECREASE, WID_BS_DRAG_SIGNALS_DENSITY_INCREASE, WID_BS_ELECTRIC_NORM, and WID_BS_SEMAPHORE_NORM.

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

References _settings_client, GUISettings::drag_signals_density, ClientSettings::gui, SetDParam(), and WID_BS_DRAG_SIGNALS_DENSITY_LABEL.

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

References GetDigitWidth(), IsInsideMM(), max(), WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, WD_IMGBTN_BOTTOM, WD_IMGBTN_LEFT, WD_IMGBTN_RIGHT, WD_IMGBTN_TOP, WID_BS_DRAG_SIGNALS_DENSITY_LABEL, WID_BS_ELECTRIC_PBS_OWAY, and WID_BS_SEMAPHORE_NORM.

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

- src/rail_gui.cpp