diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 1998-10-06 18:21:25 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 1998-10-06 18:21:25 +0000 |
| commit | f9039b2ae21988783feae9b362818e7923e82d14 (patch) | |
| tree | 6d6fe3679d73448758f9794e7d4d4f6b22a4adad /src/Fl_Value_Slider.cxx | |
| parent | 67e89232f9ba067825a158734a09e0fa21aacbe3 (diff) | |
Initial revision
git-svn-id: file:///fltk/svn/fltk/trunk@2 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Value_Slider.cxx')
| -rw-r--r-- | src/Fl_Value_Slider.cxx | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/Fl_Value_Slider.cxx b/src/Fl_Value_Slider.cxx new file mode 100644 index 000000000..ade51106d --- /dev/null +++ b/src/Fl_Value_Slider.cxx @@ -0,0 +1,45 @@ +/* Fl_Value_Slider.C */ + +#include <FL/Fl.H> +#include <FL/Fl_Value_Slider.H> +#include <FL/fl_draw.H> +#include <math.h> +#include <FL/Fl_Input_.H> // for default_font + +Fl_Value_Slider::Fl_Value_Slider(int x,int y,int w,int h, const char*l) +: Fl_Slider(x,y,w,h,l) { + step(1,100); + textfont_ = FL_HELVETICA; + textsize_ = 10; + textcolor_ = FL_BLACK; +} + +void Fl_Value_Slider::draw() { + int sxx = x(), syy = y(), sww = w(), shh = h(); + int bxx = x(), byy = y(), bww = w(), bhh = h(); + if (horizontal()) { + bww = 35; sxx += 35; sww -= 35; + } else { + syy += 25; bhh = 25; shh -= 25; + } + Fl_Slider::draw(sxx,syy,sww,shh); + draw_box(box(),bxx,byy,bww,bhh,color()); + char buf[128]; + format(buf); + fl_font(textfont(), textsize(), + Fl_Input_::default_font(), Fl_Input_::default_size()); + fl_color(active_r() ? textcolor() : inactive(textcolor())); + fl_draw(buf, bxx, byy, bww, bhh, FL_ALIGN_CLIP); +} + +int Fl_Value_Slider::handle(int event) { + int sxx = x(), syy = y(), sww = w(), shh = h(); + if (horizontal()) { + sxx += 35; sww -= 35; + } else { + syy += 25; shh -= 25; + } + return Fl_Slider::handle(event,sxx,syy,sww,shh); +} + +// End of Fl_Value_Slider.C |
