Fl_Value_Output.H 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. //
  2. // "$Id: Fl_Value_Output.H 8864 2011-07-19 04:49:30Z greg.ercolano $"
  3. //
  4. // Value output 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_Value_Output widget . */
  20. #ifndef Fl_Value_Output_H
  21. #define Fl_Value_Output_H
  22. #ifndef Fl_Valuator_H
  23. #include "Fl_Valuator.H"
  24. #endif
  25. /**
  26. The Fl_Value_Output widget displays a floating point value.
  27. If step() is not zero, the user can adjust the value by
  28. dragging the mouse left and right. The left button moves one step()
  29. per pixel, the middle by 10 * step(), and the right button by
  30. 100 * step().
  31. <P>This is much lighter-weight than
  32. Fl_Value_Input because it contains no text editing code or
  33. character buffer. </P>
  34. <P ALIGN=CENTER>\image html Fl_Value_Output.png
  35. \image latex Fl_Value_Output.png "Fl_Value_Output" width=4cm
  36. */
  37. class FL_EXPORT Fl_Value_Output : public Fl_Valuator {
  38. Fl_Font textfont_;
  39. Fl_Fontsize textsize_;
  40. uchar soft_;
  41. Fl_Color textcolor_;
  42. protected:
  43. void draw();
  44. public:
  45. int handle(int);
  46. Fl_Value_Output(int x,int y,int w,int h,const char *l=0);
  47. /**
  48. If "soft" is turned on, the user is allowed to drag the value outside
  49. the range. If they drag the value to one of the ends, let go, then
  50. grab again and continue to drag, they can get to any value. Default is
  51. one.
  52. */
  53. void soft(uchar s) {soft_ = s;}
  54. /**
  55. If "soft" is turned on, the user is allowed to drag the value outside
  56. the range. If they drag the value to one of the ends, let go, then
  57. grab again and continue to drag, they can get to any value. Default is
  58. one.
  59. */
  60. uchar soft() const {return soft_;}
  61. /** Gets the typeface of the text in the value box. */
  62. Fl_Font textfont() const {return textfont_;}
  63. /** Sets the typeface of the text in the value box. */
  64. void textfont(Fl_Font s) {textfont_ = s;}
  65. /** Gets the size of the text in the value box. */
  66. Fl_Fontsize textsize() const {return textsize_;}
  67. void textsize(Fl_Fontsize s) {textsize_ = s;}
  68. /** Sets the color of the text in the value box. */
  69. Fl_Color textcolor() const {return textcolor_;}
  70. /** Gets the color of the text in the value box. */
  71. void textcolor(Fl_Color s) {textcolor_ = s;}
  72. DECLARE_CLASS_CHEAP_RTTI_2(Fl_Value_Output, Fl_Valuator)
  73. };
  74. #endif
  75. //
  76. // End of "$Id: Fl_Value_Output.H 8864 2011-07-19 04:49:30Z greg.ercolano $".
  77. //