2 // "$Id: Fl_Scrollbar.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
4 // Scroll bar header file for the Fast Light Tool Kit (FLTK).
6 // Copyright 1998-2010 by Bill Spitzak and others.
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Library General Public
10 // License as published by the Free Software Foundation; either
11 // version 2 of the License, or (at your option) any later version.
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Library General Public License for more details.
18 // You should have received a copy of the GNU Library General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23 // Please report all bugs and problems on the following page:
25 // http://www.fltk.org/str.php
29 Fl_Scrollbar widget . */
31 #ifndef Fl_Scrollbar_H
32 #define Fl_Scrollbar_H
34 #include "Fl_Slider.H"
37 The Fl_Scrollbar widget displays a slider with arrow buttons at
38 the ends of the scrollbar. Clicking on the arrows move up/left and
39 down/right by linesize(). Scrollbars also accept FL_SHORTCUT events:
40 the arrows move by linesize(), and vertical scrollbars take Page
41 Up/Down (they move by the page size minus linesize()) and Home/End
42 (they jump to the top or bottom).
44 Scrollbars have step(1) preset (they always return integers). If
45 desired you can set the step() to non-integer values. You will then
46 have to use casts to get at the floating-point versions of value()
49 \image html scrollbar.png
50 \image latex scrollbar.png "Fl_Scrollbar" width=4cm
52 class FL_EXPORT Fl_Scrollbar : public Fl_Slider {
56 static void timeout_cb(void*);
63 Fl_Scrollbar(int X,int Y,int W,int H, const char *L = 0);
68 Gets the integer value (position) of the slider in the scrollbar.
69 You can get the floating point value with Fl_Slider::value().
71 \see Fl_Scrollbar::value(int p)
72 \see Fl_Scrollbar::value(int pos, int size, int first, int total)
74 int value() const {return int(Fl_Slider::value());}
77 Sets the value (position) of the slider in the scrollbar.
79 \see Fl_Scrollbar::value()
80 \see Fl_Scrollbar::value(int pos, int size, int first, int total)
82 int value(int p) {return int(Fl_Slider::value((double)p));}
85 Sets the position, size and range of the slider in the scrollbar.
86 \param[in] pos position, first line displayed
87 \param[in] size window size, number of lines displayed
88 \param[in] first number of first line
89 \param[in] total total number of lines
91 You should call this every time your window changes size, your data
92 changes size, or your scroll position changes (even if in response
93 to a callback from this scrollbar).
94 All necessary calls to redraw() are done.
96 Calls Fl_Slider::scrollvalue(int pos, int size, int first, int total).
98 int value(int pos, int size, int first, int total) {
99 return scrollvalue(pos, size, first, total);
103 Get the size of step, in lines, that the arror keys move.
105 int linesize() const {return linesize_;}
108 This number controls how big the steps are that the arrow keys do.
109 In addition page up/down move by the size last sent to value()
110 minus one linesize(). The default is 16.
112 void linesize(int i) {linesize_ = i;}
119 // End of "$Id: Fl_Scrollbar.H 7981 2010-12-08 23:53:04Z greg.ercolano $".