FLTK 1.3.8: Fl_Scroll.H Source File

FLTK 1.3.8

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
85 class 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;
110 } Fl_Region_LRTB;
111
113 typedef struct {
114 int x,y,w,h;
115 int pos;
116 int size;
117 int first;
118 int total;
119 } Fl_Scrollbar_Data;
120
127 typedef struct {
128 int scrollsize;
129 Fl_Region_XYWH innerbox;
130 Fl_Region_XYWH innerchild;
131 Fl_Region_LRTB child;
132 int hneeded;
133 int vneeded;
134 Fl_Scrollbar_Data hscroll;
135 Fl_Scrollbar_Data vscroll;
136 } ScrollInfo;
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
Fl_Group
The Fl_Group class is the FLTK container widget.
Definition: Fl_Group.H:41
Fl_Group::handle
int handle(int)
Handles the specified event.
Definition: Fl_Group.cxx:147
Fl_Group::draw
void draw()
Draws the widget.
Definition: Fl_Group.cxx:738
Fl_Group::resize
void resize(int, int, int, int)
Resizes the Fl_Group widget and all of its children.
Definition: Fl_Group.cxx:634
Fl_Group::clear
void clear()
Deletes all child widgets from memory recursively.
Definition: Fl_Group.cxx:383
Fl_Scroll
This container widget lets you maneuver around a set of widgets much larger than your window.
Definition: Fl_Scroll.H:85
Fl_Scroll::yposition
int yposition() const
Gets the current vertical scrolling position.
Definition: Fl_Scroll.H:168
Fl_Scroll::scrollbar_size
void scrollbar_size(int newSize)
Sets the pixel size of the scrollbars' troughs to newSize, in pixels.
Definition: Fl_Scroll.H:202
Fl_Scroll::xposition
int xposition() const
Gets the current horizontal scrolling position.
Definition: Fl_Scroll.H:166
Fl_Scroll::scrollbar_size
int scrollbar_size() const
Gets the current size of the scrollbars' troughs, in pixels.
Definition: Fl_Scroll.H:180
Fl_Scrollbar
The Fl_Scrollbar widget displays a slider with arrow buttons at the ends of the scrollbar.
Definition: Fl_Scrollbar.H:43
Fl_Widget
Fl_Widget is the base class for all widgets in FLTK.
Definition: Fl_Widget.H:101
Fl_Widget::y
int y() const
Gets the widget position in its window.
Definition: Fl_Widget.H:289
Fl_Widget::h
int h() const
Gets the widget height.
Definition: Fl_Widget.H:299
Fl_Widget::w
int w() const
Gets the widget width.
Definition: Fl_Widget.H:294
Fl_Widget::redraw
void redraw()
Schedules the drawing of the widget.
Definition: Fl.cxx:1786
Fl_Widget::x
int x() const
Gets the widget position in its window.
Definition: Fl_Widget.H:284
Fl_Scroll::Fl_Region_LRTB
A local struct to manage a region defined by left/right/top/bottom.
Definition: Fl_Scroll.H:105
Fl_Scroll::Fl_Region_LRTB::r
int r
(r)ight "x" position, aka x2
Definition: Fl_Scroll.H:107
Fl_Scroll::Fl_Region_LRTB::b
int b
(b)ottom "y" position, aka y2
Definition: Fl_Scroll.H:109
Fl_Scroll::Fl_Region_LRTB::l
int l
(l)eft "x" position, aka x1
Definition: Fl_Scroll.H:106
Fl_Scroll::Fl_Region_LRTB::t
int t
(t)op "y" position, aka y1
Definition: Fl_Scroll.H:108
Fl_Scroll::Fl_Region_XYWH
A local struct to manage a region defined by xywh.
Definition: Fl_Scroll.H:102
Fl_Scroll::Fl_Scrollbar_Data
A local struct to manage a scrollbar's xywh region and tab values.
Definition: Fl_Scroll.H:113
Fl_Scroll::Fl_Scrollbar_Data::pos
int pos
scrollbar tab's "position of first line displayed"
Definition: Fl_Scroll.H:115
Fl_Scroll::Fl_Scrollbar_Data::total
int total
scrollbar tab's "total number of lines"
Definition: Fl_Scroll.H:118
Fl_Scroll::Fl_Scrollbar_Data::size
int size
scrollbar tab's "size of window in lines"
Definition: Fl_Scroll.H:116
Fl_Scroll::Fl_Scrollbar_Data::first
int first
scrollbar tab's "number of first line"
Definition: Fl_Scroll.H:117
Fl_Scroll::ScrollInfo
Structure to manage scrollbar and widget interior sizes.
Definition: Fl_Scroll.H:127
Fl_Scroll::ScrollInfo::child
Fl_Region_LRTB child
child bounding box: left/right/top/bottom
Definition: Fl_Scroll.H:131
Fl_Scroll::ScrollInfo::scrollsize
int scrollsize
the effective scrollbar thickness (local or global)
Definition: Fl_Scroll.H:128
Fl_Scroll::ScrollInfo::hneeded
int hneeded
horizontal scrollbar visibility
Definition: Fl_Scroll.H:132
Fl_Scroll::ScrollInfo::vneeded
int vneeded
vertical scrollbar visibility
Definition: Fl_Scroll.H:133
Fl_Scroll::ScrollInfo::innerbox
Fl_Region_XYWH innerbox
widget's inner box, excluding scrollbars
Definition: Fl_Scroll.H:129
Fl_Scroll::ScrollInfo::hscroll
Fl_Scrollbar_Data hscroll
horizontal scrollbar region + values
Definition: Fl_Scroll.H:134
Fl_Scroll::ScrollInfo::innerchild
Fl_Region_XYWH innerchild
widget's inner box, including scrollbars
Definition: Fl_Scroll.H:130
Fl_Scroll::ScrollInfo::vscroll
Fl_Scrollbar_Data vscroll
vertical scrollbar region + values
Definition: Fl_Scroll.H:135
- Copyright © 1998-2021 by Bill Spitzak and others.