Road toolbar window handler. More...
Public Member Functions | |
BuildRoadToolbarWindow (const WindowDesc *desc, WindowNumber window_number) | |
virtual void | OnInvalidateData (int data=0, bool gui_scope=true) |
Some data on this window has become invalid. | |
void | UpdateOptionWidgetStatus (RoadToolbarWidgets clicked_widget) |
Update the remove button lowered state of the road toolbar. | |
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 | OnPlaceObjectAbort () |
The user cancelled a tile highlight mode that 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 | 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 | |
int | last_started_action |
Last started user action. | |
Static Public Attributes | |
static Hotkey < BuildRoadToolbarWindow > | roadtoolbar_hotkeys [] |
Road toolbar window handler.
Definition at line 322 of file road_gui.cpp.
virtual void BuildRoadToolbarWindow::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 410 of file road_gui.cpp.
References _ctrl_pressed, _remove_button_clicked, ANIMCURSOR_DEMOLISH, CanBuildVehicleInfrastructure(), DeleteWindowById(), HandlePlacePushButton(), HT_DIAGONAL, HT_RECT, HT_SPECIAL, Window::IsWidgetDisabled(), last_started_action, ROADSTOP_BUS, ROADSTOP_TRUCK, RoadToolbar_CtrlChanged(), Window::SetDirty(), ToggleRoadButton_Remove(), Window::ToggleWidgetLoweredState(), UpdateOptionWidgetStatus(), and VEH_ROAD.
Referenced by OnKeyPress().
virtual EventState BuildRoadToolbarWindow::OnCTRLStateChange | ( | ) | [inline, virtual] |
The state of the control key has changed.
Reimplemented from Window.
Definition at line 671 of file road_gui.cpp.
References RoadToolbar_CtrlChanged().
virtual void BuildRoadToolbarWindow::OnInvalidateData | ( | int | data = 0 , |
|
bool | gui_scope = true | |||
) | [inline, virtual] |
Some data on this window has become invalid.
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 349 of file road_gui.cpp.
References CanBuildVehicleInfrastructure(), Window::SetWidgetsDisabledState(), VEH_ROAD, and WIDGET_LIST_END.
virtual EventState BuildRoadToolbarWindow::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 490 of file road_gui.cpp.
References CheckHotkeyMatch(), MarkTileDirtyByTile(), OnClick(), and TileHighlightData::pos.
virtual void BuildRoadToolbarWindow::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 570 of file road_gui.cpp.
References DDSP_PLACE_AUTOROAD, DDSP_PLACE_ROAD_X_DIR, DDSP_PLACE_ROAD_Y_DIR, TileHighlightData::size, and VpSelectTilesWithMethod().
virtual void BuildRoadToolbarWindow::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 613 of file road_gui.cpp.
References _ctrl_pressed, _remove_button_clicked, _settings_client, CMD_BUILD_LONG_ROAD, CMD_BUILD_ROAD_STOP, CMD_MSG, CMD_REMOVE_LONG_ROAD, CMD_REMOVE_ROAD_STOP, DDSP_BUILD_BRIDGE, DDSP_BUILD_BUSSTOP, DDSP_BUILD_TRUCKSTOP, DDSP_DEMOLISH_AREA, DDSP_PLACE_AUTOROAD, DDSP_PLACE_ROAD_X_DIR, DDSP_PLACE_ROAD_Y_DIR, DDSP_REMOVE_BUSSTOP, DDSP_REMOVE_TRUCKSTOP, DoCommandP(), ClientSettings::gui, GUIPlaceProcDragXY(), TileArea::h, GUISettings::persistent_buildingtools, PlaceRoadStop(), ROADSTOP_BUS, ROADSTOP_TRUCK, RoadTypeToRoadTypes(), ShowBuildBridgeWindow(), TileArea::tile, TRANSPORT_ROAD, 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 499 of file road_gui.cpp.
References _remove_button_clicked, CcBuildRoadTunnel(), CMD_BUILD_ROAD_DEPOT, CMD_BUILD_TUNNEL, CMD_MSG, DDSP_PLACE_AUTOROAD, DDSP_PLACE_ROAD_X_DIR, DDSP_PLACE_ROAD_Y_DIR, DoCommandP(), Window::IsWidgetLowered(), last_started_action, PlaceProc_DemolishArea(), PlaceRoad_Bridge(), PlaceRoad_BusStation(), PlaceRoad_TruckStation(), RoadTypeToRoadTypes(), TRANSPORT_ROAD, VPM_FIX_X, VPM_FIX_Y, VPM_X_OR_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 665 of file road_gui.cpp.
References CMD_BUILD_TUNNEL, DC_AUTO, DoCommand(), RoadTypeToRoadTypes(), TRANSPORT_ROAD, and VpSetPresizeRange().
void BuildRoadToolbarWindow::UpdateOptionWidgetStatus | ( | RoadToolbarWidgets | clicked_widget | ) | [inline] |
Update the remove button lowered state of the road toolbar.
clicked_widget | The widget which the client clicked just now |
Definition at line 364 of file road_gui.cpp.
References Window::DisableWidget(), Window::IsWidgetLowered(), Window::RaiseWidget(), Window::SetWidgetDirty(), Window::SetWidgetDisabledState(), Window::SetWidgetsDisabledState(), Window::SetWidgetsLoweredState(), and WIDGET_LIST_END.
Referenced by OnClick().
Hotkey< BuildRoadToolbarWindow > BuildRoadToolbarWindow::roadtoolbar_hotkeys [static] |
{ Hotkey<BuildRoadToolbarWindow>('1', "build_x", RTW_ROAD_X), Hotkey<BuildRoadToolbarWindow>('2', "build_y", RTW_ROAD_Y), Hotkey<BuildRoadToolbarWindow>('3', "autoroad", RTW_AUTOROAD), Hotkey<BuildRoadToolbarWindow>('4', "demolish", RTW_DEMOLISH), Hotkey<BuildRoadToolbarWindow>('5', "depot", RTW_DEPOT), Hotkey<BuildRoadToolbarWindow>('6', "bus_station", RTW_BUS_STATION), Hotkey<BuildRoadToolbarWindow>('7', "truck_station", RTW_TRUCK_STATION), Hotkey<BuildRoadToolbarWindow>('8', "oneway", RTW_ONE_WAY), Hotkey<BuildRoadToolbarWindow>('B', "bridge", RTW_BUILD_BRIDGE), Hotkey<BuildRoadToolbarWindow>('T', "tunnel", RTW_BUILD_TUNNEL), Hotkey<BuildRoadToolbarWindow>('R', "remove", RTW_REMOVE), }
Definition at line 677 of file road_gui.cpp.