Fl_Dial.H 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. //
  2. // "$Id: Fl_Dial.H 8864 2011-07-19 04:49:30Z 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. Distribution and use rights are outlined in
  9. // the file "COPYING" which should have been included with this file. If this
  10. // file is missing or damaged, see the license at:
  11. //
  12. // http://www.fltk.org/COPYING.php
  13. //
  14. // Please report all bugs and problems on the following page:
  15. //
  16. // http://www.fltk.org/str.php
  17. //
  18. /* \file
  19. Fl_Dial widget . */
  20. #ifndef Fl_Dial_H
  21. #define Fl_Dial_H
  22. #ifndef Fl_Valuator_H
  23. #include "Fl_Valuator.H"
  24. #endif
  25. // values for type():
  26. #define FL_NORMAL_DIAL 0 /**< type() for dial variant with dot */
  27. #define FL_LINE_DIAL 1 /**< type() for dial variant with line */
  28. #define FL_FILL_DIAL 2 /**< type() for dial variant with filled arc */
  29. /**
  30. The Fl_Dial widget provides a circular dial to control a
  31. single floating point value.
  32. <P ALIGN=CENTER>\image html dial.png
  33. \image latex dial.png "Fl_Dial" width=4cm
  34. Use type() to set the type of the dial to:
  35. <UL>
  36. <LI>FL_NORMAL_DIAL - Draws a normal dial with a knob. </LI>
  37. <LI>FL_LINE_DIAL - Draws a dial with a line. </LI>
  38. <LI>FL_FILL_DIAL - Draws a dial with a filled arc. </LI>
  39. </UL>
  40. */
  41. class FL_EXPORT Fl_Dial : public Fl_Valuator {
  42. short a1,a2;
  43. protected:
  44. // these allow subclasses to put the dial in a smaller area:
  45. void draw(int X, int Y, int W, int H);
  46. int handle(int event, int X, int Y, int W, int H);
  47. void draw();
  48. public:
  49. int handle(int);
  50. /**
  51. Creates a new Fl_Dial widget using the given position, size,
  52. and label string. The default type is FL_NORMAL_DIAL.
  53. */
  54. Fl_Dial(int x,int y,int w,int h, const char *l = 0);
  55. /**
  56. Sets Or gets the angles used for the minimum and maximum values. The default
  57. values are 45 and 315 (0 degrees is straight down and the angles
  58. progress clockwise). Normally angle1 is less than angle2, but if you
  59. reverse them the dial moves counter-clockwise.
  60. */
  61. short angle1() const {return a1;}
  62. /** See short angle1() const */
  63. void angle1(short a) {a1 = a;}
  64. /** See short angle1() const */
  65. short angle2() const {return a2;}
  66. /** See short angle1() const */
  67. void angle2(short a) {a2 = a;}
  68. /** See short angle1() const */
  69. void angles(short a, short b) {a1 = a; a2 = b;}
  70. DECLARE_CLASS_CHEAP_RTTI_2(Fl_Dial, Fl_Valuator)
  71. };
  72. #endif
  73. //
  74. // End of "$Id: Fl_Dial.H 8864 2011-07-19 04:49:30Z greg.ercolano $".
  75. //