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
00027
00028
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
00051 namespace CEGUI
00052 {
00057 enum MouseCursorImage
00058 {
00059 BlankMouseCursor = 0,
00060 DefaultMouseCursor = -1
00061 };
00062
00063
00070 class CEGUIEXPORT MouseCursor : public EventSet, public Singleton<MouseCursor>
00071 {
00072 public:
00073 static const String EventNamespace;
00074
00075
00076
00077
00078
00085 static const String EventImageChanged;
00086
00087
00092 MouseCursor(void);
00093
00094
00099 ~MouseCursor(void);
00100
00101
00109 static MouseCursor& getSingleton(void);
00110
00111
00119 static MouseCursor* getSingletonPtr(void);
00120
00121
00137 void setImage(const String& imageset, const String& image_name);
00138
00139
00144 void setImage(const Image* image);
00145
00146
00153 const Image* getImage(void) const {return d_cursorImage;}
00154
00155
00163 void draw(void) const;
00164
00165
00173 void setPosition(const Point& position);
00174
00175
00186 void offsetPosition(const Point& offset);
00187
00188
00201 void setConstraintArea(const Rect* area);
00202
00203
00216 void setUnifiedConstraintArea(const URect* area);
00217
00218
00226 void hide(void) {d_visible = false;}
00227
00228
00236 void show(void) {d_visible = true;}
00237
00238
00249 void setVisible(bool visible) {d_visible = visible;}
00250
00251
00259 bool isVisible(void) const {return d_visible;}
00260
00261
00269 Point getPosition(void) const
00270 { return d_position; }
00271
00272
00280 Rect getConstraintArea(void) const;
00281
00282
00290 const URect& getUnifiedConstraintArea(void) const;
00291
00292
00302 Point getDisplayIndependantPosition(void) const;
00303
00315 void notifyDisplaySizeChanged(const Size& new_size);
00316
00332 void setExplicitRenderSize(const Size& size);
00333
00339 const Size& getExplicitRenderSize() const;
00340
00355 static void setInitialMousePosition(const Point& position);
00356
00362 void invalidate();
00363
00364 protected:
00365
00366
00367
00372 virtual void onImageChanged(MouseCursorEventArgs& e);
00373
00374
00375 private:
00376
00377
00378
00383 void constrainPosition(void);
00384
00386 void cacheGeometry() const;
00387
00389 void calculateCustomOffset() const;
00390
00391
00392
00393
00394 const Image* d_cursorImage;
00395 Vector2 d_position;
00396 bool d_visible;
00397 URect d_constraints;
00398
00399 GeometryBuffer* d_geometry;
00401 Size d_customSize;
00403 mutable Point d_customOffset;
00405 static bool s_initialPositionSet;
00407 static Point s_initialPosition;
00409 mutable bool d_cachedGeometryValid;
00410 };
00411
00412 }
00413
00414 #if defined(_MSC_VER)
00415 # pragma warning(pop)
00416 #endif
00417
00418 #endif // end of guard _CEGUIMouseCursor_h_