CEGUITooltip.h

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 {
00053     class CEGUIEXPORT Tooltip : public Window
00054     {
00055     public:
00056         /*************************************************************************
00057             Constants
00058         *************************************************************************/
00059         static const String EventNamespace;                 
00060         static const String EventHoverTimeChanged;          
00061         static const String EventDisplayTimeChanged;        
00062         static const String EventFadeTimeChanged;           
00063         static const String EventTooltipActive;             
00064         static const String EventTooltipInactive;           
00065 
00066         /************************************************************************
00067             Object Construction and Destruction
00068         ************************************************************************/
00073         Tooltip(const String& type, const String& name);
00074 
00079         ~Tooltip(void);
00080 
00081         /************************************************************************
00082             Public interface
00083         ************************************************************************/
00095         void setTargetWindow(Window* wnd);
00096 
00104         const Window* getTargetWindow();
00105 
00114         void resetTimer(void);
00115 
00124         float getHoverTime(void) const;
00125 
00137         void setDisplayTime(float seconds);
00138 
00147         float getFadeTime(void) const;
00148 
00160         void setHoverTime(float seconds);
00161 
00170         float getDisplayTime(void) const;
00171 
00183         void setFadeTime(float seconds);
00184 
00185         // 
00193         void positionSelf(void);
00194 
00195     protected:
00196         /*************************************************************************
00197             Implementation Methods
00198         *************************************************************************/
00203         void addTooltipEvents(void);
00204 
00205         // methods to perform processing for each of the widget states
00206         void doActiveState(float elapsed);
00207         void doInactiveState(float elapsed);
00208         void doFadeInState(float elapsed);
00209         void doFadeOutState(float elapsed);
00210 
00211         // methods to switch widget states
00212         void switchToInactiveState(void);
00213         void switchToActiveState(void);
00214         void switchToFadeInState(void);
00215         void switchToFadeOutState(void);
00216 
00217 
00228                 virtual bool    testClassName_impl(const String& class_name) const
00229                 {
00230                         if (class_name==(const utf8*)"Tooltip") return true;
00231                         return Window::testClassName_impl(class_name);
00232                 }
00233 
00242         virtual Size getTextSize() const;
00243 
00244         /*************************************************************************
00245             Event triggers
00246         *************************************************************************/
00257         virtual void onHoverTimeChanged(WindowEventArgs& e);
00258 
00269         virtual void onDisplayTimeChanged(WindowEventArgs& e);
00270 
00281         virtual void onFadeTimeChanged(WindowEventArgs& e);
00282 
00293         virtual void onTooltipActive(WindowEventArgs& e);
00294 
00305         virtual void onTooltipInactive(WindowEventArgs& e);
00306 
00307 
00308         /************************************************************************
00309             Overridden from Window.
00310         ************************************************************************/
00311         void updateSelf(float elapsed);
00312         void onMouseEnters(MouseEventArgs& e);
00313         void onTextChanged(WindowEventArgs& e);
00314 
00315         /************************************************************************
00316             Enumerations
00317         ************************************************************************/
00322         enum TipState
00323         {
00324             Inactive,   
00325             Active,     
00326             FadeIn,     
00327             FadeOut     
00328         };
00329 
00330         /************************************************************************
00331             Data fields
00332         ************************************************************************/
00333         TipState    d_state;        
00334         float       d_elapsed;      
00335         const Window* d_target;     
00336         float       d_hoverTime;    
00337         float       d_displayTime;  
00338         float       d_fadeTime;     
00339 
00340     private:
00341         /*************************************************************************
00342             Static Properties for this class
00343         *************************************************************************/
00344         static TooltipProperties::HoverTime      d_hoverTimeProperty;
00345         static TooltipProperties::DisplayTime    d_displayTimeProperty;
00346         static TooltipProperties::FadeTime       d_fadeTimeProperty;
00347 
00348         /*************************************************************************
00349             Private methods
00350         *************************************************************************/
00351         void addTooltipProperties(void);
00352     };
00353 
00354 } // End of  CEGUI namespace section
00355 
00356 
00357 #if defined(_MSC_VER)
00358 #       pragma warning(pop)
00359 #endif
00360 
00361 #endif  // end of guard _CEGUITooltip_h_

Generated on Sat Nov 26 09:34:49 2005 for Crazy Eddies GUI System by  doxygen 1.4.5