00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __CSMOUSE_H__
00021 #define __CSMOUSE_H__
00022
00023 #include "ivideo/texture.h"
00024 #include "iengine/texture.h"
00025 #include "csutil/typedvec.h"
00026 #include "csws/csgfxppl.h"
00027
00028 class csMouse;
00029 struct iEvent;
00030
00034 class csMousePointer
00035 {
00036 private:
00037 friend class csMouse;
00038
00040 int id;
00042 int tX, tY, tW, tH, hsX, hsY;
00044 csMouse *parent;
00045
00046 public:
00048 csMousePointer (csMouse *iParent, int ID,
00049 int x, int y, int w, int h, int hsx, int hsy);
00050
00052 void Draw (int x, int y, csImageArea *&Under);
00053 };
00054
00059 class csMouse
00060 {
00061 private:
00062 friend class csMousePointer;
00063
00065 int MouseX, MouseY;
00067 int VirtualX, VirtualY;
00069 int Visible;
00071 bool invisible;
00073 bool AppFocused;
00075 bool LastVirtual;
00077 csImageArea *Under [MAX_SYNC_PAGES];
00079 csApp *app;
00081 CS_DECLARE_TYPED_VECTOR (csPointerArray, csMousePointer) Pointers;
00083 csMousePointer *ActiveCursor;
00085 iTextureHandle *Texture;
00086
00087 public:
00089 csMouse (csApp *iApp);
00091 ~csMouse ();
00092
00094 bool HandleEvent (iEvent &Event);
00095
00097 void Move (int x, int y);
00098
00099 void GetPosition (int &x, int &y)
00100 { x = MouseX; y = MouseY; }
00101
00106 void Show ()
00107 { Visible++; }
00108
00110 void Hide ()
00111 { Visible--; }
00112
00114 bool SetCursor (csMouseCursorID ID);
00115
00117 void Setup ();
00118
00120 void SetVirtualPosition (int x, int y)
00121 { VirtualX = x; VirtualY = y; }
00122
00123 private:
00124 friend class csApp;
00125 friend class csGraphicsPipeline;
00126
00128 void Draw (int Page);
00130 void Undraw (int Page);
00131
00133 void NewPointer (const char *id, const char *posdef);
00134
00136 void ClearPointers ();
00137 };
00138
00139 #endif // __CSMOUSE_H__