Non reinvents the DAW. Powerful enough to form a complete studio, fast and light enough to run on low-end hardware like the eeePC or Raspberry Pi, and so reliable that it can be used live https://non.tuxfamily.org/
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.

Fl_Value_SliderX.H 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*******************************************************************************/
  2. /* Copyright (C) 2009 Jonathan Moore Liles */
  3. /* */
  4. /* This program is free software; you can redistribute it and/or modify it */
  5. /* under the terms of the GNU General Public License as published by the */
  6. /* Free Software Foundation; either version 2 of the License, or (at your */
  7. /* option) any later version. */
  8. /* */
  9. /* This program is distributed in the hope that it will be useful, but WITHOUT */
  10. /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
  11. /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */
  12. /* more details. */
  13. /* */
  14. /* You should have received a copy of the GNU General Public License along */
  15. /* with This program; see the file COPYING. If not,write to the Free Software */
  16. /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  17. /*******************************************************************************/
  18. #ifndef Fl_Value_SliderX_H
  19. #define Fl_Value_SliderX_H
  20. #include "Fl_SliderX.H"
  21. #include <FL/Fl_Input.H>
  22. /**
  23. The Fl_Value_SliderX widget is a Fl_SliderX widget
  24. with a box displaying the current value.
  25. <P ALIGN=CENTER>\image html value_slider.png
  26. \image latex value_slider.png "Fl_Value_SliderX" width=4cm
  27. */
  28. class FL_EXPORT Fl_Value_SliderX : public Fl_SliderX {
  29. /* This is the encapsulated Fl_input attribute to which
  30. this class delegates the value font, color and shortcut */
  31. Fl_Input input;
  32. private:
  33. char soft_;
  34. static void input_cb(Fl_Widget*,void*);
  35. virtual void value_damage(); // cause damage() due to value() changing
  36. protected:
  37. void draw();
  38. public:
  39. int handle(int);
  40. Fl_Value_SliderX(int x,int y,int w,int h, const char *l = 0);
  41. virtual ~Fl_Value_SliderX ( );
  42. /** See void Fl_Value_Input::soft(char s) */
  43. void soft(char s) {soft_ = s;}
  44. /**
  45. If "soft" is turned on, the user is allowed to drag
  46. the value outside the range. If they drag the value to one of
  47. the ends, let go, then grab again and continue to drag, they can
  48. get to any value. The default is true.
  49. */
  50. char soft() const {return soft_;}
  51. /**
  52. Returns the current shortcut key for the Input.
  53. \see Fl_Value_Input::shortcut(int)
  54. */
  55. int shortcut() const {return input.shortcut();}
  56. /**
  57. Sets the shortcut key to \p s. Setting this
  58. overrides the use of '&' in the label(). The value is a bitwise
  59. OR of a key and a set of shift flags, for example FL_ALT | 'a'
  60. , FL_ALT | (FL_F + 10), or just 'a'. A value
  61. of 0 disables the shortcut.
  62. The key can be any value returned by
  63. Fl::event_key(), but will usually be an ASCII letter. Use
  64. a lower-case letter unless you require the shift key to be held down.
  65. The shift flags can be any set of values accepted by
  66. Fl::event_state(). If the bit is on that shift key must
  67. be pushed. Meta, Alt, Ctrl, and Shift must be off if they are not in
  68. the shift flags (zero for the other bits indicates a "don't care"
  69. setting).
  70. */
  71. void shortcut(int s) {input.shortcut(s);}
  72. /** Gets the typeface of the text in the value box. */
  73. Fl_Font textfont() const {return input.textfont();}
  74. /** Sets the typeface of the text in the value box. */
  75. void textfont(Fl_Font s) {input.textfont(s);}
  76. /** Gets the size of the text in the value box. */
  77. Fl_Fontsize textsize() const {return input.textsize();}
  78. /** Sets the size of the text in the value box. */
  79. void textsize(Fl_Fontsize s) {input.textsize(s);}
  80. /** Gets the color of the text in the value box. */
  81. Fl_Color textcolor() const {return input.textcolor();}
  82. /** Sets the color of the text in the value box.*/
  83. void textcolor(Fl_Color n) {input.textcolor(n);}
  84. /** Gets the color of the text cursor. The text cursor is black by default. */
  85. Fl_Color cursor_color() const {return input.cursor_color();}
  86. /** Sets the color of the text cursor. The text cursor is black by default. */
  87. void cursor_color(Fl_Color n) {input.cursor_color(n);}
  88. };
  89. #endif