Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

PG_ToolTipHelp Class Reference

ToolTip Help for widgets. More...

#include <pgtooltiphelp.h>

List of all members.

Public Member Functions

 PG_ToolTipHelp (PG_Widget *parent, const std::string &text, int delay=10, const std::string &style="ToolTipHelp")
 Create a ToolTipHelp for the given widget.
void SetText (const std::string &text)
 Changes the help text.
void ShowHelp (const PG_Point &pos)
 Show the help to be shown.
void HideHelp ()
 Hides the ToolTip Help.

Protected Types

enum  { off, counting, shown }

Protected Member Functions

bool onParentEnter (PG_Pointer dummy)
bool onParentLeave (PG_Pointer dummy)
bool onParentDelete (const PG_MessageObject *object)
bool onMouseMotion (const SDL_MouseMotionEvent *motion)
bool onIdle ()

Protected Attributes

PG_WidgetparentWidget
PG_TimerObject::ID id
Uint32 lastTick
enum PG_ToolTipHelp:: { ... }  status
std::string my_text
std::string labelStyle
int my_delay

Static Protected Attributes

static PG_LineEdittoolTipLabel = NULL

Classes

class  Ticker


Detailed Description

ToolTip Help for widgets.

Author:
Martin Bickel
Displays ToolTip help that opens when a mouse cursor hovers over a widget. It behaves similar to a PG_Widget, but it is not derived from it

The ToolTipHelp will delete itself when the parent widget is deleted. It is also safe to delete the ToolTipHelp object manually prior to deleting the widget.

Query the cursor size and position the help so it doesn't overlap with large cursors

Definition at line 55 of file pgtooltiphelp.h.


Member Enumeration Documentation

anonymous enum [protected]
 

Enumeration values:
off 
counting 
shown 

Definition at line 82 of file pgtooltiphelp.h.


Constructor & Destructor Documentation

PG_ToolTipHelp::PG_ToolTipHelp PG_Widget parent,
const std::string &  text,
int  delay = 10,
const std::string &  style = "ToolTipHelp"
 

Create a ToolTipHelp for the given widget.

It automatically enables SigIdle calls for PG_Application

Parameters:
parent The widget for which the ToolTip Help shall be shown
text The help text
delay The delay in 1/10 s after which the help appears when the mouse has stopped moving
style The theme style for the Help. Default: Widget Type = ToolTipHelp . Object Name = LineEdit

Definition at line 43 of file pgtooltiphelp.cpp.

References PG_Application::GetApp(), onIdle(), onMouseMotion(), onParentDelete(), onParentEnter(), onParentLeave(), SetText(), PG_MessageObject::sigDelete, PG_Widget::sigMouseEnter, PG_Widget::sigMouseLeave, and PG_MessageObject::sigMouseMotion.


Member Function Documentation

void PG_ToolTipHelp::HideHelp  ) 
 

Hides the ToolTip Help.

Definition at line 162 of file pgtooltiphelp.cpp.

References toolTipLabel.

Referenced by onMouseMotion(), and onParentDelete().

bool PG_ToolTipHelp::onIdle  )  [protected]
 

Definition at line 64 of file pgtooltiphelp.cpp.

References counting, PG_Application::GetEventSupplier(), PG_Widget::IsMouseInside(), lastTick, off, parentWidget, ShowHelp(), shown, and status.

Referenced by PG_ToolTipHelp().

bool PG_ToolTipHelp::onMouseMotion const SDL_MouseMotionEvent *  motion  )  [protected]
 

Definition at line 118 of file pgtooltiphelp.cpp.

References counting, HideHelp(), lastTick, and status.

Referenced by PG_ToolTipHelp(), and ShowHelp().

bool PG_ToolTipHelp::onParentDelete const PG_MessageObject object  )  [protected]
 

Definition at line 110 of file pgtooltiphelp.cpp.

References HideHelp(), off, and status.

Referenced by PG_ToolTipHelp().

bool PG_ToolTipHelp::onParentEnter PG_Pointer  dummy  )  [protected]
 

Referenced by PG_ToolTipHelp().

bool PG_ToolTipHelp::onParentLeave PG_Pointer  dummy  )  [protected]
 

Referenced by PG_ToolTipHelp().

void PG_ToolTipHelp::SetText const std::string &  text  ) 
 

Changes the help text.

Definition at line 60 of file pgtooltiphelp.cpp.

References my_text.

Referenced by PG_ToolTipHelp().

void PG_ToolTipHelp::ShowHelp const PG_Point pos  ) 
 

Show the help to be shown.

Parameters:
pos The screen coordinates of the upper left corner

Definition at line 129 of file pgtooltiphelp.cpp.

References PG_Application::GetScreen(), PG_Widget::GetTextSize(), labelStyle, PG_Widget::MoveWidget(), my_text, onMouseMotion(), PG_LineEdit::SetEditable(), PG_LineEdit::SetText(), PG_Widget::Show(), PG_MessageObject::sigMouseMotion, toolTipLabel, PG_Point::x, and PG_Point::y.

Referenced by onIdle().


Member Data Documentation

PG_TimerObject::ID PG_ToolTipHelp::id [protected]
 

Definition at line 79 of file pgtooltiphelp.h.

std::string PG_ToolTipHelp::labelStyle [protected]
 

Definition at line 85 of file pgtooltiphelp.h.

Referenced by ShowHelp().

Uint32 PG_ToolTipHelp::lastTick [protected]
 

Definition at line 80 of file pgtooltiphelp.h.

Referenced by onIdle(), and onMouseMotion().

int PG_ToolTipHelp::my_delay [protected]
 

Definition at line 87 of file pgtooltiphelp.h.

std::string PG_ToolTipHelp::my_text [protected]
 

Definition at line 84 of file pgtooltiphelp.h.

Referenced by SetText(), and ShowHelp().

PG_Widget* PG_ToolTipHelp::parentWidget [protected]
 

Definition at line 78 of file pgtooltiphelp.h.

Referenced by onIdle().

enum { ... } PG_ToolTipHelp::status [protected]
 

Referenced by onIdle(), onMouseMotion(), and onParentDelete().

PG_LineEdit * PG_ToolTipHelp::toolTipLabel = NULL [static, protected]
 

Definition at line 39 of file pgtooltiphelp.cpp.

Referenced by HideHelp(), and ShowHelp().


The documentation for this class was generated from the following files:
Generated on Tue Jun 24 02:19:39 2008 for Advanced Strategic Command by  doxygen 1.4.2