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

CEGUITooltip.h

Go to the documentation of this file.
00001 /************************************************************************
00002     filename:   CEGUITooltip.h
00003     created:    21/2/2005
00004     author:     Paul D Turner
00005 *************************************************************************/
00006 /*************************************************************************
00007     Crazy Eddie's GUI System (http://www.cegui.org.uk)
00008     Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
00009  
00010     This library is free software; you can redistribute it and/or
00011     modify it under the terms of the GNU Lesser General Public
00012     License as published by the Free Software Foundation; either
00013     version 2.1 of the License, or (at your option) any later version.
00014  
00015     This library is distributed in the hope that it will be useful,
00016     but WITHOUT ANY WARRANTY; without even the implied warranty of
00017     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018     Lesser General Public License for more details.
00019  
00020     You should have received a copy of the GNU Lesser General Public
00021     License along with this library; if not, write to the Free Software
00022     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023 *************************************************************************/
00024 #ifndef _CEGUITooltip_h_
00025 #define _CEGUITooltip_h_
00026 
00027 #include "CEGUIWindow.h"
00028 #include "elements/CEGUITooltipProperties.h"
00029 
00030 #if defined(_MSC_VER)
00031 #       pragma warning(push)
00032 #       pragma warning(disable : 4251)
00033 #endif
00034 
00035 // Start of CEGUI namespace section
00036 namespace CEGUI
00037 {
00038     class CEGUIEXPORT Tooltip : public Window
00039     {
00040     public:
00041         /*************************************************************************
00042             Constants
00043         *************************************************************************/
00044         static const String EventNamespace;                 
00045         static const String EventHoverTimeChanged;          
00046         static const String EventDisplayTimeChanged;        
00047         static const String EventFadeTimeChanged;           
00048         static const String EventTooltipActive;             
00049         static const String EventTooltipInactive;           
00050 
00051         /************************************************************************
00052             Object Construction and Destruction
00053         ************************************************************************/
00058         Tooltip(const String& type, const String& name);
00059 
00064         ~Tooltip(void);
00065 
00066         /************************************************************************
00067             Public interface
00068         ************************************************************************/
00080         void setTargetWindow(Window* wnd);
00081 
00089         const Window* getTargetWindow();
00090 
00099         void resetTimer(void);
00100 
00109         float getHoverTime(void) const;
00110 
00122         void setDisplayTime(float seconds);
00123 
00132         float getFadeTime(void) const;
00133 
00145         void setHoverTime(float seconds);
00146 
00155         float getDisplayTime(void) const;
00156 
00168         void setFadeTime(float seconds);
00169 
00170         // 
00178         void positionSelf(void);
00179 
00180     protected:
00181         /*************************************************************************
00182             Implementation Methods
00183         *************************************************************************/
00188         void addTooltipEvents(void);
00189 
00190         // methods to perform processing for each of the widget states
00191         void doActiveState(float elapsed);
00192         void doInactiveState(float elapsed);
00193         void doFadeInState(float elapsed);
00194         void doFadeOutState(float elapsed);
00195 
00196         // methods to switch widget states
00197         void switchToInactiveState(void);
00198         void switchToActiveState(void);
00199         void switchToFadeInState(void);
00200         void switchToFadeOutState(void);
00201 
00202 
00213                 virtual bool    testClassName_impl(const String& class_name) const
00214                 {
00215                         if (class_name==(const utf8*)"Tooltip") return true;
00216                         return Window::testClassName_impl(class_name);
00217                 }
00218 
00227         virtual Size getTextSize() const;
00228 
00229         /*************************************************************************
00230             Event triggers
00231         *************************************************************************/
00242         virtual void onHoverTimeChanged(WindowEventArgs& e);
00243 
00254         virtual void onDisplayTimeChanged(WindowEventArgs& e);
00255 
00266         virtual void onFadeTimeChanged(WindowEventArgs& e);
00267 
00278         virtual void onTooltipActive(WindowEventArgs& e);
00279 
00290         virtual void onTooltipInactive(WindowEventArgs& e);
00291 
00292 
00293         /************************************************************************
00294             Overridden from Window.
00295         ************************************************************************/
00296         void updateSelf(float elapsed);
00297         void onMouseEnters(MouseEventArgs& e);
00298         void onTextChanged(WindowEventArgs& e);
00299 
00300         /************************************************************************
00301             Enumerations
00302         ************************************************************************/
00307         enum TipState
00308         {
00309             Inactive,   
00310             Active,     
00311             FadeIn,     
00312             FadeOut     
00313         };
00314 
00315         /************************************************************************
00316             Data fields
00317         ************************************************************************/
00318         TipState    d_state;        
00319         float       d_elapsed;      
00320         const Window* d_target;     
00321         float       d_hoverTime;    
00322         float       d_displayTime;  
00323         float       d_fadeTime;     
00324 
00325     private:
00326         /*************************************************************************
00327             Static Properties for this class
00328         *************************************************************************/
00329         static TooltipProperties::HoverTime      d_hoverTimeProperty;
00330         static TooltipProperties::DisplayTime    d_displayTimeProperty;
00331         static TooltipProperties::FadeTime       d_fadeTimeProperty;
00332 
00333         /*************************************************************************
00334             Private methods
00335         *************************************************************************/
00336         void addTooltipProperties(void);
00337     };
00338 
00339 } // End of  CEGUI namespace section
00340 
00341 
00342 #if defined(_MSC_VER)
00343 #       pragma warning(pop)
00344 #endif
00345 
00346 #endif  // end of guard _CEGUITooltip_h_

Generated on Wed Sep 7 09:56:34 2005 for Crazy Eddies GUI System by  doxygen 1.4.3