# MainToolbarWindow Struct Reference

Inheritance diagram for MainToolbarWindow:

## Public Member Functions
| MainToolbarWindow (const WindowDesc *desc)
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 void | OnDropdownSelect (int widget, int index)
| A dropdown option associated to this window has been selected.
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 | OnTick ()
| Called once per (game) tick.
virtual void | OnTimeout ()
| Called when this window's timeout has been reached.
virtual void | OnInvalidateData (int data)
| Some data on this window has become invalid.

## Detailed Description

Definition at line 1211 of file toolbar_gui.cpp.

## Member Function Documentation

virtual void MainToolbarWindow::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 1238 of file toolbar_gui.cpp.

References Window::IsWidgetDisabled().

virtual void MainToolbarWindow::OnDropdownSelect | ( | int | widget,
|  | int | index |
| ) |  |  | `[inline, virtual]`

A dropdown option associated to this window has been selected.

Parameters:

  | widget | the widget (button) that the dropdown is associated with.
  | index | the element in the dropdown that is selected.

Reimplemented from Window.

Definition at line 1243 of file toolbar_gui.cpp.

virtual void MainToolbarWindow::OnInvalidateData | ( | int | data | ) | `[inline, virtual]`

Some data on this window has become invalid.

Parameters:

  | data | information about the changed data.

Reimplemented from Window.

Definition at line 1324 of file toolbar_gui.cpp.

References FindWindowById(), HandleZoomMessage(), and Window::viewport.

virtual EventState MainToolbarWindow::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 1248 of file toolbar_gui.cpp.

References _networking, CanBuildVehicleInfrastructure(), Window::ES_HANDLED, Window::ES_NOT_HANDLED, ShowBuildRailToolbar(), ShowCompanyFinances(), ShowCompanyStations(), VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, VEH_TRAIN, WKC_EQUALS, and WKC_MINUS.

virtual void MainToolbarWindow::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 1223 of file toolbar_gui.cpp.

References CanBuildVehicleInfrastructure(), COMPANY_SPECTATOR, Window::DrawWidgets(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::GetNumItems(), Window::SetWidgetDisabledState(), Window::SetWidgetsDisabledState(), VEH_AIRCRAFT, VEH_TRAIN, and WIDGET_LIST_END.

virtual void MainToolbarWindow::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 1294 of file toolbar_gui.cpp.

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

- src/toolbar_gui.cpp