.\" Copyright (c) 2004-2007 Hypertriton, Inc.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
.\" (INCLUDING BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
.\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd March 24, 2004
.Dt AG_SPINBUTTON 3
.Os
.ds vT Agar API Reference
.ds oS Agar 1.0
.Sh NAME
.Nm AG_Spinbutton
.Nd agar integer spinbutton widget
.Sh SYNOPSIS
.Bd -literal
#include
#include
.Ed
.Sh DESCRIPTION
The
.Nm
widget binds to an integer value of type
.Dv int ,
.Dv Uint ,
.Dv [SU]int8 ,
.Dv [SU]int16
or
.Dv [SU]int32 .
.Pp
WARNING: This widget has been deprecated, please use
.Xr AG_Numerical 3
instead.
.Sh INHERITANCE HIERARCHY
.Xr AG_Object 3 ->
.Xr AG_Widget 3 ->
.Nm .
.Sh INITIALIZATION
.nr nS 1
.Ft "AG_Spinbutton *"
.Fn AG_SpinbuttonNew "AG_Widget *parent" "Uint flags" "const char *label"
.Pp
.Ft void
.Fn AG_SpinbuttonSetValue "AG_Spinbutton *sbu" "..."
.Pp
.Ft void
.Fn AG_SpinbuttonAddValue "AG_Spinbutton *sbu" "..."
.Pp
.Ft void
.Fn AG_SpinbuttonSetMin "AG_Spinbutton *sbu" "int min_value"
.Pp
.Ft void
.Fn AG_SpinbuttonSetMax "AG_Spinbutton *sbu" "int max_value"
.Pp
.Ft void
.Fn AG_SpinbuttonSetRange "AG_Spinbutton *sbu" "int min" "int max"
.Pp
.Ft void
.Fn AG_SpinbuttonSetIncrement "AG_Spinbutton *sbu" "int increment"
.Pp
.Ft void
.Fn AG_SpinbuttonSetWriteable "AG_Spinbutton *sbu" "int writeable"
.Pp
.nr nS 0
The
.Fn AG_SpinbuttonNew
function allocates, initializes, and attaches a new
.Nm
widget.
There are currently no
.Fa flags
specific to this widget.
.Pp
The
.Fn AG_SpinbuttonSetValue
function sets the bound value to the argument, and
.Fn AG_SpinbuttonAddValue
adds the bound value to the argument.
The argument following
.Fa sbu
should be of the same type as the current
.Sq value
binding.
Both of these functions may clamp the value to fit inside the specified range.
.Pp
The
.Fn AG_SpinbuttonSetMin ,
.Fn AG_SpinbuttonSetMax
and
.Fn AG_SpinbuttonSetRange
functions define the range of acceptable values.
Invocations of these functions must always follow
.Fn AG_BindFoo ,
since binding to
.Sq value
automatically selects a range suitable to the new binding type.
.Pp
The
.Fn AG_SpinbuttonSetIncrement
function defines the step value for the "+" and "-" buttons.
.Pp
.Fn AG_SpinbuttonSetWriteable
sets the writeability flag.
.Sh EVENTS
The
.Nm
widget reacts to the following events:
.Pp
.Bl -tag -compact -width 25n
.It bound
Adjust the range of acceptable values depending on the data type of the binding.
.It window-keydown
Increment or decrement the value if
.Dv SDLK_UP
or
.Dv SDLK_DOWN
is pressed.
.El
.Pp
The
.Nm
widget generates the following events:
.Pp
.Bl -tag -compact -width 2n
.It Fn spinbutton-changed "void"
The value has been modified by the textbox or the +/- buttons.
.It Fn spinbutton-return "void"
The value has been modified by the textbox and return was pressed.
.El
.Sh BINDINGS
The
.Nm
widget provides the following bindings:
.Pp
.Bl -tag -compact -width "[SU]int32 *value "
.It Va int *value
Integer value.
.It Va Uint *value
Unsigned integer value.
.It Va [SU]int8 *value
Signed/unsigned 8-bit integer value.
.It Va [SU]int16 *value
Signed/unsigned 16-bit integer value.
.It Va [SU]int32 *value
Signed/unsigned 32-bit integer value.
.El
.Sh TROUBLETONS
The increment value and boundaries are
.Ft int
regardless of the binding type.
.Sh SEE ALSO
.Xr AG_Intro 3 ,
.Xr AG_Button 3 ,
.Xr AG_FSpinbutton 3 ,
.Xr AG_Numerical 3 ,
.Xr AG_Textbox 3 ,
.Xr AG_UCombo 3 ,
.Xr AG_Widget 3 ,
.Xr AG_Window 3
.Sh HISTORY
The
.Nm
widget first appeared in Agar 1.0.
It has been superceded by
.Xr AG_Numerical 3
in Agar 1.3.