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.

85 lines
2.1KB

  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 SetChannel(int s) {m_Channel=s;}
  33. int GetChannel() { return m_Channel;}
  34. void SetCentreX(int s) {m_CentreX=s;}
  35. void SetCentreY(int s) {m_CentreY=s;}
  36. void SetCentreRadius(int s) {m_CentreRadius=s;}
  37. void IncCount()
  38. {
  39. m_Count++; if (m_Count>m_Passes) m_Count=0;
  40. }
  41. bool Completed() {return (m_Count==m_Passes); }
  42. float GetAngle() {return m_Angle;}
  43. int GetLoop() {return m_Loop;}
  44. int GetPass() {return m_Passes;}
  45. void SetSnap(bool s) {m_Snap=s;}
  46. void SetSnapAngle(int s) {m_SnapDegrees=s;}
  47. private:
  48. int m_ID;
  49. int m_Channel;
  50. int m_CentreX;
  51. int m_CentreY;
  52. int m_CentreRadius;
  53. bool m_Dragging;
  54. int m_Loop;
  55. int m_Passes;
  56. int m_Count;
  57. float m_Angle;
  58. int m_MaxLoops;
  59. int m_MaxPasses;
  60. bool m_Snap;
  61. int m_SnapDegrees;
  62. friend istream &operator>>(istream &s, Fl_Trigger &o);
  63. friend ostream &operator<<(ostream &s, Fl_Trigger &o);
  64. };
  65. istream &operator>>(istream &s, Fl_Trigger &o);
  66. ostream &operator<<(ostream &s, Fl_Trigger &o);
  67. #endif