# TerraformToolbarWindow Struct Reference

Terra form toolbar managing class. More...

Inheritance diagram for TerraformToolbarWindow:

## Public Member Functions
| TerraformToolbarWindow (const WindowDesc *desc, WindowNumber window_number)
virtual void | OnInit ()
| Notification that the nested widget tree gets initialized.
virtual void | OnClick (Point pt, int widget, int click_count)
| A click with the left mouse button has been made on the window.
virtual void | OnTimeout ()
| Called when this window's timeout has been reached.
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 Point | OnInitialPosition (const WindowDesc *desc, int16 sm_width, int16 sm_height, int window_number)
| Compute the initial position of the window.
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.
## Data Fields
int | last_user_action
| Last started user action.
## Static Public Attributes
static Hotkey < TerraformToolbarWindow > | terraform_hotkeys []

## Detailed Description

Terra form toolbar managing class.

Definition at line 159 of file terraform_gui.cpp.

## Member Function Documentation

virtual void TerraformToolbarWindow::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 181 of file terraform_gui.cpp.

References ANIMCURSOR_DEMOLISH, ANIMCURSOR_LOWERLAND, ANIMCURSOR_RAISELAND, Window::HandleButtonClick(), HandlePlacePushButton(), HT_DIAGONAL, HT_POINT, HT_RECT, last_user_action, ShowBuildObjectPicker(), TTW_BUTTONS_START, TTW_BUY_LAND, TTW_DEMOLISH, TTW_LEVEL_LAND, TTW_LOWER_LAND, TTW_PLACE_OBJECT, TTW_PLACE_SIGN, TTW_PLANT_TREES, and TTW_RAISE_LAND.

Referenced by OnKeyPress().

virtual void TerraformToolbarWindow::OnInit | ( |  | ) | `[inline, virtual]`

Notification that the nested widget tree gets initialized.

The event can be used to perform general computations.

Note:
  nested_root and/or nested_array (normally accessed via GetWidget()) may not exist during this call.

Reimplemented from Window.

Definition at line 174 of file terraform_gui.cpp.

References NWidgetStacked::SetDisplayedPlane(), SZSP_NONE, and TTW_SHOW_PLACE_OBJECT.

virtual Point TerraformToolbarWindow::OnInitialPosition | ( | const WindowDesc * | desc,
|  | int16 | sm_width,
|  | int16 | sm_height,
|  | int | window_number |
| ) |  |  | `[inline, virtual]`

Compute the initial position of the window.

Parameters:

  | *desc | The pointer to the WindowDesc of the window to create.
  | sm_width | Smallest width of the window.
  | sm_height | Smallest height of the window.
  | window_number | The window number of the new window.

Returns:
  Initial position of the top-left corner of the window.

Reimplemented from Window.

Definition at line 289 of file terraform_gui.cpp.

References GetToolbarAlignedWindowPosition().

virtual EventState TerraformToolbarWindow::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 241 of file terraform_gui.cpp.

References CheckHotkeyMatch(), ES_HANDLED, ES_NOT_HANDLED, and OnClick().

virtual void TerraformToolbarWindow::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 284 of file terraform_gui.cpp.

References VpSelectTilesWithMethod().

virtual void TerraformToolbarWindow::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 296 of file terraform_gui.cpp.

References DDSP_DEMOLISH_AREA, DDSP_LEVEL_AREA, DDSP_LOWER_AND_LEVEL_AREA, DDSP_RAISE_AND_LEVEL_AREA, and GUIPlaceProcDragXY().

virtual void TerraformToolbarWindow::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 249 of file terraform_gui.cpp.

References CMD_BUILD_OBJECT, CMD_MSG, DDSP_LEVEL_AREA, DDSP_LOWER_AND_LEVEL_AREA, DDSP_RAISE_AND_LEVEL_AREA, DoCommandP(), last_user_action, OBJECT_OWNED_LAND, PlaceProc_DemolishArea(), PlaceProc_Object(), PlaceProc_Sign(), TTW_BUY_LAND, TTW_DEMOLISH, TTW_LEVEL_LAND, TTW_LOWER_LAND, TTW_PLACE_OBJECT, TTW_PLACE_SIGN, TTW_RAISE_LAND, VPM_X_AND_Y, and VpStartPlaceSizing().

## Field Documentation

Hotkey< TerraformToolbarWindow > TerraformToolbarWindow::terraform_hotkeys`[static]`

Initial value:

     {
      Hotkey<TerraformToolbarWindow>('Q' | WKC_GLOBAL_HOTKEY, "lower", TTW_LOWER_LAND),
      Hotkey<TerraformToolbarWindow>('W' | WKC_GLOBAL_HOTKEY, "raise", TTW_RAISE_LAND),
      Hotkey<TerraformToolbarWindow>('E' | WKC_GLOBAL_HOTKEY, "level", TTW_LEVEL_LAND),
      Hotkey<TerraformToolbarWindow>('D' | WKC_GLOBAL_HOTKEY, "dynamite", TTW_DEMOLISH),
      Hotkey<TerraformToolbarWindow>('U', "buyland", TTW_BUY_LAND),
      Hotkey<TerraformToolbarWindow>('I', "trees", TTW_PLANT_TREES),
      Hotkey<TerraformToolbarWindow>('O', "placesign", TTW_PLACE_SIGN),
      Hotkey<TerraformToolbarWindow>('P', "placeobject", TTW_PLACE_OBJECT),

    }

Definition at line 317 of file terraform_gui.cpp.

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

- src/terraform_gui.cpp