Public Member Functions | Data Fields | Static Public Attributes

# BuildRoadToolbarWindow Struct Reference

Road toolbar window handler. More...

Inheritance diagram for BuildRoadToolbarWindow:

## 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 []

## Detailed Description

Road toolbar window handler.

Definition at line 308 of file road_gui.cpp.

## Member Function Documentation

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.

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 396 of file road_gui.cpp.

References _ctrl_pressed, _remove_button_clicked, _settings_client, ANIMCURSOR_DEMOLISH, CanBuildVehicleInfrastructure(), SoundSettings::click_beep, DeleteWindowById(), HandlePlacePushButton(), HT_DIAGONAL, HT_RECT, HT_SPECIAL, Window::IsWidgetDisabled(), last_started_action, ROADSTOP_BUS, ROADSTOP_TRUCK, RoadToolbar_CtrlChanged(), Window::SetDirty(), ClientSettings::sound, ToggleRoadButton_Remove(), Window::ToggleWidgetLoweredState(), UpdateOptionWidgetStatus(), VEH_ROAD, WC_SELECT_STATION, WID_ROT_AUTOROAD, WID_ROT_BUILD_BRIDGE, WID_ROT_BUILD_TUNNEL, WID_ROT_BUS_STATION, WID_ROT_DEMOLISH, WID_ROT_DEPOT, WID_ROT_ONE_WAY, WID_ROT_REMOVE, WID_ROT_ROAD_X, WID_ROT_ROAD_Y, and WID_ROT_TRUCK_STATION.

Referenced by OnKeyPress().

virtual EventState BuildRoadToolbarWindow::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 657 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.

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 335 of file road_gui.cpp.

References CanBuildVehicleInfrastructure(), Window::SetWidgetsDisabledState(), VEH_ROAD, WID_ROT_BUS_STATION, WID_ROT_DEPOT, WID_ROT_TRUCK_STATION, and WIDGET_LIST_END.

virtual EventState BuildRoadToolbarWindow::OnKeyPress | ( | uint16 | key,
|  | uint16 | keycode |
| ) |  |  | `[inline, virtual]`

A key has been pressed.

Parameters:

  | key | the Unicode value of the key.
  | keycode | the untranslated key code including shift state.

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

Reimplemented from Window.

Definition at line 476 of file road_gui.cpp.

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

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.

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 556 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.

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 599 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.

virtual void BuildRoadToolbarWindow::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 485 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, VpStartPlaceSizing(), WID_ROT_AUTOROAD, WID_ROT_BUILD_BRIDGE, WID_ROT_BUILD_TUNNEL, WID_ROT_BUS_STATION, WID_ROT_DEMOLISH, WID_ROT_DEPOT, WID_ROT_ONE_WAY, WID_ROT_REMOVE, WID_ROT_ROAD_X, WID_ROT_ROAD_Y, and WID_ROT_TRUCK_STATION.

virtual void BuildRoadToolbarWindow::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 651 of file road_gui.cpp.

References _build_tunnel_endtile, 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.

Parameters:

  | clicked_widget | The widget which the client clicked just now

Definition at line 350 of file road_gui.cpp.

References Window::DisableWidget(), Window::IsWidgetLowered(), Window::RaiseWidget(), Window::SetWidgetDirty(), Window::SetWidgetDisabledState(), Window::SetWidgetsDisabledState(), Window::SetWidgetsLoweredState(), WID_ROT_AUTOROAD, WID_ROT_BUS_STATION, WID_ROT_ONE_WAY, WID_ROT_REMOVE, WID_ROT_ROAD_X, WID_ROT_ROAD_Y, WID_ROT_TRUCK_STATION, and WIDGET_LIST_END.

Referenced by OnClick().

## Field Documentation

Hotkey< BuildRoadToolbarWindow > BuildRoadToolbarWindow::roadtoolbar_hotkeys`[static]`

Initial value:

     {
      Hotkey<BuildRoadToolbarWindow>('1', "build_x", WID_ROT_ROAD_X),
      Hotkey<BuildRoadToolbarWindow>('2', "build_y", WID_ROT_ROAD_Y),
      Hotkey<BuildRoadToolbarWindow>('3', "autoroad", WID_ROT_AUTOROAD),
      Hotkey<BuildRoadToolbarWindow>('4', "demolish", WID_ROT_DEMOLISH),
      Hotkey<BuildRoadToolbarWindow>('5', "depot", WID_ROT_DEPOT),
      Hotkey<BuildRoadToolbarWindow>('6', "bus_station", WID_ROT_BUS_STATION),
      Hotkey<BuildRoadToolbarWindow>('7', "truck_station", WID_ROT_TRUCK_STATION),
      Hotkey<BuildRoadToolbarWindow>('8', "oneway", WID_ROT_ONE_WAY),
      Hotkey<BuildRoadToolbarWindow>('B', "bridge", WID_ROT_BUILD_BRIDGE),
      Hotkey<BuildRoadToolbarWindow>('T', "tunnel", WID_ROT_BUILD_TUNNEL),
      Hotkey<BuildRoadToolbarWindow>('R', "remove", WID_ROT_REMOVE),

    }

Definition at line 663 of file road_gui.cpp.

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

- src/road_gui.cpp