updated Fl_Scrollbar::value() description (STR #2156 - part 1)

further rework needed on Fl_Slider::scrollvalue() description



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6674 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
engelsman 2009-03-11 22:15:14 +00:00
parent 21b6692476
commit 97f5e51ed8
2 changed files with 34 additions and 14 deletions

View File

@ -63,21 +63,38 @@ public:
int handle(int);
/**
The first form returns the integer value of the scrollbar. You can get
the floating point value with Fl_Slider::value(). The second
form sets value(), range(), and slider_size()
to make a variable-sized scrollbar. You should call this every time
your window changes size, your data changes size, or your scroll
position changes (even if in response to a callback from this
scrollbar). All necessary calls to redraw() are done.
Gets the integer value (position) of the slider in the scrollbar.
You can get the floating point value with Fl_Slider::value().
\see Fl_Scrollbar::value(int p)
\see Fl_Scrollbar::value(int p, int s, int top, int total)
*/
int value() const {return int(Fl_Slider::value());}
/** See int Fl_Scrollbar::value() */
/**
Sets the value (position) of the slider in the scrollbar.
\see Fl_Scrollbar::value()
\see Fl_Scrollbar::value(int p, int s, int top, int total)
*/
int value(int p) {return int(Fl_Slider::value((double)p));}
/** See int Fl_Scrollbar::value() */
/**
Sets the position, size and range of the slider in the scrollbar.
\param[in] p position, first line displayed
\param[in] s window size, number of lines displayed
\param[in] top number of first line
\param[in] total total number of lines
You should call this every time your window changes size, your data
changes size, or your scroll position changes (even if in response
to a callback from this scrollbar).
All necessary calls to redraw() are done.
Calls Fl_Slider::scrollvalue(int p, int s, int top, int total).
*/
int value(int p, int s, int top, int total) {
return scrollvalue(p, s, top, total);
}
/**
This number controls how big the steps are that the arrow keys do. In
addition page up/down move by the size last sent to value()

View File

@ -79,12 +79,15 @@ void Fl_Slider::bounds(double a, double b) {
}
}
/** Returns Fl_Scrollbar::value(). */
/**
Sets the size and position of the sliding knob in the box.
\param[in] p position, first line displayed
\param[in] W window, number of lines displayed
\param[in] t top, number of first line
\param[in] l length, total number of lines
Returns Fl_Valuator::value(p)
*/
int Fl_Slider::scrollvalue(int p, int W, int t, int l) {
// p = position, first line displayed
// w = window, number of lines displayed
// t = top, number of first line
// l = length, total number of lines
step(1, 1);
if (p+W > t+l) l = p+W-t;
slider_size(W >= l ? 1.0 : double(W)/double(l));