summaryrefslogtreecommitdiff
path: root/src/Fl_Roller.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_Roller.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_Roller.cxx')
-rw-r--r--src/Fl_Roller.cxx35
1 files changed, 32 insertions, 3 deletions
diff --git a/src/Fl_Roller.cxx b/src/Fl_Roller.cxx
index 4f598eb58..2ec920337 100644
--- a/src/Fl_Roller.cxx
+++ b/src/Fl_Roller.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Roller.cxx,v 1.6.2.4 2001/01/22 15:13:40 easysw Exp $"
+// "$Id: Fl_Roller.cxx,v 1.6.2.4.2.1 2001/08/05 14:00:15 easysw Exp $"
//
// Roller widget for the Fast Light Tool Kit (FLTK).
//
@@ -35,6 +35,7 @@ int Fl_Roller::handle(int event) {
int newpos = horizontal() ? Fl::event_x() : Fl::event_y();
switch (event) {
case FL_PUSH:
+ take_focus();
handle_push();
ipos = newpos;
return 1;
@@ -44,6 +45,32 @@ int Fl_Roller::handle(int event) {
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;
}
@@ -128,14 +155,16 @@ void Fl_Roller::draw() {
fl_yxline(X+W,Y+h1,Y);
}
}
+
+ if (Fl::focus() == this) draw_focus(FL_THIN_UP_FRAME, x(), y(), w(), h());
}
Fl_Roller::Fl_Roller(int X,int Y,int W,int H,const char* L)
: Fl_Valuator(X,Y,W,H,L) {
- box(FL_UP_FRAME);
+ box(FL_UP_BOX);
step(1,1000);
}
//
-// End of "$Id: Fl_Roller.cxx,v 1.6.2.4 2001/01/22 15:13:40 easysw Exp $".
+// End of "$Id: Fl_Roller.cxx,v 1.6.2.4.2.1 2001/08/05 14:00:15 easysw Exp $".
//