Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
AG_NUMERICAL(3)	       FreeBSD Library Functions Manual	       AG_NUMERICAL(3)

NAME
     AG_Numerical -- agar numerical editor widget

SYNOPSIS
     #include <agar/core.h>
     #include <agar/gui.h>

DESCRIPTION
     The AG_Numerical widget allows the	value of an integer or floating-point
     variable to be edited by the user.	 AG_Numerical provides a value bind-
     ing, and optional limits may be specified as the min and max bindings.

     If	min or max are undefined when the widget is first shown, default lim-
     its are set according to the widest numerical range that can be repre-
     sented by the type	of value.

     AG_Numerical is composed of an AG_Textbox(3), two AG_Button(3) widgets to
     increment and decrement the value,	and optionally an AG_UCombo(3) for se-
     lecting units.

INHERITANCE HIERARCHY
     AG_Object(3) -> AG_Widget(3) -> AG_Numerical.

INITIALIZATION
     AG_Numerical * AG_NumericalNew(AG_Widget *parent, Uint flags, const char
     *unit, const char *format,	...)

     AG_Numerical * AG_NumericalNewS(AG_Widget *parent,	Uint flags, const char
     *unit, const char *label)

     AG_Numerical * AG_NumericalNew{Flt,Dbl,Ldbl,Int,Uint}(AG_Widget *parent,
     Uint flags, const char *unit, const char *label, _Type_ *value)

     AG_Numerical * AG_NumericalNew{Flt,Dbl,Ldbl,Int,Uint}R(AG_Widget *parent,
     Uint flags, const char *unit, const char *label, _Type_ *value, _Type_
     min, _Type_ max)

     void AG_NumericalSizeHint(AG_Numerical *num, const	char *sizeHint)

     int AG_NumericalSetUnitSystem(AG_Numerical	*num, const char *unit)

     void AG_NumericalSelectUnit(AG_Numerical *num, const char *unit)

     void AG_NumericalSetPrecision(AG_Numerical	*num, const char *fmt, int
     precision)

     void AG_NumericalSetWriteable(AG_Numerical	*num, int writeable)

     The AG_NumericalNew() function allocates, initializes, and	attaches a new
     AG_Numerical widget.  Acceptable flags include:

     AG_NUMERICAL_INT	   If no "value" binding has been set when the widget
			   is first shown, use a built-in variable of type int
			   (by default,	a builtin variable of type double is
			   used).

     AG_NUMERICAL_EXCL	   Advise that no external changes to the value	bind-
			   ing are expected.  By default, the value is period-
			   ically checked and the widget is redrawn if a
			   change is detected.	Note that this setting only
			   influences redraw --	external changes to the	bind-
			   ing values are handled safely regardless.

     AG_NUMERICAL_HFILL	   Expand horizontally in parent (equivalent to	invok-
			   ing AG_ExpandHoriz(3)).  This is recommended	as an
			   alternative to calling AG_NumericalSizeHint().

     AG_NUMERICAL_VFILL	   Expand vertically in	parent (equivalent to invoking
			   AG_ExpandVert(3)).

     AG_NUMERICAL_EXPAND   Shorthand for
			   AG_NUMERICAL_HFILL|AG_NUMERICAL_VFILL.

     The unit argument is the name of the conversion unit that will be used by
     default (other conversion units in	the same unit group will also be dis-
     played in the unit	selector).  If unit is NULL, no	conversion is done and
     the unit selector is not shown.  See AG_Units(3) for more information.

     The alternate constructor routines	AG_NumericalNew<Type>()	create a new
     widget bound to a variable	of the specified type.
     AG_NumericalNew<Type>R() also accept explicit min and max arguments.

     AG_NumericalSizeHint() requests that the initial geometry of the
     AG_Numerical widget be sufficient to display sizeHint in its entirety
     (see AG_SizeSpec(3)).

     AG_NumericalSetUnitSystem() searches all unit groups for a	unit of	the
     given name	and selects it as the active unit.  Other units	in the group
     will be displayed in the unit selector.  If no such unit exists, the
     function returns -1.

     AG_NumericalSelectUnit() searches only the	current	unit group and selects
     the unit of the given name	as the active conversion unit.

     The AG_NumericalSetPrecision() function selects the preferred style and
     precision for printing floating-point numbers.  The default is `%.2f'.

     AG_NumericalSetWriteable()	enables	of disables user modification sets the
     writeability flag,	also accessible	as the writeable member	of the struc-
     ture.

NUMERICAL OPERATIONS
     void AG_NumericalIncrement(AG_Numerical *num)

     void AG_NumericalDecrement(AG_Numerical *num)

     The AG_NumericalIncrement() and AG_NumericalDecrement() functions incre-
     ment and decrement	the bound value	by the interval	specified as the inc
     binding (which defaults to	1).

STRUCTURE DATA
     For the AG_Numerical object:

     char *format	   Format string for printing floating-point numbers.
     const AG_Unit *unit   Current unit	system in use.
     AG_Textbox	*input	   Textbox for keyboard	input.

EVENTS
     The AG_Numerical widget generates the following events:

     numerical-changed(void)
	 The value has been modified by	the textbox or the +/- buttons.
     numerical-return(void)
	 The value has been modified by	the textbox and	return was pressed.

BINDINGS
     The AG_Numerical widget provides the following bindings:

     float *value, *min, *max, *inc	    Real number	(single-precision).
     double *value, *min, *max,	*inc	    Real number	(double-precision).
     long double *value, *min, *max, *inc   Real number	(quad-precision).
     int *value, *min, *max, *inc	    Signed integer value.
     Uint *value, *min,	*max, *inc	    Unsigned integer value.
     Uint8 *value, *min, *max, *inc	    Unsigned 8-bit value.
     Uint16 *value, *min, *max,	*inc	    Unsigned 16-bit value.
     Uint32 *value, *min, *max,	*inc	    Unsigned 32-bit value.
     Uint64 *value, *min, *max,	*inc	    Unsigned 64-bit value.
     Sint8 *value, *min, *max, *inc	    Signed 8-bit value.
     Sint16 *value, *min, *max,	*inc	    Signed 16-bit value.
     Sint32 *value, *min, *max,	*inc	    Signed 32-bit value.
     Sint64 *value, *min, *max,	*inc	    Signed 64-bit value.

     The value binding indicates the number to display.	 The min and max bind-
     ings allow	a range	to be specified.  The inc binding specifies the	incre-
     ment effected by the widget's "+" and "-" buttons (if unit	conversion is
     in	use, inc should	be of the same unit system as value).

     The 64-bit	types are only available if AG_HAVE_64BIT is defined.  The
     long double type requires the AG_HAVE_LONG_DOUBLE be defined.

SEE ALSO
     AG_Button(3), AG_Intro(3),	AG_Textbox(3), AG_Ucombo(3), AG_Units(3)

HISTORY
     The AG_Numerical widget first appeared in Agar 1.2	as a replacement for
     `AG_Spinbutton' and `AG_FSpinbutton' that can handle both floating-point
     and integer values.  As of	Agar 1.5.0, support was	added for 64-bit types
     and long double.

FreeBSD	13.0		       November	20, 2003		  FreeBSD 13.0

NAME | SYNOPSIS | DESCRIPTION | INHERITANCE HIERARCHY | INITIALIZATION | NUMERICAL OPERATIONS | STRUCTURE DATA | EVENTS | BINDINGS | SEE ALSO | HISTORY

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=AG_Numerical&sektion=3&manpath=FreeBSD+12.2-RELEASE+and+Ports>

home | help