|
Note: The Agar manual pages follow certain conventions, notably
concerning function return values. Please read
AG_Intro(3)
first.
SYNOPSIS
#include <agar/core.h>
#include <agar/gui.h>
|
DESCRIPTION
|
The
AG_Slider widget allows the user to control an integer or floating-point value within a
specified range, as an alternative to
AG_Numerical(3) and
AG_Scrollbar(3). Unlike
AG_Scrollbar, AG_Slider does not provide a
visible binding.
|
INHERITANCE HIERARCHY
INTERFACE
AG_Slider * AG_SliderNew (AG_Widget *parent, enum ag_slider_type type, Uint flags)
AG_Slider * AG_SliderNewInt (AG_Widget *parent, enum ag_slider_type type, Uint flags, int *val, int *min, int *max)
AG_Slider * AG_SliderNewIntR (AG_Widget *parent, enum ag_slider_type type, Uint flags, int *val, int min, int max)
AG_Slider * AG_SliderNewUint (AG_Widget *parent, enum ag_slider_type type, Uint flags, Uint *value, Uint *min, Uint *max)
AG_Slider * AG_SliderNewUintR (AG_Widget *parent, enum ag_slider_type type, Uint flags, Uint *value, Uint min, Uint max)
AG_Slider * AG_SliderNewUint8 (AG_Widget *parent, enum ag_slider_type type, Uint flags, Uint8 *value, Uint8 *min, Uint8 *max)
AG_Slider * AG_SliderNewUint8R (AG_Widget *parent, enum ag_slider_type type, Uint flags, Uint8 *value, Uint8 min, Uint8 max)
AG_Slider * AG_SliderNewSint8 (AG_Widget *parent, enum ag_slider_type type, Uint flags, Sint8 *value, Sint8 *min, Sint8 *max)
AG_Slider * AG_SliderNewSint8R (AG_Widget *parent, enum ag_slider_type type, Uint flags, Sint8 *value, Sint8 min, Sint8 max)
AG_Slider * AG_SliderNewUint16 (AG_Widget *parent, enum ag_slider_type type, Uint flags, Uint16 *value, Uint16 *min, Uint16 *max)
AG_Slider * AG_SliderNewUint16R (AG_Widget *parent, enum ag_slider_type type, Uint flags, Uint16 *value, Uint16 min, Uint16 max)
AG_Slider * AG_SliderNewSint16 (AG_Widget *parent, enum ag_slider_type type, Uint flags, Sint16 *value, Sint16 *min, Sint16 *max)
AG_Slider * AG_SliderNewSint16R (AG_Widget *parent, enum ag_slider_type type, Uint flags, Sint16 *value, Sint16 min, Sint16 max)
AG_Slider * AG_SliderNewUint32 (AG_Widget *parent, enum ag_slider_type type, Uint flags, Uint32 *value, Uint32 *min, Uint32 *max)
AG_Slider * AG_SliderNewUint32R (AG_Widget *parent, enum ag_slider_type type, Uint flags, Uint32 *value, Uint32 min, Uint32 max)
AG_Slider * AG_SliderNewSint32 (AG_Widget *parent, enum ag_slider_type type, Uint flags, Sint32 *value, Sint32 *min, Sint32 *max)
AG_Slider * AG_SliderNewSint32R (AG_Widget *parent, enum ag_slider_type type, Uint flags, Sint32 *value, Sint32 min, Sint32 max)
AG_Slider * AG_SliderNewFlt (AG_Widget *parent, enum ag_slider_type type, Uint flags, float *value, float *min, float *max)
AG_Slider * AG_SliderNewFltR (AG_Widget *parent, enum ag_slider_type type, Uint flags, float *value, float min, float max)
AG_Slider * AG_SliderNewDbl (AG_Widget *parent, enum ag_slider_type type, Uint flags, double *value, double *min, double *max)
AG_Slider * AG_SliderNewDblR (AG_Widget *parent, enum ag_slider_type type, Uint flags, double *value, double min, double max)
AG_Slider * AG_SliderNewLongDbl (AG_Widget *parent, enum ag_slider_type type, Uint flags, long double *value, long double *min, long double *max)
AG_Slider * AG_SliderNewLongDblR (AG_Widget *parent, enum ag_slider_type type, Uint flags, long double *value, long double min, long double max)
void AG_SliderSetIntIncrement (AG_Slider *slider, int increment)
void AG_SliderSetRealIncrement (AG_Slider *slider, double increment)
void AG_SliderSetControlSize (AG_Slider *slider, int pixels)
|
The
AG_SliderNew() function allocates, initializes, and attaches a new
AG_Slider widget.
type defines the orientation of the slider:
enum ag_slider_type {
AG_SLIDER_HORIZ,
AG_SLIDER_VERT
};
Acceptable
flags include:
| AG_SLIDER_HFILL | Expand horizontally in parent (equivalent to invoking
AG_ExpandHoriz(3)). | | AG_SLIDER_VFILL | Expand vertically in parent (equivalent to invoking
AG_ExpandVert(3)). | | AG_SLIDER_EXPAND | Shorthand for
AG_SLIDER_HFILL|AG_SLIDER_VFILL. |
The
AG_SliderNew*() routine creates a slider and binds variables to the slider's
value, min and
max values.
If an argument is NULL, it is left to the default (type-specific) value.
The
AG_SliderNew*R() variants binds only
value, but sets
min and
max explicitely.
AG_SliderSetIntIncrement() and
AG_SliderSetRealIncrement() define by how much the value is to be incremented/decremented as a result of
keyboard motion.
The former is only meaningful with integer bindings, the latter is only
meaningful with floating-point bindings.
AG_SliderSetControlSize() specifies a preferred size for the slider control, in pixels.
|
BINDINGS
The
AG_Slider widget provides the following bindings:
| float *{value,min,max} | Single precision position/range
| | double *{value,min,max} | Double precision position/range
| | long double *{value,min,max} | Quad precision position/range
| | int *{value,min,max} | Integer position/range
| | Uint *{value,min,max} | Unsigned position/range
| | Uint8 *{value,min,max} | Unsigned 8-bit position/range
| | Uint16 *{value,min,max} | Unsigned 16-bit position/range
| | Uint32 *{value,min,max} | Unsigned 32-bit position/range
| | Sint8 *{value,min,max} | Signed 8-bit position/range
| | Sint16 *{value,min,max} | Signed 16-bit position/range
| | Sint32 *{value,min,max} | Signed 32-bit position/range
|
The slider is positioned to represent
value inside of the range defined by
min and
max.
Note that the
min and
max bindings must share the same type as
value.
|
EVENTS
The
AG_Slider widget reacts to the following events:
| mouse-button-down | Seek to a position or initiate scrolling.
| | mouse-button-up | Terminate scrolling.
| | mouse-motion | Execute scrolling.
|
The
AG_Slider widget generates the following events:
slider-changed (void)
| The slider's value has changed.
| slider-drag-begin (void)
| User is starting to drag the slider.
| slider-drag-end (void)
| User is done dragging the slider.
|
|
SEE ALSO
HISTORY
|
The
AG_Slider widget first appeared in
Agar 1.3.2.
| |