TooltipsWindow Struct Reference

Window for displaying a tooltip. More...

Inheritance diagram for TooltipsWindow:
Window ZeroedMemoryAllocator

Public Member Functions

 TooltipsWindow (Window *parent, StringID str, uint paramcount, const uint64 params[], TooltipCloseCondition close_tooltip)
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 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.

Detailed Description

Window for displaying a tooltip.

Definition at line 886 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 941 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 ( 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 908 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.

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 928 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:

Generated on Fri May 27 04:21:26 2011 for OpenTTD by  doxygen 1.6.1