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

CEGUIMouseCursor.h

Go to the documentation of this file.
00001 /************************************************************************
00002         filename:       CEGUIMouseCursor.h
00003         created:        21/2/2004
00004         author:         Paul D Turner
00005         
00006         purpose:        Defines interface for the MouseCursor class
00007 *************************************************************************/
00008 /*************************************************************************
00009     Crazy Eddie's GUI System (http://www.cegui.org.uk)
00010     Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
00011 
00012     This library is free software; you can redistribute it and/or
00013     modify it under the terms of the GNU Lesser General Public
00014     License as published by the Free Software Foundation; either
00015     version 2.1 of the License, or (at your option) any later version.
00016 
00017     This library is distributed in the hope that it will be useful,
00018     but WITHOUT ANY WARRANTY; without even the implied warranty of
00019     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020     Lesser General Public License for more details.
00021 
00022     You should have received a copy of the GNU Lesser General Public
00023     License along with this library; if not, write to the Free Software
00024     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025 *************************************************************************/
00026 #ifndef _CEGUIMouseCursor_h_
00027 #define _CEGUIMouseCursor_h_
00028 
00029 #include "CEGUIBase.h"
00030 #include "CEGUIString.h"
00031 #include "CEGUISingleton.h"
00032 #include "CEGUIVector.h"
00033 #include "CEGUIRect.h"
00034 #include "CEGUIEventSet.h"
00035 #include "CEGUIInputEvent.h"
00036 
00037 
00038 #if defined(_MSC_VER)
00039 #       pragma warning(push)
00040 #       pragma warning(disable : 4275)
00041 #       pragma warning(disable : 4251)
00042 #endif
00043 
00044 
00045 // Start of CEGUI namespace section
00046 namespace CEGUI
00047 {
00048 
00053 enum MouseCursorImage
00054 {               
00055         BlankMouseCursor        = 0,            
00056         DefaultMouseCursor      = -1,           
00057 };
00058 
00059 
00066 class CEGUIBASE_API MouseCursor : public EventSet, public Singleton<MouseCursor>
00067 {
00068 public:
00069         static const String EventNamespace;                             
00070 
00071         /*************************************************************************
00072                 Event name constants
00073         *************************************************************************/
00074         // generated internally by MouseCursor
00075         static const String EventImageChanged;                  
00076 
00077 
00082         MouseCursor(void);
00083 
00084 
00089         ~MouseCursor(void);
00090 
00091 
00099         static  MouseCursor&    getSingleton(void);
00100 
00101 
00109         static  MouseCursor*    getSingletonPtr(void);
00110 
00111 
00127         void    setImage(const String& imageset, const String& image_name);
00128 
00129 
00134         void    setImage(const Image* image);
00135 
00136 
00144         void    draw(void) const;
00145 
00146 
00154         void    setPosition(const Point& position);
00155 
00156 
00167         void    offsetPosition(const Point& offset);
00168 
00169 
00182         void    setConstraintArea(const Rect* area);
00183 
00184 
00192         void    hide(void)              {d_visible = false;}
00193 
00194 
00202         void    show(void)              {d_visible = true;}
00203 
00204 
00212         bool    isVisible(void) const   {return d_visible;}
00213 
00214 
00222         Point   getPosition(void) const         {return Point(d_position.d_x, d_position.d_y);}
00223 
00224 
00232         Rect    getConstraintArea(void) const           {return d_constraints;}
00233 
00234 
00244         Point   getDisplayIndependantPosition(void) const;
00245 
00246 
00247 protected:
00248         /*************************************************************************
00249                 New event handlers
00250         *************************************************************************/
00255         virtual void    onImageChanged(MouseCursorEventArgs& e);
00256 
00257 
00258         /*************************************************************************
00259                 Implementation Functions
00260         *************************************************************************/
00265         void    addMouseCursorEvents(void);
00266 
00267 
00268 private:
00269         /*************************************************************************
00270                 Implementation Methods
00271         *************************************************************************/
00276         void    constrainPosition(void);
00277 
00278 
00279         /*************************************************************************
00280                 Implementation Data
00281         *************************************************************************/
00282         const Image*    d_cursorImage;          
00283         Vector3 d_position;                                     
00284         bool    d_visible;                                      
00285         Rect    d_constraints;                          
00286 };
00287 
00288 } // End of  CEGUI namespace section
00289 
00290 #if defined(_MSC_VER)
00291 #       pragma warning(pop)
00292 #endif
00293 
00294 #endif  // end of guard _CEGUIMouseCursor_h_

Generated on Wed Feb 16 12:41:06 2005 for Crazy Eddies GUI System by  doxygen 1.3.9.1