|
csmouse.h00001 /* 00002 Crystal Space Windowing System: mouse support 00003 Copyright (C) 1998,1999 by Andrew Zabolotny <bit@eltech.ru> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public 00016 License along with this library; if not, write to the Free 00017 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 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__ Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000 |