Crazy Eddie's GUI System  0.8.7
widgets/Tooltip.h
1 /***********************************************************************
2  created: 21/2/2005
3  author: Paul D Turner
4 *************************************************************************/
5 /***************************************************************************
6  * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining
9  * a copy of this software and associated documentation files (the
10  * "Software"), to deal in the Software without restriction, including
11  * without limitation the rights to use, copy, modify, merge, publish,
12  * distribute, sublicense, and/or sell copies of the Software, and to
13  * permit persons to whom the Software is furnished to do so, subject to
14  * the following conditions:
15  *
16  * The above copyright notice and this permission notice shall be
17  * included in all copies or substantial portions of the Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25  * OTHER DEALINGS IN THE SOFTWARE.
26  ***************************************************************************/
27 #ifndef _CEGUITooltip_h_
28 #define _CEGUITooltip_h_
29 
30 #include "../Window.h"
31 
32 #if defined(_MSC_VER)
33 # pragma warning(push)
34 # pragma warning(disable : 4251)
35 #endif
36 
37 // Start of CEGUI namespace section
38 namespace CEGUI
39 {
44  class CEGUIEXPORT TooltipWindowRenderer : public WindowRenderer
45  {
46  public:
52 
61  virtual Sizef getTextSize() const = 0;
62  };
63 
79  class CEGUIEXPORT Tooltip : public Window
80  {
81  public:
82  /*************************************************************************
83  Constants
84  *************************************************************************/
85  static const String WidgetTypeName;
86  static const String EventNamespace;
121 
122  /************************************************************************
123  Object Construction and Destruction
124  ************************************************************************/
129  Tooltip(const String& type, const String& name);
130 
135  ~Tooltip(void);
136 
137  /************************************************************************
138  Public interface
139  ************************************************************************/
152 
161 
170  void resetTimer(void);
171 
180  float getHoverTime(void) const;
181 
193  void setDisplayTime(float seconds);
194 
206  void setHoverTime(float seconds);
207 
216  float getDisplayTime(void) const;
217 
225  void positionSelf(void);
226 
234  void sizeSelf(void);
235 
245 
254  virtual Sizef getTextSize_impl() const;
255 
256  protected:
257  /*************************************************************************
258  Implementation Methods
259  *************************************************************************/
260  // methods to perform processing for each of the widget states
261  void doActiveState(float elapsed);
262  void doInactiveState(float elapsed);
263 
264  // methods to switch widget states
265  void switchToInactiveState(void);
266  void switchToActiveState(void);
267 
268  // validate window renderer
269  virtual bool validateWindowRenderer(const WindowRenderer* renderer) const;
270 
271  /*************************************************************************
272  Event triggers
273  *************************************************************************/
282 
291 
300 
309 
318 
319 
320  /************************************************************************
321  Overridden from Window.
322  ************************************************************************/
323  void updateSelf(float elapsed);
327 
328  /************************************************************************
329  Data fields
330  ************************************************************************/
331  bool d_active;
332  float d_elapsed;
333  const Window* d_target;
334  float d_hoverTime;
336  float d_fadeTime;
339 
340  private:
341  /*************************************************************************
342  Private methods
343  *************************************************************************/
344  void addTooltipProperties(void);
345  };
346 } // End of CEGUI namespace section
347 
348 #if defined(_MSC_VER)
349 # pragma warning(pop)
350 #endif
351 
352 #endif // end of guard _CEGUITooltip_h_
EventArgs based class that is used for objects passed to input event handlers concerning mouse input.
Definition: InputEvent.h:281
String class used within the GUI system.
Definition: String.h:64
Base class for Tooltip window renderer objects.
Definition: widgets/Tooltip.h:45
TooltipWindowRenderer(const String &name)
Constructor.
virtual Sizef getTextSize() const =0
Return the size of the area that will be occupied by the tooltip text, given any current formatting o...
Base class for Tooltip widgets.
Definition: widgets/Tooltip.h:80
static const String EventTooltipTransition
Definition: widgets/Tooltip.h:120
void positionSelf(void)
Causes the tooltip to position itself appropriately.
void setHoverTime(float seconds)
Set the number of seconds the mouse should hover stationary over the target window before the tooltip...
float d_hoverTime
tool-tip hover time (seconds mouse must stay stationary before tip shows).
Definition: widgets/Tooltip.h:334
virtual void onTooltipActive(WindowEventArgs &e)
Event trigger method called just before the tooltip becomes active.
bool d_inPositionSelf
are in positionSelf function? (to avoid infinite recursion issues)
Definition: widgets/Tooltip.h:338
Tooltip(const String &type, const String &name)
Constructor for the Tooltip base class constructor.
virtual void onTooltipTransition(WindowEventArgs &e)
Event trigger method called just after the tooltip changed target window but remained active.
static const String EventTooltipInactive
Definition: widgets/Tooltip.h:115
bool d_active
true if the tooltip is active
Definition: widgets/Tooltip.h:331
const Window * d_target
Current target Window for this Tooltip.
Definition: widgets/Tooltip.h:333
void onTextChanged(WindowEventArgs &e)
Handler called when the window's text is changed.
void setDisplayTime(float seconds)
Set the number of seconds the tooltip should be displayed for before it automatically de-activates it...
static const String EventFadeTimeChanged
Definition: widgets/Tooltip.h:104
virtual bool validateWindowRenderer(const WindowRenderer *renderer) const
Function used in checking if a WindowRenderer is valid for this window.
void resetTimer(void)
Resets the timer on the tooltip when in the Active / Inactive states. This is used internally to cont...
float d_elapsed
Used to track state change timings.
Definition: widgets/Tooltip.h:332
~Tooltip(void)
Destructor for the Tooltip base class.
virtual void onTooltipInactive(WindowEventArgs &e)
Event trigger method called just after the tooltip is deactivated.
float getHoverTime(void) const
Return the number of seconds the mouse should hover stationary over the target window before the tool...
float d_fadeTime
Definition: widgets/Tooltip.h:336
void updateSelf(float elapsed)
Perform actual update processing for this Window.
static const String EventHoverTimeChanged
Definition: widgets/Tooltip.h:92
static const String WidgetTypeName
Window factory name.
Definition: widgets/Tooltip.h:85
void onHidden(WindowEventArgs &e)
Handler called when the window is hidden.
void setTargetWindow(Window *wnd)
Sets the target window for the tooltip. This used internally to manage tooltips, you should not have ...
void sizeSelf(void)
Causes the tooltip to resize itself appropriately.
virtual void onDisplayTimeChanged(WindowEventArgs &e)
Event trigger method called when the display timeout gets changed.
float getDisplayTime(void) const
Return the number of seconds the tooltip should be displayed for before it automatically de-activates...
virtual void onHoverTimeChanged(WindowEventArgs &e)
Event trigger method called when the hover timeout gets changed.
static const String EventNamespace
Namespace for global events.
Definition: widgets/Tooltip.h:86
void onMouseEnters(MouseEventArgs &e)
Handler called when the mouse cursor has entered this window's area and is actually over some part of...
const Window * getTargetWindow()
return the current target window for this Tooltip.
static const String EventTooltipActive
Definition: widgets/Tooltip.h:110
static const String EventDisplayTimeChanged
Definition: widgets/Tooltip.h:98
virtual Sizef getTextSize_impl() const
Return the size of the area that will be occupied by the tooltip text, given any current formatting o...
float d_displayTime
tool-tip display time (seconds that tip is showsn for).
Definition: widgets/Tooltip.h:335
Sizef getTextSize() const
Return the size of the area that will be occupied by the tooltip text, given any current formatting o...
EventArgs based class that is used for objects passed to handlers triggered for events concerning som...
Definition: InputEvent.h:252
Base-class for the assignable WindowRenderer object.
Definition: WindowRenderer.h:52
An abstract base class providing common functionality and specifying the required interface for deriv...
Definition: Window.h:151
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1