fltk 1.3.0rc3
About: FLTK (Fast Light Tool Kit) is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Microsoft Windows, and MacOS X. Release candidate.
  SfR Fresh Dox: fltk-1.3.0rc3-source.tar.gz ("inofficial" and yet experimental doxygen-generated source code documentation)  

Fl_Scrollbar Class Reference

#include <Fl_Scrollbar.H>

Inheritance diagram for Fl_Scrollbar:
Collaboration diagram for Fl_Scrollbar:

List of all members.

Public Member Functions

 Fl_Scrollbar (int X, int Y, int W, int H, const char *L=0)
 ~Fl_Scrollbar ()
int handle (int)
int value () const
int value (int p)
int value (int pos, int size, int first, int total)
int linesize () const
void linesize (int i)

Protected Member Functions

void draw ()

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

Definition at line 52 of file Fl_Scrollbar.H.


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.

Definition at line 273 of file Fl_Scrollbar.cxx.

References Fl_Widget::box(), Fl_Widget::color(), FL_DARK2, FL_FLAT_BOX, FL_UP_BOX, Fl_Slider::slider(), and Fl_Valuator::step().

Fl_Scrollbar::~Fl_Scrollbar ( )

Destroys the Scrollbar.

Definition at line 284 of file Fl_Scrollbar.cxx.

References Fl::remove_timeout().


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.

Definition at line 209 of file Fl_Scrollbar.cxx.

References Fl_Widget::active_r(), Fl_Widget::box(), Fl::box_dh(), Fl::box_dw(), Fl::box_dx(), Fl::box_dy(), Fl_Widget::damage(), Fl_Widget::draw_box(), fl_color(), FL_DAMAGE_ALL, fl_down(), fl_inactive(), fl_polygon(), Fl_Widget::h(), H, Fl_Valuator::horizontal(), Fl_Widget::labelcolor(), Fl::scheme_, Fl_Widget::selection_color(), Fl_Slider::slider(), Fl_Widget::w(), Fl_Widget::x(), and Fl_Widget::y().

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]eventthe kind of event received
Return values:
0if the event was not used or understood
1if the event was used and can be deleted
See also:
Fl_Event

Reimplemented from Fl_Slider.

Definition at line 75 of file Fl_Scrollbar.cxx.

References Fl::add_timeout(), Fl_Valuator::clamp(), Fl_Widget::damage(), Fl_Widget::do_callback(), Fl::e_dx, Fl::e_dy, Fl::event_button(), Fl::event_key(), Fl::event_x(), Fl::event_y(), FL_DAMAGE_ALL, FL_Down, FL_DRAG, FL_End, FL_ENTER, FL_Home, FL_HOR_NICE_SLIDER, FL_KEYBOARD, FL_LEAVE, FL_Left, FL_MIDDLE_MOUSE, FL_MOUSEWHEEL, FL_Page_Down, FL_Page_Up, FL_PUSH, FL_RELEASE, FL_Right, FL_SHORTCUT, FL_Up, FL_VERT_NICE_SLIDER, Fl_Widget::h(), H, Fl_Valuator::handle_drag(), Fl_Valuator::handle_push(), Fl_Valuator::handle_release(), Fl_Valuator::horizontal(), INITIALREPEAT, int, Fl_Valuator::maximum(), Fl_Valuator::minimum(), Fl::remove_timeout(), Fl_Widget::set_changed(), Fl_Slider::slider_size(), Fl_Widget::type(), val, value(), Fl_Valuator::value_damage(), Fl_Widget::w(), Fl_Widget::x(), and Fl_Widget::y().

Referenced by Fl_Text_Display::handle().

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.

Definition at line 112 of file Fl_Scrollbar.H.

References i.

int Fl_Scrollbar::linesize ( ) const [inline]

Get the size of step, in lines, that the arror keys move.

Definition at line 105 of file Fl_Scrollbar.H.

Referenced by Fl_Browser_::draw(), and Fl_Text_Display::update_v_scrollbar().

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)

Definition at line 82 of file Fl_Scrollbar.H.

References int, and Fl_Valuator::value().

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

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

Parameters:
[in]posposition, first line displayed
[in]sizewindow size, number of lines displayed
[in]firstnumber of first line
[in]totaltotal 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).

Definition at line 98 of file Fl_Scrollbar.H.

References Fl_Slider::scrollvalue().


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