csws/csmouse.h
Go to the documentation of this file.00001 /* 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 __CS_CSMOUSE_H__ 00021 #define __CS_CSMOUSE_H__ 00022 00031 #include "ivideo/texture.h" 00032 #include "iengine/texture.h" 00033 #include "csutil/parray.h" 00034 #include "csws/csgfxppl.h" 00035 00036 class csMouse; 00037 struct iEvent; 00038 00042 class csMousePointer 00043 { 00044 private: 00045 friend class csMouse; 00046 00048 int id; 00050 int tX, tY, tW, tH, hsX, hsY; 00052 csMouse *parent; 00053 00054 public: 00056 csMousePointer (csMouse *iParent, int ID, 00057 int x, int y, int w, int h, int hsx, int hsy); 00058 00060 void Draw (int x, int y, csImageArea *&Under); 00061 }; 00062 00067 class csMouse 00068 { 00069 private: 00070 friend class csMousePointer; 00071 00073 int MouseX, MouseY; 00075 int VirtualX, VirtualY; 00077 int Visible; 00079 bool invisible; 00081 bool AppFocused; 00083 bool LastVirtual; 00085 csImageArea *Under [MAX_SYNC_PAGES]; 00087 csApp *app; 00089 csPDelArray<csMousePointer> Pointers; 00091 csMousePointer *ActiveCursor; 00093 iTextureHandle *Texture; 00094 00095 public: 00097 csMouse (csApp *iApp); 00099 ~csMouse (); 00100 00102 bool HandleEvent (iEvent &Event); 00103 00105 void Move (int x, int y); 00106 00107 void GetPosition (int &x, int &y) 00108 { x = MouseX; y = MouseY; } 00109 00114 void Show () 00115 { Visible++; } 00116 00118 void Hide () 00119 { Visible--; } 00120 00122 bool SetCursor (csMouseCursorID ID); 00123 00125 void Setup (); 00126 00128 void SetVirtualPosition (int x, int y) 00129 { VirtualX = x; VirtualY = y; } 00130 00131 private: 00132 friend class csApp; 00133 friend class csGraphicsPipeline; 00134 00136 void Draw (int Page); 00138 void Undraw (int Page); 00139 00141 void NewPointer (const char *id, const char *posdef); 00142 00144 void ClearPointers (); 00145 }; 00146 00149 #endif // __CS_CSMOUSE_H__
Generated for Crystal Space by doxygen 1.2.18