FLTK 1.3.9
Loading...
Searching...
No Matches
Fl_Scroll.H
1//
2// Scroll header file for the Fast Light Tool Kit (FLTK).
3//
4// Copyright 1998-2021 by Bill Spitzak and others.
5//
6// This library is free software. Distribution and use rights are outlined in
7// the file "COPYING" which should have been included with this file. If this
8// file is missing or damaged, see the license at:
9//
10// https://www.fltk.org/COPYING.php
11//
12// Please see the following page on how to report bugs and issues:
13//
14// https://www.fltk.org/bugs.php
15//
16
17/* \file
18 Fl_Scroll widget . */
19
20#ifndef Fl_Scroll_H
21#define Fl_Scroll_H
22
23#include "Fl_Group.H"
24#include "Fl_Scrollbar.H"
25
85class FL_EXPORT Fl_Scroll : public Fl_Group {
86
87 int xposition_, yposition_;
88 int oldx, oldy;
89 int scrollbar_size_;
90 static void hscrollbar_cb(Fl_Widget*, void*);
91 static void scrollbar_cb(Fl_Widget*, void*);
92 void fix_scrollbar_order();
93 static void draw_clip(void*,int,int,int,int);
94
95#if FLTK_ABI_VERSION >= 10303
96protected: // NEW (STR#1895)
97#else
98private: // OLD
99#endif
100
102 typedef struct { int x,y,w,h; } Fl_Region_XYWH;
103
105 typedef struct {
106 int l;
107 int r;
108 int t;
109 int b;
111
113 typedef struct {
114 int x,y,w,h;
115 int pos;
116 int size;
117 int first;
118 int total;
120
137
138 void recalc_scrollbars(ScrollInfo &si);
139
140protected:
141
142 void bbox(int&,int&,int&,int&);
143 void draw();
144
145public:
146
147 Fl_Scrollbar scrollbar;
148 Fl_Scrollbar hscrollbar;
149
150 void resize(int X, int Y, int W, int H);
151 int handle(int);
152
153 Fl_Scroll(int X,int Y,int W,int H,const char*l=0);
154
155 enum { // values for type()
156 HORIZONTAL = 1,
157 VERTICAL = 2,
158 BOTH = 3,
159 ALWAYS_ON = 4,
160 HORIZONTAL_ALWAYS = 5,
161 VERTICAL_ALWAYS = 6,
162 BOTH_ALWAYS = 7
163 };
164
166 int xposition() const {return xposition_;}
168 int yposition() const {return yposition_;}
169 void scroll_to(int, int);
170 void clear();
180 int scrollbar_size() const {
181 return(scrollbar_size_);
182 }
202 void scrollbar_size(int newSize) {
203 if ( newSize != scrollbar_size_ ) redraw();
204 scrollbar_size_ = newSize;
205 }
206};
207
208#endif
The Fl_Group class is the FLTK container widget.
Definition Fl_Group.H:41
int handle(int)
Handles the specified event.
Definition Fl_Group.cxx:147
void draw()
Draws the widget.
Definition Fl_Group.cxx:738
void resize(int, int, int, int)
Resizes the Fl_Group widget and all of its children.
Definition Fl_Group.cxx:634
void clear()
Deletes all child widgets from memory recursively.
Definition Fl_Group.cxx:383
This container widget lets you maneuver around a set of widgets much larger than your window.
Definition Fl_Scroll.H:85
int yposition() const
Gets the current vertical scrolling position.
Definition Fl_Scroll.H:168
void scrollbar_size(int newSize)
Sets the pixel size of the scrollbars' troughs to newSize, in pixels.
Definition Fl_Scroll.H:202
int xposition() const
Gets the current horizontal scrolling position.
Definition Fl_Scroll.H:166
int scrollbar_size() const
Gets the current size of the scrollbars' troughs, in pixels.
Definition Fl_Scroll.H:180
The Fl_Scrollbar widget displays a slider with arrow buttons at the ends of the scrollbar.
Definition Fl_Scrollbar.H:43
Fl_Widget is the base class for all widgets in FLTK.
Definition Fl_Widget.H:101
int y() const
Gets the widget position in its window.
Definition Fl_Widget.H:289
int h() const
Gets the widget height.
Definition Fl_Widget.H:299
int w() const
Gets the widget width.
Definition Fl_Widget.H:294
void redraw()
Schedules the drawing of the widget.
Definition Fl.cxx:1786
int x() const
Gets the widget position in its window.
Definition Fl_Widget.H:284
A local struct to manage a region defined by left/right/top/bottom.
Definition Fl_Scroll.H:105
int r
(r)ight "x" position, aka x2
Definition Fl_Scroll.H:107
int b
(b)ottom "y" position, aka y2
Definition Fl_Scroll.H:109
int l
(l)eft "x" position, aka x1
Definition Fl_Scroll.H:106
int t
(t)op "y" position, aka y1
Definition Fl_Scroll.H:108
A local struct to manage a region defined by xywh.
Definition Fl_Scroll.H:102
A local struct to manage a scrollbar's xywh region and tab values.
Definition Fl_Scroll.H:113
int pos
scrollbar tab's "position of first line displayed"
Definition Fl_Scroll.H:115
int total
scrollbar tab's "total number of lines"
Definition Fl_Scroll.H:118
int size
scrollbar tab's "size of window in lines"
Definition Fl_Scroll.H:116
int first
scrollbar tab's "number of first line"
Definition Fl_Scroll.H:117
Structure to manage scrollbar and widget interior sizes.
Definition Fl_Scroll.H:127
Fl_Region_LRTB child
child bounding box: left/right/top/bottom
Definition Fl_Scroll.H:131
int scrollsize
the effective scrollbar thickness (local or global)
Definition Fl_Scroll.H:128
int hneeded
horizontal scrollbar visibility
Definition Fl_Scroll.H:132
int vneeded
vertical scrollbar visibility
Definition Fl_Scroll.H:133
Fl_Region_XYWH innerbox
widget's inner box, excluding scrollbars
Definition Fl_Scroll.H:129
Fl_Scrollbar_Data hscroll
horizontal scrollbar region + values
Definition Fl_Scroll.H:134
Fl_Region_XYWH innerchild
widget's inner box, including scrollbars
Definition Fl_Scroll.H:130
Fl_Scrollbar_Data vscroll
vertical scrollbar region + values
Definition Fl_Scroll.H:135