GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
AG_NUMERICAL(3) FreeBSD Library Functions Manual AG_NUMERICAL(3)

AG_Numericalagar numerical editor widget

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

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 binding, 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 limits are set according to the widest numerical range that can be represented by the type of value.

AG_Numerical is composed of an AG_Textbox(3) with two vertically-stacked AG_Button(3) to increment and decrement the value and an AG_UCombo(3) based unit selector (optional).

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

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


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


AG_Numerical *
(AG_Widget *parent, Uint flags, const char *unit, const char *label, <Type> *value);


AG_Numerical *
(AG_Widget *parent, Uint flags, const char *unit, const char *label, <Type> *value, <Type> min, <Type> max);


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


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


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


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


void
(AG_Numerical *num, int writeable);

The () 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, double is used).
AG_NUMERICAL_EXCL
No external changes to the value binding are to be expected. This allows AG_Numerical to optimize based on exclusive access (by default, the value is checked periodically and the widget is redrawn if a change is detected).
AG_NUMERICAL_SLOW
In non-EXCL case, check value every 2 seconds instead of the default of 250ms.
AG_NUMERICAL_NO_POS_INF
Don't allow "inf" (or U+221E) float input.
AG_NUMERICAL_NO_POS_INF
Don't allow "-inf" (or "-" U+221E) float input
AG_NUMERICAL_NO_INF
Shorthand for AG_NUMERICAL_NO_POS_INF | .
AG_NUMERICAL_HFILL
Expand horizontally in parent container.
AG_NUMERICAL_VFILL
Expand vertically in parent container.
AG_NUMERICAL_EXPAND
Shorthand for AG_NUMERICAL_HFILL | .

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 displayed 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 () create a new widget bound to a variable of the specified type. () also accept explicit min and max arguments.

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

() 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.

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

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

() enables of disables user modification sets the writeability flag, also accessible as the writeable member of the structure.

void
AG_NumericalIncrement(AG_Numerical *num);


void
(AG_Numerical *num);


float
(AG_Numerical *num);


double
(AG_Numerical *num);

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

(), AG_NumericalGetDbl() and () return a representation of the current numerical value.

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.

The AG_Numerical widget generates the following events:

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

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).
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 bindings allow a range to be specified. The inc binding specifies the increment 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.

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

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. Agar 1.5 added support for 64-bit types.

December 21, 2022 Agar 1.7

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.