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.
It can be thought as a graphical alternative to
AG_Numerical(3).
INHERITANCE HIERARCHY
AG_Object(3)-> AG_Widget(3)-> AG_Slider.
INTERFACE
AG_Slider * AG_SliderNew (AG_Widget *parent, enum ag_slider_type type, Uint flags)
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_EXCL | Advise that no external changes to the value, min and max bindings are expected. By default, the binding values are periodically checked and the slider is redrawn if a change is detected. Note that this setting only influences redraw -- external changes to the binding values are handled safely regardless. |
AG_SLIDER_HFILL | Expand horizontally in parent container. |
AG_SLIDER_VFILL | Expand vertically in parent container. |
AG_SLIDER_EXPAND | Shorthand for AG_SLIDER_HFILL AG_SLIDER_VFILL|. |
The AG_SliderSetControlSize() function specifies a preferred size for the slider control, in pixels.
BINDINGS
The
AG_Slider widget provides the following bindings:
The slider is positioned to represent value inside of the range defined by min and max.
The optional inc binding specifies the increment effected by the buttons, or keyboard. If not specified, it defaults to 0.1 (for floating-point values), or 1 (for integer values).
Note that the min, max and inc bindings must share the same type as value. The 64-bit types are only available if AG_HAVE_64BIT is set.
float *{value,min,max,inc} | Single precision number |
double *{value,min,max,inc} | Double precision number |
int *{value,min,max,inc} | Natural integer |
Uint *{value,min,max,inc} | Unsigned integer |
[SU]int8 *{value,min,max,inc} | Fixed 8-bit integer |
[SU]int16 *{value,min,max,inc} | Fixed 16-bit integer |
[SU]int32 *{value,min,max,inc} | Fixed 32-bit integer |
[SU]int64 *{value,min,max,inc} | Fixed 64-bit integer |
The slider is positioned to represent value inside of the range defined by min and max.
The optional inc binding specifies the increment effected by the buttons, or keyboard. If not specified, it defaults to 0.1 (for floating-point values), or 1 (for integer values).
Note that the min, max and inc bindings must share the same type as value. The 64-bit types are only available if AG_HAVE_64BIT is set.
EVENTS
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.