CEGUIMouseCursor.h

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  *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
00010  *
00011  *   Permission is hereby granted, free of charge, to any person obtaining
00012  *   a copy of this software and associated documentation files (the
00013  *   "Software"), to deal in the Software without restriction, including
00014  *   without limitation the rights to use, copy, modify, merge, publish,
00015  *   distribute, sublicense, and/or sell copies of the Software, and to
00016  *   permit persons to whom the Software is furnished to do so, subject to
00017  *   the following conditions:
00018  *
00019  *   The above copyright notice and this permission notice shall be
00020  *   included in all copies or substantial portions of the Software.
00021  *
00022  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00023  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00024  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00025  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
00026  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00027  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00028  *   OTHER DEALINGS IN THE SOFTWARE.
00029  ***************************************************************************/
00030 #ifndef _CEGUIMouseCursor_h_
00031 #define _CEGUIMouseCursor_h_
00032 
00033 #include "CEGUIBase.h"
00034 #include "CEGUIString.h"
00035 #include "CEGUISingleton.h"
00036 #include "CEGUIVector.h"
00037 #include "CEGUIRect.h"
00038 #include "CEGUIEventSet.h"
00039 #include "CEGUIInputEvent.h"
00040 #include "CEGUIUDim.h"
00041 
00042 
00043 #if defined(_MSC_VER)
00044 #       pragma warning(push)
00045 #       pragma warning(disable : 4275)
00046 #       pragma warning(disable : 4251)
00047 #endif
00048 
00049 
00050 // Start of CEGUI namespace section
00051 namespace CEGUI
00052 {
00053 
00058 enum MouseCursorImage
00059 {               
00060         BlankMouseCursor        = 0,            
00061         DefaultMouseCursor      = -1            
00062 };
00063 
00064 
00071 class CEGUIEXPORT MouseCursor : public EventSet, public Singleton<MouseCursor>
00072 {
00073 public:
00074         static const String EventNamespace;                             
00075 
00076         /*************************************************************************
00077                 Event name constants
00078         *************************************************************************/
00079         // generated internally by MouseCursor
00080         static const String EventImageChanged;                  
00081 
00082 
00087         MouseCursor(void);
00088 
00089 
00094         ~MouseCursor(void);
00095 
00096 
00104         static  MouseCursor&    getSingleton(void);
00105 
00106 
00114         static  MouseCursor*    getSingletonPtr(void);
00115 
00116 
00132         void    setImage(const String& imageset, const String& image_name);
00133 
00134 
00139         void    setImage(const Image* image);
00140 
00141 
00148         const Image*    getImage(void) const    {return d_cursorImage;}
00149 
00150 
00158         void    draw(void) const;
00159 
00160 
00168         void    setPosition(const Point& position);
00169 
00170 
00181         void    offsetPosition(const Point& offset);
00182 
00183 
00196         void    setConstraintArea(const Rect* area);
00197 
00198 
00211         void    setUnifiedConstraintArea(const URect* area);
00212 
00213 
00221         void    hide(void)              {d_visible = false;}
00222 
00223 
00231         void    show(void)              {d_visible = true;}
00232 
00233 
00244     void    setVisible(bool visible)    {d_visible = visible;}
00245 
00246 
00254         bool    isVisible(void) const   {return d_visible;}
00255 
00256 
00264         Point   getPosition(void) const         {return Point(d_position.d_x, d_position.d_y);}
00265 
00266 
00274         Rect    getConstraintArea(void) const;
00275 
00276 
00284         const URect& getUnifiedConstraintArea(void) const;
00285 
00286 
00296         Point   getDisplayIndependantPosition(void) const;
00297 
00298 
00299 protected:
00300         /*************************************************************************
00301                 New event handlers
00302         *************************************************************************/
00307         virtual void    onImageChanged(MouseCursorEventArgs& e);
00308 
00309 
00310 private:
00311         /*************************************************************************
00312                 Implementation Methods
00313         *************************************************************************/
00318         void    constrainPosition(void);
00319 
00320 
00321         /*************************************************************************
00322                 Implementation Data
00323         *************************************************************************/
00324         const Image*    d_cursorImage;          
00325         Vector3 d_position;                                     
00326         bool    d_visible;                                      
00327         URect   d_constraints;                          
00328 };
00329 
00330 } // End of  CEGUI namespace section
00331 
00332 #if defined(_MSC_VER)
00333 #       pragma warning(pop)
00334 #endif
00335 
00336 #endif  // end of guard _CEGUIMouseCursor_h_

Generated on Sat Jun 28 14:35:44 2008 for Crazy Eddies GUI System by  doxygen 1.5.4