FLTK 1.3.3
Fl_Scroll.H
1 //
2 // "$Id: Fl_Scroll.H 10221 2014-07-16 18:51:56Z greg.ercolano $"
3 //
4 // Scroll header file for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 1998-2010 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;
126  int scrollsize;
127  Fl_Region_XYWH innerbox;
128  Fl_Region_XYWH innerchild;
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,int,int,int);
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 10221 2014-07-16 18:51:56Z greg.ercolano $".
209 //
Fl_Widget is the base class for all widgets in FLTK.
Definition: Fl_Widget.H:100
A local struct to manage a region defined by left/right/top/bottom.
Definition: Fl_Scroll.H:112
int x() const
Gets the widget position in its window.
Definition: Fl_Widget.H:273
void redraw()
Schedules the drawing of the widget.
Definition: Fl.cxx:1706
int h() const
Gets the widget height.
Definition: Fl_Widget.H:288
int w() const
Gets the widget width.
Definition: Fl_Widget.H:283
Fl_Widget * child(int n) const
Returns array()[n].
Definition: Fl_Group.H:79
int yposition() const
Gets the current vertical scrolling position.
Definition: Fl_Scroll.H:165
void draw()
Draws the widget.
Definition: Fl_Group.cxx:738
void clear()
Deletes all child widgets from memory recursively.
Definition: Fl_Group.cxx:383
int scrollbar_size() const
Gets the current size of the scrollbars' troughs, in pixels.
Definition: Fl_Scroll.H:177
int y() const
Gets the widget position in its window.
Definition: Fl_Widget.H:278
The Fl_Group class is the FLTK container widget.
Definition: Fl_Group.H:41
int pos
scrollbar tab's "position of first line displayed"
Definition: Fl_Scroll.H:121
int handle(int)
Handles the specified event.
Definition: Fl_Group.cxx:147
A local struct to manage a region defined by xywh.
Definition: Fl_Scroll.H:110
int r
(r)ight "x" position, aka x2
Definition: Fl_Scroll.H:114
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
void resize(int, int, int, int)
Resizes the Fl_Group widget and all of its children.
Definition: Fl_Group.cxx:634
int t
(t)op "y" position, aka y1
Definition: Fl_Scroll.H:115
int xposition() const
Gets the current horizontal scrolling position.
Definition: Fl_Scroll.H:163
This container widget lets you maneuver around a set of widgets much larger than your window...
Definition: Fl_Scroll.H:87
int l
(l)eft "x" position, aka x1
Definition: Fl_Scroll.H:113
A local struct to manage a scrollbar's xywh region and tab values.
Definition: Fl_Scroll.H:119
int b
(b)ottom "y" position, aka y2
Definition: Fl_Scroll.H:116
void scrollbar_size(int newSize)
Sets the pixel size of the scrollbars' troughs to newSize, in pixels.
Definition: Fl_Scroll.H:199
int total
scrollbar tab's "total number of lines"
Definition: Fl_Scroll.H:124
The Fl_Scrollbar widget displays a slider with arrow buttons at the ends of the scrollbar.
Definition: Fl_Scrollbar.H:43