fltk::Scrollbar Class Reference

Inherits fltk::Slider.

List of all members.

Public Member Functions

int handle (int)
void pagesize (int a)
bool value (int position, int size, int top, int total)
int value () const

Protected Member Functions

void draw ()

Detailed Description

scrollbar.gif

The 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(). If the scrollbar has the keyboard focus 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). Often a widget that takes focus such as the browser will just send keystrokes to the scrollbar directly to get it to move in response.


Member Function Documentation

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

Fltk calls this virtual function to draw the widget, after setting up the graphics (current window, xy translation, etc) so that any drawing functions will go into this widget.

User code should not call this! You probably want to call redraw().

The default version calls draw_box() and draw_label(), thus drawing the box() to fill the widget and putting the label() and image() inside it to fill it, unless the align() flags are set to put it outside.

Information on how to write your own version is here.

Reimplemented from fltk::Slider.

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

The base class handle() accepts FOCUS and recognizes a number of keystrokes that adjust the value. A subclass can call this to get these keystrokes, it can also do it's own keystroke handling if it wants.

Reimplemented from fltk::Slider.

void Scrollbar::pagesize ( int  a) [inline]

How much the pageup/down keys and clicking in the empty area move by. If you call value() this is set to 1 linesize() less than the window.

bool Scrollbar::value ( int  p,
int  w,
int  t,
int  l 
)

Set the current position, the range, the pagesize, and the slider_size() all at once in a useful way.

p = the position in the data of the first pixel in the window

w = the size of the window

t = the position of the top of your data (typically zero)

l = the total size of your data.

int Scrollbar::value ( ) const [inline]

Return the current position of the scrollbar as an integer.

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 the Slider baseclass.

Reimplemented from fltk::Valuator.


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