FLTK 1.3.4: Fl_Scroll.H Source File

FLTK 1.3.4

Fl_Scroll.H
1 //
2 // "$Id: Fl_Scroll.H 10799 2015-07-18 23:59:54Z AlbrechtS $"
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
87 class 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
98 protected: // NEW (STR#1895)
99 #else
100 private: // OLD
101 #endif
102
108 typedef struct {
110 typedef struct { int x,y,w,h; } Fl_Region_XYWH;
112 typedef struct {
113 int l;
114 int r;
115 int t;
116 int b;
117 } Fl_Region_LRTB;
119 typedef struct {
120 int x,y,w,h;
121 int pos;
122 int size;
123 int first;
124 int total;
125 } Fl_Scrollbar_Data;
126 int scrollsize;
127 Fl_Region_XYWH innerbox;
128 Fl_Region_XYWH innerchild;
129 Fl_Region_LRTB child;
130 int hneeded;
131 int vneeded;
132 Fl_Scrollbar_Data hscroll;
133 Fl_Scrollbar_Data vscroll;
134 } ScrollInfo;
135 void recalc_scrollbars(ScrollInfo &si);
136
137 protected:
138
139 void bbox(int&,int&,int&,int&);
140 void draw();
141
142 public:
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: Fl_Scroll.H 10799 2015-07-18 23:59:54Z AlbrechtS $".
209 //
Fl_Widget
Fl_Widget is the base class for all widgets in FLTK.
Definition: Fl_Widget.H:101
Fl_Widget::h
int h() const
Gets the widget height.
Definition: Fl_Widget.H:299
Fl_Scroll::ScrollInfo::Fl_Region_LRTB
A local struct to manage a region defined by left/right/top/bottom.
Definition: Fl_Scroll.H:112
Fl_Widget::redraw
void redraw()
Schedules the drawing of the widget.
Definition: Fl.cxx:1766
Fl_Group::draw
void draw()
Draws the widget.
Definition: Fl_Group.cxx:738
Fl_Group::clear
void clear()
Deletes all child widgets from memory recursively.
Definition: Fl_Group.cxx:383
Fl_Group
The Fl_Group class is the FLTK container widget.
Definition: Fl_Group.H:41
Fl_Scroll::ScrollInfo::Fl_Scrollbar_Data::pos
int pos
scrollbar tab&#39;s "position of first line displayed"
Definition: Fl_Scroll.H:121
Fl_Group::handle
int handle(int)
Handles the specified event.
Definition: Fl_Group.cxx:147
Fl_Scroll::ScrollInfo::Fl_Region_XYWH
A local struct to manage a region defined by xywh.
Definition: Fl_Scroll.H:110
Fl_Scroll::ScrollInfo::Fl_Region_LRTB::r
int r
(r)ight "x" position, aka x2
Definition: Fl_Scroll.H:114
Fl_Scroll::yposition
int yposition() const
Gets the current vertical scrolling position.
Definition: Fl_Scroll.H:165
Fl_Scroll::xposition
int xposition() const
Gets the current horizontal scrolling position.
Definition: Fl_Scroll.H:163
Fl_Widget::y
int y() const
Gets the widget position in its window.
Definition: Fl_Widget.H:289
Fl_Scroll::ScrollInfo::Fl_Scrollbar_Data::first
int first
scrollbar tab&#39;s "number of first line"
Definition: Fl_Scroll.H:123
Fl_Scroll::ScrollInfo::Fl_Scrollbar_Data::size
int size
scrollbar tab&#39;s "size of window in lines"
Definition: Fl_Scroll.H:122
Fl_Scroll::scrollbar_size
int scrollbar_size() const
Gets the current size of the scrollbars&#39; troughs, in pixels.
Definition: Fl_Scroll.H:177
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_Scroll::ScrollInfo::Fl_Region_LRTB::t
int t
(t)op "y" position, aka y1
Definition: Fl_Scroll.H:115
Fl_Scroll
This container widget lets you maneuver around a set of widgets much larger than your window...
Definition: Fl_Scroll.H:87
Fl_Widget::x
int x() const
Gets the widget position in its window.
Definition: Fl_Widget.H:284
Fl_Scroll::ScrollInfo::Fl_Region_LRTB::l
int l
(l)eft "x" position, aka x1
Definition: Fl_Scroll.H:113
Fl_Scroll::ScrollInfo::Fl_Scrollbar_Data
A local struct to manage a scrollbar&#39;s xywh region and tab values.
Definition: Fl_Scroll.H:119
Fl_Scroll::ScrollInfo::Fl_Region_LRTB::b
int b
(b)ottom "y" position, aka y2
Definition: Fl_Scroll.H:116
Fl_Scroll::scrollbar_size
void scrollbar_size(int newSize)
Sets the pixel size of the scrollbars&#39; troughs to newSize, in pixels.
Definition: Fl_Scroll.H:199
Fl_Widget::w
int w() const
Gets the widget width.
Definition: Fl_Widget.H:294
Fl_Scroll::ScrollInfo::Fl_Scrollbar_Data::total
int total
scrollbar tab&#39;s "total number of lines"
Definition: Fl_Scroll.H:124
Fl_Group::child
Fl_Widget * child(int n) const
Returns array()[n].
Definition: Fl_Group.H:79
Fl_Scrollbar
The Fl_Scrollbar widget displays a slider with arrow buttons at the ends of the scrollbar.
Definition: Fl_Scrollbar.H:43
- © 1998-2016 by Bill Spitzak and others.