The Battle for Wesnoth  1.15.12+dev
Public Member Functions | Private Member Functions | Private Attributes | List of all members
gui2::dialogs::tooltip Class Reference

Class to show the tips. More...

Inheritance diagram for gui2::dialogs::tooltip:

Public Member Functions

 tooltip ()
 
void set_window_id (const std::string &window_id)
 
void set_message (const t_string &message)
 
void set_mouse (const point &mouse)
 
void set_source_rect (const SDL_Rect &rect)
 
- Public Member Functions inherited from gui2::dialogs::modeless_dialog
 modeless_dialog ()
 
virtual ~modeless_dialog ()
 
void show (const bool allow_interaction=false, const unsigned auto_close_time=0)
 Shows the window. More...
 
void hide ()
 Hides the window. More...
 
windowget_window () const
 Returns a pointer to the dialog's window. More...
 

Private Member Functions

virtual const std::string & window_id () const override
 Inherited from modeless_dialog. More...
 
virtual void pre_show (window &window) override
 Inherited from modeless_dialog. More...
 

Private Attributes

std::string window_id_
 The id of the window to use to show the tip. More...
 
t_string message_
 The message to show. More...
 
point mouse_
 The position of the mouse. More...
 
SDL_Rect source_rect_
 The size of the requestor. More...
 

Additional Inherited Members

- Protected Attributes inherited from gui2::dialogs::modeless_dialog
std::unique_ptr< windowwindow_
 The window, used in show. More...
 

Detailed Description

Class to show the tips.

At the moment two kinds of tips are known:

Generic window to show a floating tip window. The class has several subclasses using the same format. For example there will be tooltips and helptips, both using this class.

Key Type MandatoryDescription
label control yes This text contains the message to show in the tip.

In the canvas of the windows used in this dialog the following variables are defined:

Variable Type Description
mouse_x unsigned The x coordinate of the mouse pointer when the window was created.
mouse_y unsigned The y coordinate of the mouse pointer when the window was created.

Definition at line 56 of file tooltip.cpp.

Constructor & Destructor Documentation

◆ tooltip()

gui2::dialogs::tooltip::tooltip ( )
inline

Definition at line 59 of file tooltip.cpp.

Referenced by gui2::dialogs::tip::tip().

Member Function Documentation

◆ pre_show()

void gui2::dialogs::tooltip::pre_show ( window window)
overrideprivatevirtual

Inherited from modeless_dialog.

Reimplemented from gui2::dialogs::modeless_dialog.

Definition at line 108 of file tooltip.cpp.

References message_, mouse_, source_rect_, point::x, and point::y.

◆ set_message()

void gui2::dialogs::tooltip::set_message ( const t_string message)
inline

Definition at line 73 of file tooltip.cpp.

Referenced by gui2::dialogs::tip::show().

◆ set_mouse()

void gui2::dialogs::tooltip::set_mouse ( const point mouse)
inline

Definition at line 78 of file tooltip.cpp.

Referenced by gui2::dialogs::tip::show().

◆ set_source_rect()

void gui2::dialogs::tooltip::set_source_rect ( const SDL_Rect &  rect)
inline

Definition at line 83 of file tooltip.cpp.

Referenced by gui2::dialogs::tip::show().

◆ set_window_id()

void gui2::dialogs::tooltip::set_window_id ( const std::string &  window_id)
inline

Definition at line 68 of file tooltip.cpp.

Referenced by gui2::dialogs::tip::show().

◆ window_id()

const std::string & gui2::dialogs::tooltip::window_id ( ) const
overrideprivatevirtual

Inherited from modeless_dialog.

Implements gui2::dialogs::modeless_dialog.

Definition at line 121 of file tooltip.cpp.

References window_id_.

Member Data Documentation

◆ message_

t_string gui2::dialogs::tooltip::message_
private

The message to show.

Definition at line 93 of file tooltip.cpp.

Referenced by pre_show().

◆ mouse_

point gui2::dialogs::tooltip::mouse_
private

The position of the mouse.

Definition at line 96 of file tooltip.cpp.

Referenced by pre_show().

◆ source_rect_

SDL_Rect gui2::dialogs::tooltip::source_rect_
private

The size of the requestor.

Definition at line 99 of file tooltip.cpp.

Referenced by pre_show().

◆ window_id_

std::string gui2::dialogs::tooltip::window_id_
private

The id of the window to use to show the tip.

Definition at line 90 of file tooltip.cpp.

Referenced by window_id().


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