Public Member Functions | Private Member Functions | Private Attributes

# ProgramWindow Class Reference

Inheritance diagram for ProgramWindow:

## Public Member Functions
| ProgramWindow (const WindowDesc *desc, SignalReference ref)
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 | OnPlaceObject (Point pt, TileIndex tile)
| The user clicked some place on the map when a tile highlight mode has been set.
virtual void | OnQueryTextFinished (char *str)
| The query window opened from this window has closed.
virtual void | OnDropdownSelect (int widget, int index)
| A dropdown option associated to this window has been selected.
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 | OnResize ()
| Called after the window got resized.
virtual void | OnPaint ()
| The window must be repainted.
virtual void | DrawWidget (const Rect &r, int widget) const
| Draw the contents of a nested widget.
virtual void | OnInvalidateData (int data=0, bool gui_scope=true)
| Some data on this window has become invalid.
virtual void | SetStringParameters (int widget) const
| Initialize string parameters for a widget.
## Private Member Functions
SignalInstruction * | GetSelected () const
Owner | GetOwner ()
int | GetInstructionFromPt (int y)
void | RebuildInstructionList ()
void | UpdateButtonState ()
## Private Attributes
TileIndex | tile
Track | track
SignalProgram * | program
GuiInstructionList | instructions
int | selected_instruction
Scrollbar * | vscroll

## Detailed Description

Definition at line 205 of file programmable_signals_gui.cpp.

## Member Function Documentation

virtual void ProgramWindow::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 479 of file programmable_signals_gui.cpp.

References SmallVector< T, S >::Begin(), DrawInstructionString(), SmallVector< T, S >::End(), Scrollbar::GetPosition(), Scrollbar::IsVisible(), WD_FRAMETEXT_LEFT, and WD_FRAMETEXT_RIGHT.

virtual void ProgramWindow::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 221 of file programmable_signals_gui.cpp.

References _local_company, ANIMCURSOR_BUILDSIGNALS, CMD_MSG, CMD_REMOVE_SIGNAL_INSTRUCTION, SignalIf::condition, CS_NUMERAL, DEBUG, Window::DeleteChildWindows(), DoCommandP(), HideDropDownMenu(), HT_RECT, Window::IsWidgetLowered(), Window::RaiseWidget(), SB(), ScrollMainWindowToTile(), SetDParam(), Window::SetWidgetDirty(), ShowDropDownMenu(), ShowErrorMessage(), ShowQueryString(), and WL_INFO.

virtual void ProgramWindow::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 406 of file programmable_signals_gui.cpp.

References CMD_INSERT_SIGNAL_INSTRUCTION, CMD_MODIFY_SIGNAL_INSTRUCTION, CMD_MSG, DoCommandP(), SB(), and SCF_COMPARATOR.

virtual void ProgramWindow::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 498 of file programmable_signals_gui.cpp.

virtual void ProgramWindow::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 474 of file programmable_signals_gui.cpp.

References Window::DrawWidgets().

virtual void ProgramWindow::OnPlaceObject | ( | Point | pt,
|  | TileIndex | tile |
| ) |  |  | `[inline, virtual]`

The user clicked some place on the map when a tile highlight mode has been set.

Parameters:

  | pt | the exact point on the map that has been clicked.
  | tile | the tile on the map that has been clicked.

Reimplemented from Window.

Definition at line 327 of file programmable_signals_gui.cpp.

References CMD_MODIFY_SIGNAL_INSTRUCTION, CMD_MSG, SignalIf::condition, DoCommandP(), FindFirstTrack(), GetTileTrackStatus(), HasSignalOnTrackdir(), INVALID_TRACK, IsPlainRailTile(), Window::RaiseWidget(), ReverseTrackdir(), SB(), ShowErrorMessage(), TRACK_BIT_HORZ, TRACK_BIT_LEFT, TRACK_BIT_LOWER, TRACK_BIT_RIGHT, TRACK_BIT_UPPER, TRACK_BIT_VERT, TrackStatusToTrackBits(), TrackToTrackdir(), TRANSPORT_RAIL, and WL_INFO.

virtual void ProgramWindow::OnQueryTextFinished | ( | char * | str | ) | `[inline, virtual]`

The query window opened from this window has closed.

Parameters:

  | str | the new value of the string, NULL if the window was cancelled or an empty string when the default button was pressed, i.e. StrEmpty(str).

Reimplemented from Window.

Definition at line 384 of file programmable_signals_gui.cpp.

References CMD_MODIFY_SIGNAL_INSTRUCTION, CMD_MSG, SignalIf::condition, DoCommandP(), SB(), SCF_VALUE, and StrEmpty().

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

Called after the window got resized.

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

Reimplemented from Window.

Definition at line 468 of file programmable_signals_gui.cpp.

References Scrollbar::SetCapacityFromWidget().

virtual void ProgramWindow::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 504 of file programmable_signals_gui.cpp.

References SignalIf::condition, and SetDParam().

virtual void ProgramWindow::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 458 of file programmable_signals_gui.cpp.

References WD_FRAMERECT_TOP.

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

- src/programmable_signals_gui.cpp