changeset 2044:8f7dfd5247f2

Added a CustScrollbar class to allow SHIFT+{Left,Right} go to the parent * Allows using these keys for next/prev tab when hscrollbar is visible
author Jorge Arellano Cid <jcid@dillo.org>
date Sun, 22 May 2011 19:51:32 -0400
parents 47c0550792b2
children 63de60cad8bd
files dw/fltkviewport.cc
diffstat 1 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/dw/fltkviewport.cc	Sun May 22 10:16:01 2011 -0400
+++ b/dw/fltkviewport.cc	Sun May 22 19:51:32 2011 -0400
@@ -34,10 +34,25 @@
 namespace dw {
 namespace fltk {
 
+/*
+ * Lets SHIFT+{Left,Right} go to the parent
+ */
+class CustScrollbar : public Fl_Scrollbar
+{
+public:
+   CustScrollbar(int x, int y, int w, int h) : Fl_Scrollbar(x,y,w,h) {};
+   int handle(int e) {
+      if (e == FL_SHORTCUT && Fl::event_state() == FL_SHIFT &&
+          (Fl::event_key() == FL_Left || Fl::event_key() == FL_Right))
+         return 0;
+      return Fl_Scrollbar::handle(e);
+   }
+};
+
 FltkViewport::FltkViewport (int X, int Y, int W, int H, const char *label):
    FltkWidgetView (X, Y, W, H, label)
 {
-   hscrollbar = new Fl_Scrollbar (x (), y (), 1, 1);
+   hscrollbar = new CustScrollbar (x (), y (), 1, 1);
    hscrollbar->type(FL_HORIZONTAL);
    hscrollbar->callback (hscrollbarCallback, this);
    hscrollbar->hide();