# ScenarioEditorToolbarWindow Struct Reference

Inheritance diagram for ScenarioEditorToolbarWindow:

## Public Member Functions

| ScenarioEditorToolbarWindow (const WindowDesc *desc)
virtual void | OnPaint ()
| The window must be repainted.
virtual void | DrawWidget (const Rect &r, int widget) const
| Draw the contents of a nested widget.
virtual void | UpdateWidgetSize (int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
| Update size and resize step of a widget in the window.
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 | OnTimeout ()
| Called when this window's timeout has been reached.
virtual void | OnTick ()
| Called once per (game) tick.
virtual void | OnInvalidateData (int data)
| Some data on this window has become invalid.

## Detailed Description

Definition at line 1426 of file toolbar_gui.cpp.

## Member Function Documentation

virtual void ScenarioEditorToolbarWindow::DrawWidget | ( | const Rect & | r,
|  | int | widget |
| ) |  |  | const`[inline, virtual]`

Draw the contents of a nested widget.

Parameters:

  | r | Rectangle occupied by the widget.
  | widget | Number of the widget to draw.

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

Reimplemented from Window.

Definition at line 1445 of file toolbar_gui.cpp.

References _settings_game, ConvertYMDToDate(), DrawString(), FONT_HEIGHT_NORMAL, GameSettings::game_creation, Window::height, SA_CENTER, SetDParam(), and GameCreationSettings::starting_year.

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

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

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

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

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

References Window::ES_HANDLED, Window::ES_NOT_HANDLED, WKC_EQUALS, and WKC_MINUS.

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

References _settings_game, Window::DrawWidgets(), GameSettings::game_creation, MAX_YEAR, MIN_YEAR, Window::SetWidgetDisabledState(), and GameCreationSettings::starting_year.

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

virtual void ScenarioEditorToolbarWindow::UpdateWidgetSize | ( | int | widget,
|  | Dimension * | size,
|  | const Dimension & | padding,
|  | Dimension * | fill,
|  | Dimension * | resize |
| ) |  |  | `[inline, virtual]`

Update size and resize step of a widget in the window.

After retrieval of the minimal size and the resize-steps of a widget, this function is called to allow further refinement, typically by computing the real maximal size of the content. Afterwards, size is taken to be the minimal size of the widget and resize is taken to contain the resize steps. For the convenience of the callee, padding contains the amount of padding between the content and the edge of the widget. This should be added to the returned size.

Parameters:

  | widget | Widget number.
  | size | Size of the widget.
  | padding | Recommended amount of space between the widget content and the widget edge.
  | fill | Fill step of the widget.
  | resize | Resize step of the widget.

Reimplemented from Window.

Definition at line 1465 of file toolbar_gui.cpp.

References ConvertYMDToDate(), GetSpriteSize(), GetStringBoundingBox(), Window::height, max(), MAX_YEAR, SetDParam(), WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, WD_IMGBTN_BOTTOM, WD_IMGBTN_TOP, and Window::width.

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

- src/toolbar_gui.cpp