You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
2.0KB

  1. /* TriggerWidget
  2. * Copyleft (C) 2000 David Griffiths <dave@pawfal.org>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  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. #include <FL/Fl.H>
  19. #include <FL/Fl_Widget.H>
  20. #include <iostream>
  21. #ifndef TRIGGERWIDGET
  22. #define TRIGGERWIDGET
  23. using namespace std;
  24. class Fl_Trigger : public Fl_Widget
  25. {
  26. public:
  27. Fl_Trigger(int x, int y, int w, int h, const char* label=0);
  28. virtual void draw();
  29. virtual int handle(int event);
  30. void SetID(int s) {m_ID=s;}
  31. int GetID() { return m_ID;}
  32. void SetCentreX(int s) {m_CentreX=s;}
  33. void SetCentreY(int s) {m_CentreY=s;}
  34. void SetCentreRadius(int s) {m_CentreRadius=s;}
  35. void IncCount()
  36. {
  37. m_Count++; if (m_Count>m_Passes) m_Count=0;
  38. }
  39. bool Completed() {return (m_Count==m_Passes); }
  40. float GetAngle() {return m_Angle;}
  41. int GetLoop() {return m_Loop;}
  42. int GetPass() {return m_Passes;}
  43. void SetSnap(bool s) {m_Snap=s;}
  44. void SetSnapAngle(int s) {m_SnapDegrees=s;}
  45. private:
  46. int m_ID;
  47. int m_CentreX;
  48. int m_CentreY;
  49. int m_CentreRadius;
  50. bool m_Dragging;
  51. int m_Loop;
  52. int m_Passes;
  53. int m_Count;
  54. float m_Angle;
  55. int m_MaxLoops;
  56. int m_MaxPasses;
  57. bool m_Snap;
  58. int m_SnapDegrees;
  59. friend istream &operator>>(istream &s, Fl_Trigger &o);
  60. friend ostream &operator<<(ostream &s, Fl_Trigger &o);
  61. };
  62. istream &operator>>(istream &s, Fl_Trigger &o);
  63. ostream &operator<<(ostream &s, Fl_Trigger &o);
  64. #endif