CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

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 "csextern.h"
00032  
00033 #include "ivideo/texture.h"
00034 #include "iengine/texture.h"
00035 #include "csutil/parray.h"
00036 #include "csws/csgfxppl.h"
00037 
00038 class csMouse;
00039 struct iEvent;
00040 
00044 class CS_CSWS_EXPORT csMousePointer
00045 {
00046 private:
00047   friend class csMouse;
00048 
00050   int id;
00052   int tX, tY, tW, tH, hsX, hsY;
00054   csMouse *parent;
00055 
00056 public:
00058   csMousePointer (csMouse *iParent, int ID,
00059     int x, int y, int w, int h, int hsx, int hsy);
00060 
00062   void Draw (int x, int y, csImageArea *&Under);
00063 };
00064 
00069 class CS_CSWS_EXPORT csMouse
00070 {
00071 private:
00072   friend class csMousePointer;
00073 
00075   int MouseX, MouseY;
00077   int VirtualX, VirtualY;
00079   int Visible;
00081   bool invisible;
00083   bool AppFocused;
00085   bool LastVirtual;
00087   csImageArea *Under [MAX_SYNC_PAGES];
00089   csApp *app;
00091   csPDelArray<csMousePointer> Pointers;
00093   csMousePointer *ActiveCursor;
00095   iTextureHandle *Texture;
00096 
00097 public:
00099   csMouse (csApp *iApp);
00101   ~csMouse ();
00102 
00104   bool HandleEvent (iEvent &Event);
00105 
00107   void Move (int x, int y);
00108 
00109   void GetPosition (int &x, int &y)
00110   { x = MouseX; y = MouseY; }
00111 
00116   void Show ()
00117   { Visible++; }
00118 
00120   void Hide ()
00121   { Visible--; }
00122 
00124   bool SetCursor (csMouseCursorID ID);
00125 
00127   void Setup ();
00128 
00130   void SetVirtualPosition (int x, int y)
00131   { VirtualX = x; VirtualY = y; }
00132 
00133 private:
00134   friend class csApp;
00135   friend class csGraphicsPipeline;
00136 
00138   void Draw (int Page);
00140   void Undraw (int Page);
00141 
00143   void NewPointer (const char *id, const char *posdef);
00144 
00146   void ClearPointers ();
00147 };
00148 
00151 #endif // __CS_CSMOUSE_H__

Generated for Crystal Space by doxygen 1.2.18