summaryrefslogtreecommitdiff
path: root/src/Fl_Counter.cxx
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2001-08-05 14:00:15 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2001-08-05 14:00:15 +0000
commit51050b38d82ca53bb71c85d2031f9777e6dd373e (patch)
treee7e8958a5b433cd8b84e7e312d421ce8c6a84400 /src/Fl_Counter.cxx
parent03f49329ff670c072aaddabf8f1beaf4f69e5bd9 (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_Counter.cxx')
-rw-r--r--src/Fl_Counter.cxx22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/Fl_Counter.cxx b/src/Fl_Counter.cxx
index 06f26ff30..93f8c0e3f 100644
--- a/src/Fl_Counter.cxx
+++ b/src/Fl_Counter.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Counter.cxx,v 1.8.2.3 2001/01/22 15:13:39 easysw Exp $"
+// "$Id: Fl_Counter.cxx,v 1.8.2.3.2.1 2001/08/05 14:00:15 easysw Exp $"
//
// Counter widget for the Fast Light Tool Kit (FLTK).
//
@@ -59,6 +59,7 @@ void Fl_Counter::draw() {
fl_color(active_r() ? textcolor() : inactive(textcolor()));
char str[128]; format(str);
fl_draw(str, xx[0], y(), ww[0], h(), FL_ALIGN_CENTER);
+ if (Fl::focus() == this) draw_focus(boxtype[0], xx[0], y(), ww[0], h());
if (!(damage()&FL_DAMAGE_ALL)) return; // only need to redraw text
if (active_r())
@@ -130,6 +131,7 @@ int Fl_Counter::handle(int event) {
handle_release();
return 1;
case FL_PUSH:
+ take_focus();
handle_push();
case FL_DRAG:
i = calc_mouseobj();
@@ -141,6 +143,22 @@ int Fl_Counter::handle(int event) {
redraw();
}
return 1;
+ case FL_KEYBOARD :
+ switch (Fl::event_key()) {
+ case FL_Left:
+ handle_drag(clamp(increment(value(),-1)));
+ return 1;
+ case FL_Right:
+ 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;
}
@@ -165,5 +183,5 @@ Fl_Counter::Fl_Counter(int x, int y, int w, int h, const char* l)
}
//
-// End of "$Id: Fl_Counter.cxx,v 1.8.2.3 2001/01/22 15:13:39 easysw Exp $".
+// End of "$Id: Fl_Counter.cxx,v 1.8.2.3.2.1 2001/08/05 14:00:15 easysw Exp $".
//