|
NAMEAG_Checkbox —
agar checkbox widget
SYNOPSIS#include <agar/core.h> #include <agar/gui.h> DESCRIPTIONTheAG_Checkbox widget controls a boolean variable
(i.e., an int or a set of bits in an integer). If a text
label is specified, it is displayed next to the control.
INHERITANCE HIERARCHYAG_Object(3) -> AG_Widget(3) ->AG_Checkbox .
INITIALIZATIONAG_Checkbox *AG_CheckboxNew (AG_Widget
*parent, Uint flags,
const char *format,
...);
The Acceptable values for the flags argument include:
The
The utility function
typedef struct ag_flag_descr { Uint bitmask; /* Bitmask */ const char *descr; /* Bit(s) description */ int writeable; /* User-editable */ } AG_FlagDescr; The BINDINGSTheAG_Checkbox widget provides the following bindings:
EVENTSTheAG_Checkbox widget generates the following events:
STRUCTURE DATAFor the AG_Checkbox object:
EXAMPLESThe following code fragment ties anAG_Checkbox to a
boolean variable represented by an int:
int someOption = 0; AG_Window *win = AG_WindowNew(0); AG_CheckboxNewInt(win, 0, "Some option", &someOption); AG_WindowShow(win); The following code fragment uses an
static void MyCallback(AG_Event *event) { AG_TextInfo(NULL, "Callback invoked"); } AG_Window *win = AG_WindowNew(0); AG_CheckboxNewFn(win, 0, "Execute callback", MyCallback, NULL); AG_WindowShow(win); The following code fragment creates an array of checkboxes, each tied to a specific bit in a word: #define FLAG_FOO 0x01 #define FLAG_BAR 0x02 #define FLAG_BAZ 0x04 int myWord = 0; AG_FlagDescr myFlagDescr[] = { { FLAG_FOO, "foo flag", 1 }, { FLAG_BAR, "bar flag", 1 }, { FLAG_BAZ, "baz flag (readonly)", 0 }, { 0, NULL, 0 } }; AG_Window *win = AG_WindowNew(0); AG_CheckboxSetFromFlags(win, 0, &myWord, myFlagDescr); AG_WindowShow(win); SEE ALSOAG_Button(3), AG_Event(3), AG_Intro(3), AG_Radio(3), AG_Widget(3), AG_Window(3)HISTORYTheAG_Checkbox widget first appeared in Agar 1.0.
Visit the GSP FreeBSD Man Page Interface. |