diff options
author | Jorge Arellano Cid <jcid@dillo.org> | 2011-05-22 19:51:32 -0400 |
---|---|---|
committer | Jorge Arellano Cid <jcid@dillo.org> | 2011-05-22 19:51:32 -0400 |
commit | a74bcb89a187da9b6518b53d52a98d11a5e9ee4d (patch) | |
tree | a47759ed5e96486bbb9025e7985edd384d911df3 | |
parent | 00df6fa92c4ca418822f13ceca30fdd2574b3ffb (diff) |
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
-rw-r--r-- | dw/fltkviewport.cc | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/dw/fltkviewport.cc b/dw/fltkviewport.cc index 9e75932f..64e2cb1a 100644 --- a/dw/fltkviewport.cc +++ b/dw/fltkviewport.cc @@ -34,10 +34,25 @@ using namespace lout::container::typed; 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(); |