Agar


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

AG_Object(3)-> AG_Widget(3)-> AG_Slider.

INTERFACE


AG_Slider * AG_SliderNew (AG_Widget *parent, enum ag_slider_type type, Uint flags)

AG_Slider * Fn AG_SliderNew{Int,Uint,Flt,Dbl} "AG_Widget *parent" "enum ag_slider_type type" "Uint flags" "<Type> *val" "<Type> *min" "<Type> *max"
AG_Slider * Fn AG_SliderNew{Int,Uint,Flt,Dbl}R "AG_Widget *parent" "enum ag_slider_type type" "Uint flags" "<Type> *val" "<Type> min" "<Type> max"
AG_Slider * Fn AG_SliderNew{Uint8,Uint16,Uint32} "AG_Widget *parent" "enum ag_slider_type type" "Uint flags" "<Type> *val" "<Type> *min" "<Type> *max"
AG_Slider * Fn AG_SliderNew{Sint8,Sint16,Sint32} "AG_Widget *parent" "enum ag_slider_type type" "Uint flags" "<Type> *val" "<Type> *min" "<Type> *max"
AG_Slider * Fn AG_SliderNew{Uint8,Uint16,Uint32}R "AG_Widget *parent" "enum ag_slider_type type" "Uint flags" "<Type> *val" "<Type> min" "<Type> max"
AG_Slider * Fn AG_SliderNew{Sint8,Sint16,Sint32}R "AG_Widget *parent" "enum ag_slider_type type" "Uint flags" "<Type> *val" "<Type> min" "<Type> 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_HFILLExpand horizontally in parent (equivalent to invoking AG_ExpandHoriz(3)).
AG_SLIDER_VFILLExpand vertically in parent (equivalent to invoking AG_ExpandVert(3)).
AG_SLIDER_EXPANDShorthand for AG_SLIDER_HFILL|AG_SLIDER_VFILL.

The functions Fn AG_SliderNew{Int,Uint,Flt,Dbl}create a new AG_Slider bound to the specified variables. The Fn AG_SliderNew{Int,Uint,Flt,Dbl}Rvariants binds to the specified value, but accepts an explicit range min and max.

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-downSeek to a position or initiate scrolling.
mouse-button-upTerminate scrolling.
mouse-motionExecute 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

AG_Intro(3), AG_Numerical(3), AG_Scrollbar(3), AG_Widget(3), AG_Window(3)

HISTORY

The AG_Slider widget first appeared in Agar 1.3.2.