1 //////////////////////////////////////////////////////////////////////////////// 2 // Scorched3D (c) 2000-2011 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. 10 // 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. 15 // 16 // You should have received a copy of the GNU General Public License along 17 // with this program; if not, write to the Free Software Foundation, Inc., 18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 //////////////////////////////////////////////////////////////////////////////// 20 21 #ifndef _GLWTRACKER_H_ 22 #define _GLWTRACKER_H_ 23 24 #include <GLW/GLWidget.h> 25 26 class GLWTrackerI 27 { 28 public: 29 virtual void currentChanged(unsigned int id, float valueX, float valueY) = 0; 30 }; 31 32 class GLWTracker : public GLWidget 33 { 34 public: 35 GLWTracker(float x = 0.0f, float y = 0.0f, 36 float w = 0.0f, float range = 0.0f); 37 virtual ~GLWTracker(); 38 setHandler(GLWTrackerI * handler)39 void setHandler(GLWTrackerI *handler) { handler_ = handler; } 40 getCurrentX()41 float getCurrentX() { return currentX_; } getCurrentY()42 float getCurrentY() { return currentY_; } setCurrentX(float currentx)43 void setCurrentX(float currentx) { currentX_ = currentx; } setCurrentY(float currenty)44 void setCurrentY(float currenty) { currentY_ = currenty; } 45 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); 49 50 REGISTER_CLASS_HEADER(GLWTracker); 51 52 protected: 53 GLWTrackerI *handler_; 54 bool dragging_; 55 float currentX_, currentY_; 56 float range_; 57 58 }; 59 60 class GLWTankTracker : public GLWTracker, 61 public GLWTrackerI 62 { 63 public: 64 GLWTankTracker(); 65 virtual ~GLWTankTracker(); 66 67 virtual void draw(); 68 virtual void currentChanged(unsigned int id, float valueX, float valueY); 69 70 REGISTER_CLASS_HEADER(GLWTankTracker); 71 72 }; 73 74 #endif /* _GLWTRACKER_H_ */ 75