FLTK 1.3.2

- Main Page
- Related Pages
- Modules
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions
Fl_Slider Class Reference

The Fl_Slider widget contains a sliding knob inside a box. More...

`#include <Fl_Slider.H>`

Inheritance diagram for Fl_Slider:

List of all members.

## Public Member Functions
void | bounds (double a, double b)
| Sets the minimum (a) and maximum (b) values for the valuator widget.
| Fl_Slider (int X, int Y, int W, int H, const char *L=0)
| Creates a new Fl_Slider widget using the given position, size, and label string.
| Fl_Slider (uchar t, int X, int Y, int W, int H, const char *L)
| Creates a new Fl_Slider widget using the given type, position, size, and label string.
int | handle (int)
| Handles the specified event.
int | scrollvalue (int pos, int size, int first, int total)
| Sets the size and position of the sliding knob in the box.
Fl_Boxtype | slider () const
| Gets the slider box type.
void | slider (Fl_Boxtype c)
| Sets the slider box type.
float | slider_size () const
| Get the dimensions of the moving piece of slider.
void | slider_size (double v)
| Set the dimensions of the moving piece of slider.
## Protected Member Functions
void | draw (int, int, int, int)
void | draw ()
| Draws the widget.
int | handle (int, int, int, int, int)

## Detailed Description

The Fl_Slider widget contains a sliding knob inside a box.

It is often used as a scrollbar. Moving the box all the way to the top/left sets it to the minimum(), and to the bottom/right to the maximum(). The minimum() may be greater than the maximum() to reverse the slider direction.

Use void Fl_Widget::type(int) to set how the slider is drawn, which can be one of the following:

- FL_VERTICAL - Draws a vertical slider (this is the default).
- FL_HORIZONTAL - Draws a horizontal slider.
- FL_VERT_FILL_SLIDER - Draws a filled vertical slider, useful as a progress or value meter.
- FL_HOR_FILL_SLIDER - Draws a filled horizontal slider, useful as a progress or value meter.
- FL_VERT_NICE_SLIDER - Draws a vertical slider with a nice looking control knob.
- FL_HOR_NICE_SLIDER - Draws a horizontal slider with a nice looking control knob.

## Constructor & Destructor Documentation

Fl_Slider::Fl_Slider | ( | int | X,
|  | int | Y,
|  | int | W,
|  | int | H,
|  | const char * | L = `0`
| ) |  |

Creates a new Fl_Slider widget using the given position, size, and label string.

The default boxtype is FL_DOWN_BOX.

## Member Function Documentation

void Fl_Slider::bounds | ( | double | a,
|  | double | b
| ) |  |

Sets the minimum (a) and maximum (b) values for the valuator widget.

if at least one of the values is changed, a partial redraw is asked.

Reimplemented from Fl_Valuator.

void Fl_Slider::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()

Implements Fl_Widget.

Reimplemented in Fl_Scrollbar, and Fl_Value_Slider.

int Fl_Slider::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_Widget.

Reimplemented in Fl_Scrollbar, and Fl_Value_Slider.

int Fl_Slider::scrollvalue | ( | int | pos,
|  | int | size,
|  | int | first,
|  | int | total
| ) |  |

Sets the size and position of the sliding knob in the box.

Parameters:

  [in] | pos | position of first line displayed
  [in] | size | size of window in lines
  [in] | first | number of first line
  [in] | total | total number of lines Returns Fl_Valuator::value(p)

Fl_Boxtype Fl_Slider::slider | ( |  | ) | const`[inline]`

Gets the slider box type.

void Fl_Slider::slider | ( | Fl_Boxtype | c | ) | `[inline]`

Sets the slider box type.

void Fl_Slider::slider_size | ( | double | v | ) |

Set the dimensions of the moving piece of slider.

This is the fraction of the size of the entire widget. If you set this to 1 then the slider cannot move. The default value is .08.

For the "fill" sliders this is the size of the area around the end that causes a drag effect rather than causing the slider to jump to the mouse.

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

- Fl_Slider.H
- Fl_Slider.cxx