FLTK
Fl_Scroll.H
1//
2// "$Id$"
3//
4// Scroll header file for the Fast Light Tool Kit (FLTK).
5//
6// Copyright 1998-2015 by Bill Spitzak and others.
7//
8// This library is free software. Distribution and use rights are outlined in
9// the file "COPYING" which should have been included with this file. If this
10// file is missing or damaged, see the license at:
11//
12// http://www.fltk.org/COPYING.php
13//
14// Please report all bugs and problems on the following page:
15//
16// http://www.fltk.org/str.php
17//
18
19/* \file
20 Fl_Scroll widget . */
21
22#ifndef Fl_Scroll_H
23#define Fl_Scroll_H
24
25#include "Fl_Group.H"
26#include "Fl_Scrollbar.H"
27
87class FL_EXPORT Fl_Scroll : public Fl_Group {
88
89 int xposition_, yposition_;
90 int oldx, oldy;
91 int scrollbar_size_;
92 static void hscrollbar_cb(Fl_Widget*, void*);
93 static void scrollbar_cb(Fl_Widget*, void*);
94 void fix_scrollbar_order();
95 static void draw_clip(void*,int,int,int,int);
96
97#if FLTK_ABI_VERSION >= 10303
98protected: // NEW (STR#1895)
99#else
100private: // OLD
101#endif
135 void recalc_scrollbars(ScrollInfo &si);
136
137protected:
138
139 void bbox(int&,int&,int&,int&);
140 void draw();
141
142public:
143
144 Fl_Scrollbar scrollbar;
145 Fl_Scrollbar hscrollbar;
146
147 void resize(int X, int Y, int W, int H);
148 int handle(int);
149
150 Fl_Scroll(int X,int Y,int W,int H,const char*l=0);
151
152 enum { // values for type()
153 HORIZONTAL = 1,
154 VERTICAL = 2,
155 BOTH = 3,
156 ALWAYS_ON = 4,
157 HORIZONTAL_ALWAYS = 5,
158 VERTICAL_ALWAYS = 6,
159 BOTH_ALWAYS = 7
160 };
161
163 int xposition() const {return xposition_;}
165 int yposition() const {return yposition_;}
166 void scroll_to(int, int);
167 void clear();
177 int scrollbar_size() const {
178 return(scrollbar_size_);
179 }
199 void scrollbar_size(int newSize) {
200 if ( newSize != scrollbar_size_ ) redraw();
201 scrollbar_size_ = newSize;
202 }
203};
204
205#endif
206
207//
208// End of "$Id$".
209//
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:87
int yposition() const
Gets the current vertical scrolling position.
Definition Fl_Scroll.H:165
void scrollbar_size(int newSize)
Sets the pixel size of the scrollbars' troughs to newSize, in pixels.
Definition Fl_Scroll.H:199
int xposition() const
Gets the current horizontal scrolling position.
Definition Fl_Scroll.H:163
int scrollbar_size() const
Gets the current size of the scrollbars' troughs, in pixels.
Definition Fl_Scroll.H:177
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:1782
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:112
int r
(r)ight "x" position, aka x2
Definition Fl_Scroll.H:114
int b
(b)ottom "y" position, aka y2
Definition Fl_Scroll.H:116
int l
(l)eft "x" position, aka x1
Definition Fl_Scroll.H:113
int t
(t)op "y" position, aka y1
Definition Fl_Scroll.H:115
A local struct to manage a region defined by xywh.
Definition Fl_Scroll.H:110
A local struct to manage a scrollbar's xywh region and tab values.
Definition Fl_Scroll.H:119
int pos
scrollbar tab's "position of first line displayed"
Definition Fl_Scroll.H:121
int total
scrollbar tab's "total number of lines"
Definition Fl_Scroll.H:124
int first
scrollbar tab's "number of first line"
Definition Fl_Scroll.H:123
int size
scrollbar tab's "size of window in lines"
Definition Fl_Scroll.H:122
Structure to manage scrollbar and widget interior sizes.
Definition Fl_Scroll.H:108
Fl_Region_LRTB child
child bounding box: left/right/top/bottom
Definition Fl_Scroll.H:129
int scrollsize
the effective scrollbar thickness (local or global)
Definition Fl_Scroll.H:126
int hneeded
horizontal scrollbar visibility
Definition Fl_Scroll.H:130
int vneeded
vertical scrollbar visibility
Definition Fl_Scroll.H:131
Fl_Region_XYWH innerbox
widget's inner box, excluding scrollbars
Definition Fl_Scroll.H:127
Fl_Scrollbar_Data hscroll
horizontal scrollbar region + values
Definition Fl_Scroll.H:132
Fl_Region_XYWH innerchild
widget's inner box, including scrollbars
Definition Fl_Scroll.H:128
Fl_Scrollbar_Data vscroll
vertical scrollbar region + values
Definition Fl_Scroll.H:133