Rail toolbar management class. More...
Public Member Functions | |
BuildRailToolbarWindow (const WindowDesc *desc, WindowNumber window_number, 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 | OnKeyPress (uint16 key, uint16 keycode) |
A key 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 Hotkey < BuildRailToolbarWindow > | railtoolbar_hotkeys [] |
Rail toolbar management class.
Definition at line 417 of file rail_gui.cpp.
void BuildRailToolbarWindow::ModifyRailType | ( | RailType | railtype | ) | [inline] |
Switch to another rail type.
railtype | New rail type. |
Definition at line 460 of file rail_gui.cpp.
References Window::ReInit(), and SetupRailToolbar().
Referenced by ReinitGuiAfterToggleElrail(), and SetDefaultRailGui().
virtual void BuildRailToolbarWindow::OnClick | ( | Point | pt, | |
int | widget, | |||
int | click_count | |||
) | [inline, virtual] |
A click with the left mouse button has been made on the window.
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 510 of file rail_gui.cpp.
References _ctrl_pressed, _cur_railtype, _remove_button_clicked, _settings_client, _waypoint_count, ANIMCURSOR_BUILDSIGNALS, ANIMCURSOR_DEMOLISH, RailtypeInfo::autorail, BuildRailClick_Remove(), RailtypeInfo::convert, RailtypeInfo::depot, GUISettings::enable_signal_gui, GetRailTypeInfo(), ClientSettings::gui, HandlePlacePushButton(), HT_DIAGONAL, HT_DIR_HL, HT_DIR_VL, HT_DIR_X, HT_DIR_Y, HT_LINE, HT_RAIL, HT_RECT, HT_SPECIAL, last_user_action, RailtypeInfo::rail_ew, RailtypeInfo::rail_ns, RailtypeInfo::rail_nwse, RailtypeInfo::rail_swne, RailToolbar_CtrlChanged(), ShowSignalBuilder(), ShowStationBuilder(), STAT_CLASS_WAYP, and RailtypeInfo::tunnel.
Referenced by OnKeyPress().
virtual EventState BuildRailToolbarWindow::OnCTRLStateChange | ( | ) | [inline, virtual] |
The state of the control key has changed.
Reimplemented from Window.
Definition at line 752 of file rail_gui.cpp.
References ES_HANDLED, ES_NOT_HANDLED, and RailToolbar_CtrlChanged().
virtual EventState BuildRailToolbarWindow::OnKeyPress | ( | uint16 | key, | |
uint16 | keycode | |||
) | [inline, virtual] |
A key has been pressed.
key | the Unicode value of the key. | |
keycode | the untranslated key code including shift state. |
Reimplemented from Window.
Definition at line 602 of file rail_gui.cpp.
References CheckHotkeyMatch(), ES_HANDLED, ES_NOT_HANDLED, MarkTileDirtyByTile(), OnClick(), and TileHighlightData::pos.
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.
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 672 of file rail_gui.cpp.
References _convert_signal_button, FindWindowById(), Window::IsWidgetLowered(), and VpSelectTilesWithMethod().
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.
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 680 of file rail_gui.cpp.
References _ctrl_pressed, _cur_railtype, _cur_waypoint_type, _remove_button_clicked, _settings_client, AXIS_X, AXIS_Y, 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, and TileArea::w.
The user clicked some place on the map when a tile highlight mode has been set.
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 611 of file rail_gui.cpp.
References _build_depot_direction, _cur_railtype, CcBuildRailTunnel(), CMD_BUILD_TRAIN_DEPOT, CMD_BUILD_TUNNEL, CMD_MSG, DDSP_BUILD_SIGNALS, DDSP_CONVERT_RAIL, DDSP_PLACE_RAIL, DoCommandP(), last_user_action, PlaceProc_DemolishArea(), PlaceRail_Bridge(), PlaceRail_Station(), PlaceRail_Waypoint(), TRANSPORT_RAIL, VPM_FIX_HORIZONTAL, VPM_FIX_VERTICAL, VPM_FIX_X, VPM_FIX_Y, VPM_RAILDIRS, VPM_SIGNALDIRS, VPM_X_AND_Y, and VpStartPlaceSizing().
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.
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 746 of file rail_gui.cpp.
References _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.
widget | Widget number. |
Reimplemented from Window.
Definition at line 496 of file rail_gui.cpp.
References GetRailTypeInfo(), RailtypeInfo::max_speed, railtype, and SetDParam().
void BuildRailToolbarWindow::SetupRailToolbar | ( | RailType | railtype | ) | [inline] |
Configures the rail toolbar for railtype given.
railtype | the railtype to display |
Definition at line 440 of file rail_gui.cpp.
References RailtypeInfo::auto_rail, RailtypeInfo::build_depot, RailtypeInfo::build_ew_rail, RailtypeInfo::build_ns_rail, RailtypeInfo::build_tunnel, RailtypeInfo::build_x_rail, RailtypeInfo::build_y_rail, RailtypeInfo::convert_rail, GetRailTypeInfo(), RailtypeInfo::gui_sprites, and RAILTYPE_END.
Referenced by ModifyRailType().
Hotkey< BuildRailToolbarWindow > BuildRailToolbarWindow::railtoolbar_hotkeys [static] |
{ Hotkey<BuildRailToolbarWindow>('1', "build_ns", RTW_BUILD_NS), Hotkey<BuildRailToolbarWindow>('2', "build_x", RTW_BUILD_X), Hotkey<BuildRailToolbarWindow>('3', "build_ew", RTW_BUILD_EW), Hotkey<BuildRailToolbarWindow>('4', "build_y", RTW_BUILD_Y), Hotkey<BuildRailToolbarWindow>(_railtoolbar_autorail_keys, "autorail", RTW_AUTORAIL), Hotkey<BuildRailToolbarWindow>('6', "demolish", RTW_DEMOLISH), Hotkey<BuildRailToolbarWindow>('7', "depot", RTW_BUILD_DEPOT), Hotkey<BuildRailToolbarWindow>('8', "waypoint", RTW_BUILD_WAYPOINT), Hotkey<BuildRailToolbarWindow>('9', "station", RTW_BUILD_STATION), Hotkey<BuildRailToolbarWindow>('S', "signal", RTW_BUILD_SIGNALS), Hotkey<BuildRailToolbarWindow>('B', "bridge", RTW_BUILD_BRIDGE), Hotkey<BuildRailToolbarWindow>('T', "tunnel", RTW_BUILD_TUNNEL), Hotkey<BuildRailToolbarWindow>('R', "remove", RTW_REMOVE), Hotkey<BuildRailToolbarWindow>('C', "convert", RTW_CONVERT_RAIL), }
Definition at line 759 of file rail_gui.cpp.