Fl_Scrollbar Class Reference

The Fl_Scrollbar widget displays a slider with arrow buttons at the ends of the scrollbar. More...

#include <Fl_Scrollbar.H>

Inheritance diagram for Fl_Scrollbar:
Fl_Slider Fl_Valuator Fl_Widget

List of all members.

Public Member Functions

 Fl_Scrollbar (int X, int Y, int W, int H, const char *L=0)
 Creates a new Fl_Scrollbar widget with given position, size, and label.
int handle (int)
 Handles the specified event.
void linesize (int i)
 This number controls how big the steps are that the arrow keys do.
int linesize () const
 Get the size of step, in lines, that the arror keys move.
int value (int pos, int windowSize, int first, int total)
 Sets the position, size and range of the slider in the scrollbar.
int value (int p)
 Sets the value (position) of the slider in the scrollbar.
int value () const
 Gets the integer value (position) of the slider in the scrollbar.
 ~Fl_Scrollbar ()
 Destroys the Scrollbar.

Protected Member Functions

void draw ()
 Draws the widget.

Detailed Description

The Fl_Scrollbar widget displays a slider with arrow buttons at the ends of the scrollbar.

Clicking on the arrows move up/left and down/right by linesize(). Scrollbars also accept FL_SHORTCUT events: the arrows move by linesize(), and vertical scrollbars take Page Up/Down (they move by the page size minus linesize()) and Home/End (they jump to the top or bottom).

Scrollbars have step(1) preset (they always return integers). If desired you can set the step() to non-integer values. You will then have to use casts to get at the floating-point versions of value() from Fl_Slider.

scrollbar.png

Constructor & Destructor Documentation

Fl_Scrollbar::Fl_Scrollbar ( int  X,
int  Y,
int  W,
int  H,
const char *  L = 0 
)

Creates a new Fl_Scrollbar widget with given position, size, and label.

You need to do type(FL_HORIZONTAL) if you want a horizontal scrollbar.

Fl_Scrollbar::~Fl_Scrollbar (  ) 

Destroys the Scrollbar.


Member Function Documentation

void Fl_Scrollbar::draw (  )  [protected, virtual]

Draws the widget.

Never call this function directly. FLTK will schedule redrawing whenever needed. If your widget must be redrawn as soon as possible, call redraw() instead.

Override this function to draw your own widgets.

If you ever need to call another widget's draw method from within your own draw() method, e.g. for an embedded scrollbar, you can do it (because draw() is virtual) like this:

        Fl_Widget *s = &scroll;         // scroll is an embedded Fl_Scrollbar
        s->draw();                      // calls Fl_Scrollbar::draw()

Reimplemented from Fl_Slider.

int Fl_Scrollbar::handle ( int  event  )  [virtual]

Handles the specified event.

You normally don't call this method directly, but instead let FLTK do it when the user interacts with the widget.

When implemented in a widget, this function must return 0 if the widget does not use the event or 1 otherwise.

Most of the time, you want to call the inherited handle() method in your overridden method so that you don't short-circuit events that you don't handle. In this last case you should return the callee retval.

Parameters:
[in] event the kind of event received
Return values:
0 if the event was not used or understood
1 if the event was used and can be deleted
See also:
Fl_Event

Reimplemented from Fl_Slider.

void Fl_Scrollbar::linesize ( int  i  )  [inline]

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() minus one linesize(). The default is 16.

int Fl_Scrollbar::value ( int  pos,
int  windowSize,
int  first,
int  total 
) [inline]

Sets the position, size and range of the slider in the scrollbar.

Parameters:
[in] pos position, first line displayed
[in] windowSize number of lines displayed
[in] first number of first line
[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 pos, int size, int first, int total).

int Fl_Scrollbar::value ( int  p  )  [inline]

Sets the value (position) of the slider in the scrollbar.

See also:
Fl_Scrollbar::value()
Fl_Scrollbar::value(int pos, int size, int first, int total)
int Fl_Scrollbar::value (  )  const [inline]

Gets the integer value (position) of the slider in the scrollbar.

You can get the floating point value with Fl_Slider::value().

See also:
Fl_Scrollbar::value(int p)
Fl_Scrollbar::value(int pos, int size, int first, int total)

Reimplemented from Fl_Valuator.


The documentation for this class was generated from the following files: