If a container is preceeded by a [toggle] field, then that toggle controls the visibility of that container.
Draws a popup.
Parameter | Description |
---|---|
form->type |
UI_POPUP |
form->flags |
Might want UI_HIDDEN , UI_DRAGGABLE or UI_RESIZABLE |
form->ptr |
Pointer to another ui_form_t buffer |
form->m |
Margin in pixels |
form->p |
Padding in pixels |
form->label |
Title, index to the localized strings array (or 0) |
Same as popup, but by default its state is UI_HIDDEN
, and there can be only one menu visible at any time. Its
[checkbox] and [radiobutton] children are highlighted when you hover the mouse over them.
Parameter | Description |
---|---|
form->type |
UI_MENU |
form->flags |
Might want UI_SCROLL |
form->ptr |
Pointer to another ui_form_t buffer |
form->m |
Margin in pixels |
form->p |
Padding in pixels |
Does not draw anything, just provides a way to group further fields, hide / show and position them together.
Parameter | Description |
---|---|
form->type |
UI_DIV |
form->flags |
Might want UI_SCROLL |
form->ptr |
Pointer to another ui_form_t buffer |
form->m |
Margin in pixels |
form->p |
Padding in pixels |
Displays fields as a table or grid. Requires including the ui_table.h module.
Parameter | Description |
---|---|
form->type |
UI_TABLE |
form->flags |
Might want UI_SCROLL or UI_NOHEADER |
form->ptr |
Pointer to data records |
form->tblsel |
Index of the selected data record |
form->tblnum |
Number of data records |
form->tblsiz |
Size of one data record in bytes |
form->tblrow |
Row size in pixels |
form->tblcol |
Column size in pixels (if grid, otherwise 0) |
form->data |
Pointer to ui_form_t headers |
form->cmps |
Comparators for sorting (or NULL) |
form->m |
Cellmargin in pixels |
The form->ptr
points to the data records, which in case of a table is probably an array of structs. The form->data
list
must have at least one UI field and MUST always end in an UI_END
field. This contains the hdr
headers and also
specifies how to display a certain column. For a table, set form->tblcol
to 0, and you probably want multiple headers in
form->data
. For a grid, set form->tblcol
to non-zero and then only the first header used in form->data
for all cells.
Parameter | Description |
---|---|
hdr->type |
The cell's display type |
hdr->tblhdr |
Header title, index to the localized strings array |
hdr->tblofs |
Offset of field within the data record (table only) |
hdr->flags |
Set UI_POINTER if this column's field is a pointer |
hdr->w |
Column width, might use UI_PERCENT |
To enable sorting, you must provide twice as many comparator functions as header fields. First is for ascending, the second is for descending order per column.
typedef int (*ui_comp)(const void *a, const void *b);
The prototype is a standard POSIX comparator, used as libc qsort()
function's parameter.