Window for displaying a tooltip. More...
Public Member Functions | |
TooltipsWindow (Window *parent, StringID str, uint paramcount, const uint64 params[], TooltipCloseCondition close_tooltip) | |
virtual Point | OnInitialPosition (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 | 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. | |
TooltipCloseCondition | close_cond |
Condition for closing the window. |
Window for displaying a tooltip.
Definition at line 627 of file misc_gui.cpp.
virtual void TooltipsWindow::DrawWidget | ( | const Rect & | r, | |
int | widget | |||
) | const [inline, virtual] |
Draw the contents of a nested widget.
r | Rectangle occupied by the widget. | |
widget | Number of the widget to draw. |
Reimplemented from Window.
Definition at line 682 of file misc_gui.cpp.
References DrawStringMultiLine(), GfxFillRect(), paramcount, params, PC_BLACK, PC_LIGHT_YELLOW, SA_CENTER, SetDParam(), WD_FRAMERECT_BOTTOM, WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, and WD_FRAMERECT_TOP.
virtual Point TooltipsWindow::OnInitialPosition | ( | int16 | sm_width, | |
int16 | sm_height, | |||
int | window_number | |||
) | [inline, virtual] |
Compute the initial position of the window.
sm_width | Smallest width of the window. | |
sm_height | Smallest height of the window. | |
window_number | The window number of the new window. |
Reimplemented from Window.
Definition at line 649 of file misc_gui.cpp.
References Clamp(), GetMainViewBottom(), GetMainViewTop(), and min().
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.
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 669 of file misc_gui.cpp.
References GetStringBoundingBox(), GetStringHeight(), min(), paramcount, params, SetDParam(), string_id, WD_FRAMERECT_LEFT, WD_FRAMERECT_TOP, and Window::width.