Public Member Functions | Data Fields | Static Public Attributes

BuildRailToolbarWindow Struct Reference

Rail toolbar management class. More...

Inheritance diagram for BuildRailToolbarWindow:
Window ZeroedMemoryAllocator

Public Member Functions

 BuildRailToolbarWindow (WindowDesc *desc, RailType railtype)
void SetupRailToolbar (RailType railtype)
 Configures the rail toolbar for railtype given.
void ModifyRailType (RailType railtype)
 Switch to another rail type.
void UpdateRemoveWidgetStatus (int clicked_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 EventState OnHotkey (int hotkey)
 A hotkey has been pressed.
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 OnPlaceDrag (ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt)
 The user is dragging over the map when the tile highlight mode has been set.
virtual void OnPlaceMouseUp (ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile)
 The user has dragged over the map when the tile highlight mode has been set.
virtual void OnPlaceObjectAbort ()
 The user cancelled a tile highlight mode that has been set.
virtual void OnPlacePresize (Point pt, TileIndex tile)
 The user moves over the map when a tile highlight mode has been set when the special mouse mode has been set to 'PRESIZE' mode.
virtual EventState OnCTRLStateChange ()
 The state of the control key has changed.

Data Fields

RailType railtype
 Rail type to build.
int last_user_action
 Last started user action.

Static Public Attributes

static HotkeyList hotkeys

Detailed Description

Rail toolbar management class.

Definition at line 416 of file rail_gui.cpp.


Member Function Documentation

void BuildRailToolbarWindow::ModifyRailType ( RailType  railtype  )  [inline]

Switch to another rail type.

Parameters:
railtype New rail type.

Definition at line 459 of file rail_gui.cpp.

References Window::ReInit(), and SetupRailToolbar().

Referenced by ReinitGuiAfterToggleElrail(), and SetDefaultRailGui().

virtual EventState BuildRailToolbarWindow::OnCTRLStateChange (  )  [inline, virtual]

The state of the control key has changed.

Returns:
ES_HANDLED if the change has been handled and no other window should receive the event.

Reimplemented from Window.

Definition at line 749 of file rail_gui.cpp.

References RailToolbar_CtrlChanged(), WID_RAT_BUILD_STATION, and WID_RAT_BUILD_WAYPOINT.

virtual EventState BuildRailToolbarWindow::OnHotkey ( int  hotkey  )  [inline, virtual]

A hotkey has been pressed.

Parameters:
hotkey Hotkey index, by default a widget index of a button or editbox.
Returns:
ES_HANDLED if the key press has been handled, and the hotkey is not unavailable for some reason.

Reimplemented from Window.

Definition at line 601 of file rail_gui.cpp.

References MarkTileDirtyByTile(), TileHighlightData::pos, and TileVirtXY().

virtual void BuildRailToolbarWindow::OnPlaceDrag ( ViewportPlaceMethod  select_method,
ViewportDragDropSelectionProcess  select_proc,
Point  pt 
) [inline, virtual]

The user is dragging over the map when the tile highlight mode has been set.

Parameters:
select_method the method of selection (allowed directions)
select_proc what will be created when the drag is over.
pt the exact point on the map where the mouse is.

Reimplemented from Window.

Definition at line 668 of file rail_gui.cpp.

References _convert_signal_button, FindWindowById(), Window::IsWidgetLowered(), VpSelectTilesWithMethod(), WC_BUILD_SIGNAL, and WID_RAT_BUILD_SIGNALS.

virtual void BuildRailToolbarWindow::OnPlaceMouseUp ( ViewportPlaceMethod  select_method,
ViewportDragDropSelectionProcess  select_proc,
Point  pt,
TileIndex  start_tile,
TileIndex  end_tile 
) [inline, virtual]

The user has dragged over the map when the tile highlight mode has been set.

Parameters:
select_method the method of selection (allowed directions)
select_proc what should be created.
pt the exact point on the map where the mouse was released.
start_tile the begin tile of the drag.
end_tile the end tile of the drag.

Reimplemented from Window.

Definition at line 676 of file rail_gui.cpp.

References _ctrl_pressed, _cur_railtype, _cur_waypoint_type, _remove_button_clicked, _settings_client, AXIS_X, CMD_BUILD_RAIL_WAYPOINT, CMD_CONVERT_RAIL, CMD_MSG, CMD_REMOVE_FROM_RAIL_STATION, CMD_REMOVE_FROM_RAIL_WAYPOINT, DDSP_BUILD_BRIDGE, DDSP_BUILD_SIGNALS, DDSP_BUILD_STATION, DDSP_CONVERT_RAIL, DDSP_DEMOLISH_AREA, DDSP_PLACE_RAIL, DDSP_REMOVE_STATION, DoCommandP(), ClientSettings::gui, GUIPlaceProcDragXY(), TileArea::h, HandleAutoSignalPlacement(), Window::IsWidgetLowered(), GUISettings::persistent_buildingtools, ShowBuildBridgeWindow(), ShowSelectWaypointIfNeeded(), STAT_CLASS_WAYP, TileArea::tile, TRANSPORT_RAIL, VPM_FIX_X, TileArea::w, and WID_RAT_BUILD_STATION.

virtual void BuildRailToolbarWindow::OnPlacePresize ( Point  pt,
TileIndex  tile 
) [inline, virtual]

The user moves over the map when a tile highlight mode has been set when the special mouse mode has been set to 'PRESIZE' mode.

An example of this is the tile highlight for dock building.

Parameters:
pt the exact point on the map where the mouse is.
tile the tile on the map where the mouse is.

Reimplemented from Window.

Definition at line 743 of file rail_gui.cpp.

References _build_tunnel_endtile, _cur_railtype, CMD_BUILD_TUNNEL, DC_AUTO, DoCommand(), TRANSPORT_RAIL, and VpSetPresizeRange().

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

References GetRailTypeInfo(), RailtypeInfo::max_speed, railtype, SetDParam(), and WID_RAT_CAPTION.

void BuildRailToolbarWindow::SetupRailToolbar ( RailType  railtype  )  [inline]

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