git-svn-id: https://scorched3d.svn.sourceforge.net/svnroot/scorched3d/trunk/scorched...
[scorched3d/parasti.git] / src / client / GLW / GLWTracker.h
blob202d4b0b0e89cd687df69e363aa3a9107d9fbff0
1 ////////////////////////////////////////////////////////////////////////////////
2 // Scorched3D (c) 2000-2009
3 //
4 // This file is part of Scorched3D.
5 //
6 // Scorched3D is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
11 // Scorched3D is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with Scorched3D; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 ////////////////////////////////////////////////////////////////////////////////
21 #ifndef _GLWTRACKER_H_
22 #define _GLWTRACKER_H_
24 #include <GLW/GLWidget.h>
26 class GLWTrackerI
28 public:
29 virtual void currentChanged(unsigned int id, float valueX, float valueY) = 0;
32 class GLWTracker : public GLWidget
34 public:
35 GLWTracker(float x = 0.0f, float y = 0.0f,
36 float w = 0.0f, float range = 0.0f);
37 virtual ~GLWTracker();
39 void setHandler(GLWTrackerI *handler) { handler_ = handler; }
41 float getCurrentX() { return currentX_; }
42 float getCurrentY() { return currentY_; }
43 void setCurrentX(float currentx) { currentX_ = currentx; }
44 void setCurrentY(float currenty) { currentY_ = currenty; }
46 virtual void mouseDown(int button, float x, float y, bool &skipRest);
47 virtual void mouseUp(int button, float x, float y, bool &skipRest);
48 virtual void mouseDrag(int button, float mx, float my, float x, float y, bool &skipRest);
50 REGISTER_CLASS_HEADER(GLWTracker);
52 protected:
53 GLWTrackerI *handler_;
54 bool dragging_;
55 float currentX_, currentY_;
56 float range_;
60 class GLWTankTracker : public GLWTracker,
61 public GLWTrackerI
63 public:
64 GLWTankTracker();
65 virtual ~GLWTankTracker();
67 virtual void draw();
68 virtual void currentChanged(unsigned int id, float valueX, float valueY);
70 REGISTER_CLASS_HEADER(GLWTankTracker);
74 #endif /* _GLWTRACKER_H_ */