diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2001-08-05 14:00:15 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2001-08-05 14:00:15 +0000 |
| commit | 51050b38d82ca53bb71c85d2031f9777e6dd373e (patch) | |
| tree | e7e8958a5b433cd8b84e7e312d421ce8c6a84400 /src/Fl_Slider.cxx | |
| parent | 03f49329ff670c072aaddabf8f1beaf4f69e5bd9 (diff) | |
Keyboard nav for valuators.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1555 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Slider.cxx')
| -rw-r--r-- | src/Fl_Slider.cxx | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/src/Fl_Slider.cxx b/src/Fl_Slider.cxx index 9bae98a65..9a2c44952 100644 --- a/src/Fl_Slider.cxx +++ b/src/Fl_Slider.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Slider.cxx,v 1.8.2.10 2001/01/22 15:13:40 easysw Exp $" +// "$Id: Fl_Slider.cxx,v 1.8.2.10.2.1 2001/08/05 14:00:15 easysw Exp $" // // Slider widget for the Fast Light Tool Kit (FLTK). // @@ -163,6 +163,10 @@ void Fl_Slider::draw(int x, int y, int w, int h) { } draw_label(xsl, ysl, wsl, hsl); + if (Fl::focus() == this) { + if (type() == FL_HOR_FILL_SLIDER || type() == FL_VERT_FILL_SLIDER) draw_focus(); + else draw_focus(box1, xsl, ysl, wsl, hsl); + } } void Fl_Slider::draw() { @@ -177,6 +181,7 @@ int Fl_Slider::handle(int event, int x, int y, int w, int h) { switch (event) { case FL_PUSH: if (!Fl::event_inside(x, y, w, h)) return 0; + take_focus(); handle_push(); case FL_DRAG: { @@ -241,6 +246,32 @@ int Fl_Slider::handle(int event, int x, int y, int w, int h) { case FL_RELEASE: handle_release(); return 1; + case FL_KEYBOARD : + switch (Fl::event_key()) { + case FL_Up: + if (horizontal()) return 0; + handle_drag(clamp(increment(value(),-1))); + return 1; + case FL_Down: + if (horizontal()) return 0; + handle_drag(clamp(increment(value(),1))); + return 1; + case FL_Left: + if (!horizontal()) return 0; + handle_drag(clamp(increment(value(),-1))); + return 1; + case FL_Right: + if (!horizontal()) return 0; + handle_drag(clamp(increment(value(),1))); + return 1; + default: + return 0; + } + break; + case FL_FOCUS : + case FL_UNFOCUS : + damage(FL_DAMAGE_ALL); + return 1; default: return 0; } @@ -255,5 +286,5 @@ int Fl_Slider::handle(int event) { } // -// End of "$Id: Fl_Slider.cxx,v 1.8.2.10 2001/01/22 15:13:40 easysw Exp $". +// End of "$Id: Fl_Slider.cxx,v 1.8.2.10.2.1 2001/08/05 14:00:15 easysw Exp $". // |
