Dillo v3.1.1-119-g140d9ebd
Loading...
Searching...
No Matches
fltkviewport.hh
Go to the documentation of this file.
1/*
2 * Dillo Widget
3 *
4 * Copyright 2005-2007 Sebastian Geerken <sgeerken@dillo.org>
5 * Copyright 2024 Rodrigo Arias Mallo <rodarima@gmail.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef __DW_FLTKVIEWPORT_HH__
22#define __DW_FLTKVIEWPORT_HH__
23
24#include <FL/Fl_Group.H>
25#include <FL/Fl_Scrollbar.H>
26
27#include "core.hh"
28#include "fltkcore.hh"
29#include "fltkviewbase.hh"
30
31namespace dw {
32namespace fltk {
33
35{
36public:
38
39private:
40 enum { SCROLLBAR_THICKNESS = 15 };
41
52
53 Fl_Scrollbar *vscrollbar, *hscrollbar;
54
56 lout::container::typed::List <lout::object::TypedPointer < Fl_Widget> >
58
61 void hscrollbarChanged ();
62 void vscrollbarChanged ();
63 void positionChanged ();
64
65 static void hscrollbarCallback (Fl_Widget *hscrollbar, void *viewportPtr);
66 static void vscrollbarCallback (Fl_Widget *vscrollbar, void *viewportPtr);
67
68 void selectionScroll();
69 static void selectionScroll(void *vport);
70
71 void repeatPageScroll ();
72 static void repeatPageScroll (void *data);
73
74 void updateCanvasWidgets (int oldScrollX, int oldScrollY);
75 static void draw_area (void *data, int x, int y, int w, int h);
76
77protected:
78 int translateViewXToCanvasX (int x);
79 int translateViewYToCanvasY (int y);
80 int translateCanvasXToViewX (int x);
81 int translateCanvasYToViewY (int y);
82
83public:
84 FltkViewport (int x, int y, int w, int h, const char *label = 0);
86
87 void resize(int x, int y, int w, int h);
88 void draw ();
89 int handle (int event);
90
91 void setCanvasSize (int width, int ascent, int descent);
92
93 bool usesViewport ();
97 void scroll(int dx, int dy);
99 void scrollTo (int x, int y);
100 void setViewportSize (int width, int height,
101 int hScrollbarThickness, int vScrollbarThickness);
102 void setScrollStep(int step);
103
104 void setGadgetOrientation (bool hscrollbarVisible, bool vscrollbarVisible,
106 void setDragScroll (bool enable) { hasDragScroll = enable ? 1 : 0; }
107 void addGadget (Fl_Widget *gadget);
108 void setScrollbarOnLeft (bool enable);
109 void setScrollbarPageMode(bool enable);
110 void setPageOverlap(int overlap);
111};
112
113} // namespace fltk
114} // namespace dw
115
116#endif // __DW_FLTKVIEWPORT_HH__
117
void scrollTo(int x, int y)
Scroll the vieport to the given position.
static void vscrollbarCallback(Fl_Widget *vscrollbar, void *viewportPtr)
static void draw_area(void *data, int x, int y, int w, int h)
int translateCanvasXToViewX(int x)
void setPageOverlap(int overlap)
void addGadget(Fl_Widget *gadget)
int translateViewXToCanvasX(int x)
int translateViewYToCanvasY(int y)
Fl_Scrollbar * hscrollbar
Fl_Scrollbar * vscrollbar
void scroll(int dx, int dy)
int getVScrollbarThickness()
Get the thickness of the vertical scrollbar, when it is visible.
void setCanvasSize(int width, int ascent, int descent)
Set the canvas size.
void setScrollbarPageMode(bool enable)
void updateCanvasWidgets(int oldScrollX, int oldScrollY)
void setDragScroll(bool enable)
static void hscrollbarCallback(Fl_Widget *hscrollbar, void *viewportPtr)
void adjustScrollbarsAndGadgetsAllocation()
enum dw::core::ScrollCommand pageScrolling
bool usesViewport()
Return, whether this view uses a viewport.
int translateCanvasYToViewY(int y)
GadgetOrientation gadgetOrientation[4]
void setScrollStep(int step)
void setViewportSize(int width, int height, int hScrollbarThickness, int vScrollbarThickness)
Set the viewport size.
void setScrollbarOnLeft(bool enable)
void setGadgetOrientation(bool hscrollbarVisible, bool vscrollbarVisible, GadgetOrientation gadgetOrientation)
void resize(int x, int y, int w, int h)
lout::container::typed::List< lout::object::TypedPointer< Fl_Widget > > * gadgets
int getHScrollbarThickness()
Get the thickness of the horizontal scrollbar, when it is visible.
ScrollCommand
Definition types.hh:35
Dw is in this namespace, or sub namespaces of this one.