00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
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
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
00073
00074
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
00250
00255 virtual void onImageChanged(MouseCursorEventArgs& e);
00256
00257
00258
00259
00260
00265 void addMouseCursorEvents(void);
00266
00267
00268 private:
00269
00270
00271
00276 void constrainPosition(void);
00277
00278
00279
00280
00281
00282 const Image* d_cursorImage;
00283 Vector3 d_position;
00284 bool d_visible;
00285 Rect d_constraints;
00286 };
00287
00288 }
00289
00290 #if defined(_MSC_VER)
00291 # pragma warning(pop)
00292 #endif
00293
00294 #endif // end of guard _CEGUIMouseCursor_h_