# TooltipsWindow Struct Reference

Window for displaying a tooltip. More...

Inheritance diagram for TooltipsWindow:

## Public Member Functions
| TooltipsWindow (StringID str, uint paramcount, const uint64 params[], bool use_left_mouse_button)
virtual Point | OnInitialPosition (const WindowDesc *desc, int16 sm_width, int16 sm_height, int window_number)
| Compute the initial position of the window.
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 | DrawWidget (const Rect &r, int widget) const
| Draw the contents of a nested widget.
virtual void | OnPaint ()
| The window must be repainted.
virtual void | OnMouseLoop ()
| Called for every mouse loop run, which is at least once per (game) tick.
## Data Fields
StringID | string_id
| String to display as tooltip.
byte | paramcount
| Number of string parameters in string_id.
uint64 | params [5]
| The string parameters.
bool | use_left_mouse_button
| Wait for left mouse button to close window (else, wait for right button).

## Detailed Description

Window for displaying a tooltip.

Definition at line 791 of file misc_gui.cpp.

## Member Function Documentation

virtual void TooltipsWindow::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 845 of file misc_gui.cpp.

References DrawStringMultiLine(), GfxFillRect(), paramcount, params, SA_CENTER, SetDParam(), WD_FRAMERECT_BOTTOM, WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, and WD_FRAMERECT_TOP.

virtual Point TooltipsWindow::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 812 of file misc_gui.cpp.

References Clamp(), GetMainViewBottom(), GetMainViewTop(), and min().

virtual void TooltipsWindow::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 858 of file misc_gui.cpp.

References Window::DrawWidgets().

virtual void TooltipsWindow::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 832 of file misc_gui.cpp.

References GetStringBoundingBox(), GetStringHeight(), min(), paramcount, params, SetDParam(), string_id, WD_FRAMERECT_BOTTOM, WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, WD_FRAMERECT_TOP, and Window::width.

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

- src/misc_gui.cpp