# BuildRoadToolbarWindow Struct Reference

Road toolbar window handler. More...

Inheritance diagram for BuildRoadToolbarWindow:

## Public Member Functions
| BuildRoadToolbarWindow (const WindowDesc *desc, WindowNumber window_number)
void | OnInvalidateData (int data=0)
| 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 322 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 404 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.

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

Reimplemented from Window.

Definition at line 665 of file road_gui.cpp.

References ES_HANDLED, ES_NOT_HANDLED, and RoadToolbar_CtrlChanged().

void BuildRoadToolbarWindow::OnInvalidateData | ( | int | data = `0` | ) | `[inline, virtual]`

Some data on this window has become invalid.

Parameters:

  | data | information about the changed data.

Reimplemented from Window.

Definition at line 344 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.

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

References CheckHotkeyMatch(), ES_HANDLED, ES_NOT_HANDLED, 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.

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 564 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 607 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 493 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().

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

Parameters:

  | clicked_widget | The widget which the client clicked just now

Definition at line 358 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().

## Field Documentation

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

Initial value:

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

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

- src/road_gui.cpp