.\" Copyright (c) 2003-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 November 20, 2003 .Dt FSPINBUTTON 3 .Os .ds vT Agar API Reference .ds oS Agar 1.0 .Sh NAME .Nm AG_FSpinbutton .Nd agar floating-point spinbutton widget .Sh SYNOPSIS .Bd -literal #include #include .Ed .Sh DESCRIPTION The .Nm widget edits the value of a floating point or integer value. .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_FSpinbutton *" .Fn AG_FSpinbuttonNew "AG_Widget *parent, Uint flags, const char *conv_unit" "const char *label" .Pp .Ft void .Fn AG_FSpinbuttonSetValue "AG_FSpinbutton *fsu" "double value" .Pp .Ft void .Fn AG_FSpinbuttonAddValue "AG_FSpinbutton *fsu" "double value" .Pp .Ft void .Fn AG_FSpinbuttonSetMin "AG_FSpinbutton *fsu" "double min_value" .Pp .Ft void .Fn AG_FSpinbuttonSetMax "AG_FSpinbutton *fsu" "double max_value" .Pp .Ft void .Fn AG_FSpinbuttonSetRange "AG_FSpinbutton *fsu" "double min" "double max" .Pp .Ft void .Fn AG_FSpinbuttonSetIncrement "AG_FSpinbutton *fsu" "double increment" .Pp .Ft void .Fn AG_FSpinbuttonSelectUnit "AG_FSpinbutton *fsu" "const char *conv_unit" .Pp .Ft void .Fn AG_FSpinbuttonSetPrecision "AG_FSpinbutton *fsu, const char *fmt" "int precision" .Pp .Ft void .Fn AG_FSpinbuttonSetWriteable "AG_FSpinbutton *fsu" "int writeable" .Pp .nr nS 0 The .Fn AG_FSpinbuttonNew function allocates, initializes, and attaches a new .Nm widget. .Fa conv_unit defines the unit system to use (if set to NULL or "identity", no conversion is done). .Pp The .Fn AG_FSpinbuttonSetValue function modifies the bound value, performing conversion to float or integer if necessary. .Fn AG_FSpinbuttonAddValue adds the specified number to the bound value. The number is given in selected units instead of base units. .Pp The .Fn AG_FSpinbuttonSetMin , .Fn AG_FSpinbuttonSetMax and .Fn AG_FSpinbuttonSetRange functions define the range of acceptable values (in base units). 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_FSpinbuttonSetIncrement function defines the step value (given in selected units) for the "+" and "-" buttons. .Pp .Fn AG_FSpinbuttonSelectUnit changes the current conversion unit. .Pp The .Fn AG_FSpinbuttonSetPrecision function selects the preferred style and precision for printing. The default is .Sq %.2f . .Pp .Fn AG_FSpinbuttonSetWriteable sets the writeability flag, also accessible as the .Va writeable member of the structure. .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 fspinbutton-changed "void" The value has been modified by the textbox or the +/- buttons. .It Fn fspinbutton-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 "double *value" .It Va double *value Real number (double-precision). .It Va float *value Real number (single-precision). .It Va int *value Integer value. .It Va Uint *value Unsigned integer value. .It Va Uint8 *value Unsigned 8-bit value. .El .Sh SEE ALSO .Xr AG_Intro 3 , .Xr AG_Button 3 , .Xr AG_Spinbutton 3 , .Xr AG_Textbox 3 , .Xr AG_Ucombo 3 , .Xr AG_Units 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.