Planeshift
pawsmouse.h
Go to the documentation of this file.
1 /*
2  * pawsmouse.h - Author: Andrew Craig
3  *
4  * Copyright (C) 2001 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
5  *
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation (version 2 of the License)
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  *
18  */
19 // pawsmouse.h: interface for the pawsMouse class.
20 //
22 
23 #ifndef PAWS_MOUSE_HEADER
24 #define PAWS_MOUSE_HEADER
25 
26 #include <csgeom/vector2.h>
27 #include "pawstexturemanager.h"
28 #include <igraphic/imageio.h>
29 #include <util/psutil.h>
30 
31 class PawsManager;
32 
33 struct iGraphics3D;
34 
41 class pawsMouse
42 {
43 
44 public:
45  pawsMouse();
46  virtual ~pawsMouse();
47 
49  void SetPosition(int x, int y);
50 
52  void UpdateDragPosition();
53 
56  {
57  return currentPosition;
58  }
59 
62  {
63  return deltas;
64  }
65 
69  void ChangeImage(const char* imageName);
70  void ChangeImage(iPawsImage* drawable);
71 
72  void Draw();
73  void Hide(bool h = true);
74  void WantCrosshair(bool h = true)
75  {
76  crosshair = h;
77  }
78 
79  struct ImgSize
80  {
81  int width;
82  int height;
83  };
84 
86  {
87  ImgSize size;
88  size.width = 0;
89  size.height = 0;
90  if(cursorImage)
91  {
92  size.height = cursorImage->GetHeight();
93  size.width = cursorImage->GetWidth();
94  }
95  return size;
96  }
97 
98 protected:
99  csRef<iGraphics3D> graphics3D;
100  csRef<iVFS> vfs;
101  csRef<iImageIO> imageLoader;
102 
105 
106  csRef<iPawsImage> cursorImage;
107  csRef<iPawsImage> crosshairImage;
109 
110  bool useOS;
112 
116 
117  csRef<iImage> image;
118 
119  void SetOSMouse(iPawsImage* mouseImage);
120 };
121 
124 #endif
125 
ImgSize GetImageSize()
Definition: pawsmouse.h:85
void Hide(bool h=true)
virtual ~pawsMouse()
csRef< iVFS > vfs
Definition: pawsmouse.h:100
psPoint currentPosition
Definition: pawsmouse.h:103
int transparentG
Definition: pawsmouse.h:114
psPoint deltas
Definition: pawsmouse.h:104
Main PlaneShift Window manager.
Definition: pawsmanager.h:82
csRef< iGraphics3D > graphics3D
Definition: pawsmouse.h:99
void WantCrosshair(bool h=true)
Definition: pawsmouse.h:74
csRef< iImageIO > imageLoader
Definition: pawsmouse.h:101
The mouse pointer.
Definition: pawsmouse.h:41
psPoint GetDeltas()
Get the deltas from the last call to SetPosition.
Definition: pawsmouse.h:61
csRef< iPawsImage > crosshairImage
Definition: pawsmouse.h:107
bool crosshair
Definition: pawsmouse.h:108
void ChangeImage(const char *imageName)
Change mouse pointer to new image.
csRef< iPawsImage > cursorImage
Definition: pawsmouse.h:106
void UpdateDragPosition()
Updates the position of the dragged widget if any.
void SetOSMouse(iPawsImage *mouseImage)
bool useOS
Definition: pawsmouse.h:110
int transparentB
Definition: pawsmouse.h:115
csRef< iImage > image
Definition: pawsmouse.h:117
void SetPosition(int x, int y)
Set the absolute screen position for mouse.
int transparentR
Definition: pawsmouse.h:113
void Draw()
bool hidden
Definition: pawsmouse.h:108
psPoint GetPosition()
Get the absolute position.
Definition: pawsmouse.h:55
bool basicCursor
Definition: pawsmouse.h:111