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;
87 
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;
337  bool d_inPositionSelf;
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_
CEGUI::Tooltip::updateSelf
void updateSelf(float elapsed)
Perform actual update processing for this Window.
CEGUI::Tooltip
Base class for Tooltip widgets.
Definition: widgets/Tooltip.h:80
CEGUI::Tooltip::EventDisplayTimeChanged
static const String EventDisplayTimeChanged
Definition: widgets/Tooltip.h:98
CEGUI::Tooltip::resetTimer
void resetTimer(void)
Resets the timer on the tooltip when in the Active / Inactive states. This is used internally to cont...
CEGUI::Tooltip::onTooltipActive
virtual void onTooltipActive(WindowEventArgs &e)
Event trigger method called just before the tooltip becomes active.
CEGUI::Tooltip::EventTooltipInactive
static const String EventTooltipInactive
Definition: widgets/Tooltip.h:115
CEGUI::Tooltip::getTextSize
Sizef getTextSize() const
Return the size of the area that will be occupied by the tooltip text, given any current formatting o...
CEGUI::Tooltip::onHoverTimeChanged
virtual void onHoverTimeChanged(WindowEventArgs &e)
Event trigger method called when the hover timeout gets changed.
CEGUI
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1
CEGUI::Tooltip::onTooltipTransition
virtual void onTooltipTransition(WindowEventArgs &e)
Event trigger method called just after the tooltip changed target window but remained active.
CEGUI::MouseEventArgs
EventArgs based class that is used for objects passed to input event handlers concerning mouse input.
Definition: InputEvent.h:281
CEGUI::WindowEventArgs
EventArgs based class that is used for objects passed to handlers triggered for events concerning som...
Definition: InputEvent.h:252
CEGUI::Tooltip::~Tooltip
~Tooltip(void)
Destructor for the Tooltip base class.
CEGUI::Tooltip::onDisplayTimeChanged
virtual void onDisplayTimeChanged(WindowEventArgs &e)
Event trigger method called when the display timeout gets changed.
CEGUI::Tooltip::sizeSelf
void sizeSelf(void)
Causes the tooltip to resize itself appropriately.
CEGUI::Tooltip::d_active
bool d_active
true if the tooltip is active
Definition: widgets/Tooltip.h:331
CEGUI::TooltipWindowRenderer::getTextSize
virtual Sizef getTextSize() const =0
Return the size of the area that will be occupied by the tooltip text, given any current formatting o...
CEGUI::Tooltip::getHoverTime
float getHoverTime(void) const
Return the number of seconds the mouse should hover stationary over the target window before the tool...
CEGUI::Tooltip::d_hoverTime
float d_hoverTime
tool-tip hover time (seconds mouse must stay stationary before tip shows).
Definition: widgets/Tooltip.h:334
CEGUI::Tooltip::positionSelf
void positionSelf(void)
Causes the tooltip to position itself appropriately.
CEGUI::Tooltip::setHoverTime
void setHoverTime(float seconds)
Set the number of seconds the mouse should hover stationary over the target window before the tooltip...
CEGUI::Tooltip::getTextSize_impl
virtual Sizef getTextSize_impl() const
Return the size of the area that will be occupied by the tooltip text, given any current formatting o...
CEGUI::Tooltip::setDisplayTime
void setDisplayTime(float seconds)
Set the number of seconds the tooltip should be displayed for before it automatically de-activates it...
CEGUI::Tooltip::d_displayTime
float d_displayTime
tool-tip display time (seconds that tip is showsn for).
Definition: widgets/Tooltip.h:335
CEGUI::Tooltip::d_elapsed
float d_elapsed
Used to track state change timings.
Definition: widgets/Tooltip.h:332
CEGUI::Tooltip::getDisplayTime
float getDisplayTime(void) const
Return the number of seconds the tooltip should be displayed for before it automatically de-activates...
CEGUI::Tooltip::onTooltipInactive
virtual void onTooltipInactive(WindowEventArgs &e)
Event trigger method called just after the tooltip is deactivated.
CEGUI::Tooltip::onHidden
void onHidden(WindowEventArgs &e)
Handler called when the window is hidden.
CEGUI::Tooltip::EventHoverTimeChanged
static const String EventHoverTimeChanged
Definition: widgets/Tooltip.h:92
CEGUI::Tooltip::onMouseEnters
void onMouseEnters(MouseEventArgs &e)
Handler called when the mouse cursor has entered this window's area and is actually over some part of...
CEGUI::Tooltip::setTargetWindow
void setTargetWindow(Window *wnd)
Sets the target window for the tooltip. This used internally to manage tooltips, you should not have ...
CEGUI::Tooltip::EventTooltipActive
static const String EventTooltipActive
Definition: widgets/Tooltip.h:110
CEGUI::Window
An abstract base class providing common functionality and specifying the required interface for deriv...
Definition: Window.h:151
CEGUI::Tooltip::Tooltip
Tooltip(const String &type, const String &name)
Constructor for the Tooltip base class constructor.
CEGUI::Tooltip::validateWindowRenderer
virtual bool validateWindowRenderer(const WindowRenderer *renderer) const
Function used in checking if a WindowRenderer is valid for this window.
CEGUI::WindowRenderer
Base-class for the assignable WindowRenderer object.
Definition: WindowRenderer.h:52
CEGUI::Tooltip::EventFadeTimeChanged
static const String EventFadeTimeChanged
Definition: widgets/Tooltip.h:104
CEGUI::Tooltip::onTextChanged
void onTextChanged(WindowEventArgs &e)
Handler called when the window's text is changed.
CEGUI::Tooltip::WidgetTypeName
static const String WidgetTypeName
Window factory name.
Definition: widgets/Tooltip.h:85
CEGUI::Tooltip::d_fadeTime
float d_fadeTime
Definition: widgets/Tooltip.h:336
CEGUI::Tooltip::EventTooltipTransition
static const String EventTooltipTransition
Definition: widgets/Tooltip.h:120
CEGUI::Size< float >
CEGUI::String
String class used within the GUI system.
Definition: String.h:64
CEGUI::TooltipWindowRenderer::TooltipWindowRenderer
TooltipWindowRenderer(const String &name)
Constructor.
CEGUI::Tooltip::getTargetWindow
const Window * getTargetWindow()
return the current target window for this Tooltip.
CEGUI::Tooltip::EventNamespace
static const String EventNamespace
Namespace for global events.
Definition: widgets/Tooltip.h:86
CEGUI::TooltipWindowRenderer
Base class for Tooltip window renderer objects.
Definition: widgets/Tooltip.h:45
CEGUI::Tooltip::d_target
const Window * d_target
Current target Window for this Tooltip.
Definition: widgets/Tooltip.h:333