# BuildRoadToolbarWindow Struct Reference

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 | OnPaint ()
| The window must be repainted.
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.

## Detailed Description

Definition at line 407 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 491 of file road_gui.cpp.

References _ctrl_pressed, _remove_button_clicked, RoadToolbar_CtrlChanged(), and UpdateOptionWidgetStatus().

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

References Window::ES_HANDLED, Window::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 426 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 502 of file road_gui.cpp.

References _ctrl_pressed, _remove_button_clicked, Window::ES_HANDLED, Window::ES_NOT_HANDLED, lengthof, MarkTileDirtyByTile(), RoadToolbar_CtrlChanged(), and UpdateOptionWidgetStatus().

virtual void BuildRoadToolbarWindow::OnPaint | ( |  | ) | `[inline, virtual]`

The window must be repainted.

Note:
  This method should not change any state, it should only use drawing functions.

Reimplemented from Window.

Definition at line 486 of file road_gui.cpp.

References Window::DrawWidgets().

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

References DDSP_PLACE_AUTOROAD, DDSP_PLACE_ROAD_X_DIR, DDSP_PLACE_ROAD_Y_DIR, 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 587 of file road_gui.cpp.

References _remove_button_clicked, _settings_client, CMD_BUILD_LONG_ROAD, CMD_MSG, CMD_REMOVE_LONG_ROAD, DDSP_BUILD_BRIDGE, DDSP_DEMOLISH_AREA, DDSP_PLACE_AUTOROAD, DDSP_PLACE_ROAD_X_DIR, DDSP_PLACE_ROAD_Y_DIR, DoCommandP(), ClientSettings::gui, GUIPlaceProcDragXY(), GUISettings::persistent_buildingtools, RoadTypeToRoadTypes(), ShowBuildBridgeWindow(), and TRANSPORT_ROAD.

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

References _remove_button_clicked, and Window::IsWidgetLowered().

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 619 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 440 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(), and OnKeyPress().

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

- src/road_gui.cpp