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_RADIO(3) FreeBSD Library Functions Manual AG_RADIO(3)

AG_Radioagar radio group widget

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

The AG_Radio widget implements a group of "radio" buttons.

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

AG_Radio *
(AG_Widget *parent, Uint flags, const char *items[]);


AG_Radio *
(AG_Widget *parent, Uint flags, const char *items[], AG_EventFn fn, const char *fmt, ...);


AG_Radio *
(AG_Widget *parent, Uint flags, const char *items[], int *value);


AG_Radio *
(AG_Widget *parent, Uint flags, const char *items[], Uint *value);


void
(AG_Radio *radio, AG_RadioType type);


void
(AG_Radio *radio, const char *items[]);


void
(AG_Radio *radio, Uint nLines, const char *text);


int
(AG_Radio *radio, const char *format, ...);


int
(AG_Radio *radio, const char *text);


int
(AG_Radio *radio, AG_KeySym hotkey, const char *format, ...);


int
(AG_Radio *radio, AG_KeySym hotkey, const char *text);


void
(AG_Radio *radio);

The () function allocates, initializes, and attaches a new AG_Radio widget. If items is not NULL, it should point to a NULL-terminated array of strings. Acceptable flags include:

AG_RADIO_HOMOGENOUS
Divide space equally between radio items.
AG_RADIO_HFILL
Expand horizontally in parent container.
AG_RADIO_VFILL
Expand vertically in parent container.
AG_RADIO_EXPAND
Shorthand for AG_RADIO_HFILL | .

() creates a new radio group and also sets an event handler for the ‘radio-changed’ event.

() creates a new radio group bound to an integer.

() selects whether items are packed horizontally or vertically (the default):

typedef enum ag_radio_type {
	AG_RADIO_VERT,                  /* Vertical disposition */
	AG_RADIO_HORIZ                  /* Horizontal disposition */
} AG_RadioType;

() generates (appends) a set of radio buttons from the given NULL-terminated array of C strings.

() specifies an alternate initial size requisition expressed as a number of lines nLines (or -1 = auto) and the rendered pixel width of text (or NULL = auto). By default, AG_Radio will auto-size based on the set of radio items at the time of the size requisition.

() inserts a single radio button. The AG_RadioAddItemHK() variant also assigns a hotkey to the button.

() removes all radio buttons from the group.

The AG_Radio widget provides the following bindings:

int *value
Index of selected item, or -1 if there is no selection.

The AG_Radio widget generates the following events:

(int index)
Selection changed to item at index index. The ‘value’ binding remains locked throughout the event handler's execution.

For the AG_Radio object:

int oversel
Index of last selection under the cursor (read-only).

The following code fragment connects an AG_Radio to an enum:

enum fruit {
	APPLE,
	ORANGE,
	BANANA
} fruit = APPLE;

const char *fruitNames[] = {
	"Apple",
	"Orange",
	"Banana",
	NULL
};

AG_RadioNewInt(NULL, 0, fruitNames, &fruit);

The following code fragment specifies a callback routine:

void
MyCallback(AG_Event *event)
{
	const int newSelection = AG_INT(1);

	printf("Selected item %d\n", newSelection);
}

...

AG_Radio *rad;

rad = AG_RadioNewFn(NULL, 0, fruitNames, MyCallback, NULL);
AG_BindInt(rad, "value", &fruit);

AG_Intro(3), AG_Widget(3), AG_Window(3)

The AG_Radio widget first appeared in Agar 1.0. AG_RadioSetDisposition() and AG_RadioSizeHint() appeared in Agar 1.6.0. The AG_RADIO_HOMOGENOUS option appeared in Agar 1.6.1.

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.