summaryrefslogtreecommitdiff
path: root/dw
diff options
context:
space:
mode:
Diffstat (limited to 'dw')
-rw-r--r--dw/fltkviewport.cc19
-rw-r--r--dw/fltkviewport.hh22
2 files changed, 40 insertions, 1 deletions
diff --git a/dw/fltkviewport.cc b/dw/fltkviewport.cc
index 28c4101c..f0b69cb8 100644
--- a/dw/fltkviewport.cc
+++ b/dw/fltkviewport.cc
@@ -2,6 +2,7 @@
* Dillo Widget
*
* Copyright 2005-2007 Sebastian Geerken <sgeerken@dillo.org>
+ * Copyright 2024 Rodrigo Arias Mallo <rodarima@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -71,6 +72,7 @@ FltkViewport::FltkViewport (int X, int Y, int W, int H, const char *label):
hasDragScroll = 1;
scrollX = scrollY = scrollDX = scrollDY = 0;
horScrolling = verScrolling = dragScrolling = 0;
+ scrollbarPageMode = false;
gadgetOrientation[0] = GADGET_HORIZONTAL;
gadgetOrientation[1] = GADGET_HORIZONTAL;
@@ -292,8 +294,18 @@ int FltkViewport::handle (int event)
case FL_PUSH:
if (vscrollbar->visible() && Fl::event_inside(vscrollbar)) {
- if (vscrollbar->handle(event))
+ if (scrollbarPageMode ^ (bool) Fl::event_shift()) {
+ if (Fl::event_button() == FL_LEFT_MOUSE) {
+ scroll(core::SCREEN_DOWN_CMD);
+ return 1;
+ } else if (Fl::event_button() == FL_RIGHT_MOUSE) {
+ scroll(core::SCREEN_UP_CMD);
+ return 1;
+ }
+ }
+ if (vscrollbar->handle(event)) {
verScrolling = 1;
+ }
} else if (hscrollbar->visible() && Fl::event_inside(hscrollbar)) {
if (hscrollbar->handle(event))
horScrolling = 1;
@@ -412,6 +424,11 @@ void FltkViewport::setScrollStep(int step)
hscrollbar->linesize(step);
}
+void FltkViewport::setScrollbarPageMode(bool enable)
+{
+ scrollbarPageMode = enable;
+}
+
bool FltkViewport::usesViewport ()
{
return true;
diff --git a/dw/fltkviewport.hh b/dw/fltkviewport.hh
index fdcbb3be..62d4fa21 100644
--- a/dw/fltkviewport.hh
+++ b/dw/fltkviewport.hh
@@ -1,3 +1,23 @@
+/*
+ * Dillo Widget
+ *
+ * Copyright 2005-2007 Sebastian Geerken <sgeerken@dillo.org>
+ * Copyright 2024 Rodrigo Arias Mallo <rodarima@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
#ifndef __DW_FLTKVIEWPORT_HH__
#define __DW_FLTKVIEWPORT_HH__
@@ -24,6 +44,7 @@ private:
int scrollbarOnLeft;
int hasDragScroll, dragScrolling, dragX, dragY;
int horScrolling, verScrolling;
+ bool scrollbarPageMode;
Fl_Scrollbar *vscrollbar, *hscrollbar;
@@ -78,6 +99,7 @@ public:
void setDragScroll (bool enable) { hasDragScroll = enable ? 1 : 0; }
void addGadget (Fl_Widget *gadget);
void setScrollbarOnLeft (bool enable);
+ void setScrollbarPageMode(bool enable);
};
} // namespace fltk