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.

98 lines
2.9KB

  1. //
  2. // "$Id: Fl_Dial.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
  3. //
  4. // Dial header file for the Fast Light Tool Kit (FLTK).
  5. //
  6. // Copyright 1998-2010 by Bill Spitzak and others.
  7. //
  8. // This library is free software; you can redistribute it and/or
  9. // modify it under the terms of the GNU Library General Public
  10. // License as published by the Free Software Foundation; either
  11. // version 2 of the License, or (at your option) any later version.
  12. //
  13. // This library is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. // Library General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU Library General Public
  19. // License along with this library; if not, write to the Free Software
  20. // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  21. // USA.
  22. //
  23. // Please report all bugs and problems on the following page:
  24. //
  25. // http://www.fltk.org/str.php
  26. //
  27. /* \file
  28. Fl_Dial widget . */
  29. #ifndef Fl_Dial_H
  30. #define Fl_Dial_H
  31. #ifndef Fl_Valuator_H
  32. #include "Fl_Valuator.H"
  33. #endif
  34. // values for type():
  35. #define FL_NORMAL_DIAL 0 /**< type() for dial variant with dot */
  36. #define FL_LINE_DIAL 1 /**< type() for dial variant with line */
  37. #define FL_FILL_DIAL 2 /**< type() for dial variant with filled arc */
  38. /**
  39. The Fl_Dial widget provides a circular dial to control a
  40. single floating point value.
  41. <P ALIGN=CENTER>\image html dial.png
  42. \image latex dial.png "Fl_Dial" width=4cm
  43. Use type() to set the type of the dial to:
  44. <UL>
  45. <LI>FL_NORMAL_DIAL - Draws a normal dial with a knob. </LI>
  46. <LI>FL_LINE_DIAL - Draws a dial with a line. </LI>
  47. <LI>FL_FILL_DIAL - Draws a dial with a filled arc. </LI>
  48. </UL>
  49. */
  50. class FL_EXPORT Fl_Dial : public Fl_Valuator {
  51. short a1,a2;
  52. protected:
  53. // these allow subclasses to put the dial in a smaller area:
  54. void draw(int X, int Y, int W, int H);
  55. int handle(int event, int X, int Y, int W, int H);
  56. void draw();
  57. public:
  58. int handle(int);
  59. /**
  60. Creates a new Fl_Dial widget using the given position, size,
  61. and label string. The default type is FL_NORMAL_DIAL.
  62. */
  63. Fl_Dial(int x,int y,int w,int h, const char *l = 0);
  64. /**
  65. Sets Or gets the angles used for the minimum and maximum values. The default
  66. values are 45 and 315 (0 degrees is straight down and the angles
  67. progress clockwise). Normally angle1 is less than angle2, but if you
  68. reverse them the dial moves counter-clockwise.
  69. */
  70. short angle1() const {return a1;}
  71. /** See short angle1() const */
  72. void angle1(short a) {a1 = a;}
  73. /** See short angle1() const */
  74. short angle2() const {return a2;}
  75. /** See short angle1() const */
  76. void angle2(short a) {a2 = a;}
  77. /** See short angle1() const */
  78. void angles(short a, short b) {a1 = a; a2 = b;}
  79. };
  80. #endif
  81. //
  82. // End of "$Id: Fl_Dial.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
  83. //