Crazy Eddie's GUI System  0.8.6
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:
51  TooltipWindowRenderer(const String& name);
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  ************************************************************************/
151  void setTargetWindow(Window* wnd);
152 
160  const Window* getTargetWindow();
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 
244  Sizef getTextSize() const;
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  *************************************************************************/
281  virtual void onHoverTimeChanged(WindowEventArgs& e);
282 
290  virtual void onDisplayTimeChanged(WindowEventArgs& e);
291 
299  virtual void onTooltipActive(WindowEventArgs& e);
300 
308  virtual void onTooltipInactive(WindowEventArgs& e);
309 
317  virtual void onTooltipTransition(WindowEventArgs& e);
318 
319 
320  /************************************************************************
321  Overridden from Window.
322  ************************************************************************/
323  void updateSelf(float elapsed);
324  void onHidden(WindowEventArgs& e);
325  void onMouseEnters(MouseEventArgs& e);
326  void onTextChanged(WindowEventArgs& e);
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_
bool d_active
true if the tooltip is active
Definition: widgets/Tooltip.h:331
float d_displayTime
tool-tip display time (seconds that tip is showsn for).
Definition: widgets/Tooltip.h:335
static const String EventTooltipTransition
Definition: widgets/Tooltip.h:120
static const String EventTooltipActive
Definition: widgets/Tooltip.h:110
float d_hoverTime
tool-tip hover time (seconds mouse must stay stationary before tip shows).
Definition: widgets/Tooltip.h:334
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1
static const String EventHoverTimeChanged
Definition: widgets/Tooltip.h:92
float d_fadeTime
Definition: widgets/Tooltip.h:336
Base class for Tooltip widgets.
Definition: widgets/Tooltip.h:79
static const String EventFadeTimeChanged
Definition: widgets/Tooltip.h:104
static const String WidgetTypeName
Window factory name.
Definition: widgets/Tooltip.h:85
Base-class for the assignable WindowRenderer object.
Definition: WindowRenderer.h:50
static const String EventNamespace
Namespace for global events.
Definition: widgets/Tooltip.h:86
Base class for Tooltip window renderer objects.
Definition: widgets/Tooltip.h:44
const Window * d_target
Current target Window for this Tooltip.
Definition: widgets/Tooltip.h:333
An abstract base class providing common functionality and specifying the required interface for deriv...
Definition: Window.h:149
static const String EventDisplayTimeChanged
Definition: widgets/Tooltip.h:98
EventArgs based class that is used for objects passed to handlers triggered for events concerning som...
Definition: InputEvent.h:251
static const String EventTooltipInactive
Definition: widgets/Tooltip.h:115
EventArgs based class that is used for objects passed to input event handlers concerning mouse input...
Definition: InputEvent.h:280
String class used within the GUI system.
Definition: String.h:62
float d_elapsed
Used to track state change timings.
Definition: widgets/Tooltip.h:332