From a74bcb89a187da9b6518b53d52a98d11a5e9ee4d Mon Sep 17 00:00:00 2001 From: Jorge Arellano Cid Date: Sun, 22 May 2011 19:51:32 -0400 Subject: 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 --- dw/fltkviewport.cc | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'dw/fltkviewport.cc') 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(); -- cgit v1.2.3