|
|
#define | RETROGUI_TRACE_LVL 0 |
| |
|
#define | RETROGUI_COLOR_BORDER RETROFLAT_COLOR_DARKBLUE |
| | RetroGUI will try to use this color on non-monochrome systems instead of black to draw things like borders, in order to coexist with window transparency (which uses black).
|
| |
|
#define | RETROGUI_FILLBAR_FLAG_SHOWNUM 0x02 |
| |
|
#define | _retrogui_copy_str(field, src_str, dest_ctl, str_tmp, str_sz) |
| |
|
#define | RETROGUI_IDC_FMT "%d" |
| |
|
#define | RETROGUI_IDC_NONE -1 |
| |
|
#define | RETROGUI_COLOR_BG 1 |
| | Value for retrogui_set_ctl_color() color_key indicating background.
|
| |
|
#define | RETROGUI_COLOR_FG 2 |
| | Value for retrogui_set_ctl_color() color_key indicating foreground.
|
| |
|
#define | RETROGUI_COLOR_SEL_BG 3 |
| | Value for retrogui_set_ctl_color() color_key indicating selection background.
|
| |
|
#define | RETROGUI_COLOR_SEL_FG 4 |
| | Value for retrogui_set_ctl_color() color_key indicating selection foreground.
|
| |
|
#define | retrogui_focus_next(gui) retrogui_focus_iter( gui, 0, 1 ) |
| |
|
#define | retrogui_focus_prev(gui) retrogui_focus_iter( gui, mdata_vector_ct( &((gui)->ctls) ) - 1, -1 ) |
| |
|
#define | RETROGUI_CTL_TABLE_CONSTS(idx, c_name, c_fields) extern MAUG_CONST uint8_t SEG_MCONST RETROGUI_CTL_TYPE_ ## c_name; |
| |
|
|
MERROR_RETVAL | retrogui_push_listbox_item (struct RETROGUI *gui, retrogui_idc_t idc, const char *item, size_t item_sz) |
| |
| retrogui_idc_t | retrogui_poll_ctls (struct RETROGUI *gui, RETROFLAT_IN_KEY *p_input, struct RETROFLAT_INPUT *input_evt) |
| | Poll for the last clicked control and maintain listboxes and menus. More...
|
| |
|
MERROR_RETVAL | retrogui_redraw_ctls (struct RETROGUI *gui) |
| |
|
MERROR_RETVAL | retrogui_sz_ctl (struct RETROGUI *gui, retrogui_idc_t idc, retroflat_pxxy_t *p_w, retroflat_pxxy_t *p_h, retroflat_pxxy_t max_w, retroflat_pxxy_t max_h) |
| |
|
MERROR_RETVAL | retrogui_pos_ctl (struct RETROGUI *gui, retrogui_idc_t idc, retroflat_pxxy_t x, retroflat_pxxy_t y, retroflat_pxxy_t w, retroflat_pxxy_t h) |
| |
|
MERROR_RETVAL | retrogui_push_ctl (struct RETROGUI *gui, union RETROGUI_CTL *ctl) |
| |
| MERROR_RETVAL | retrogui_set_font (struct RETROGUI *gui, const maug_path font_path) |
| | Load the RetroFont API for the given RETROGUI to draw its controls with. Use RetroGXCache API if available. More...
|
| |
|
MERROR_RETVAL | retrogui_get_ctl_text (struct RETROGUI *gui, retrogui_idc_t idc, char *buffer, size_t buffer_sz) |
| |
|
ssize_t | retrogui_get_ctl_sel_idx (struct RETROGUI *gui, retrogui_idc_t idc) |
| |
|
MERROR_RETVAL | retrogui_set_ctl_color (struct RETROGUI *gui, retrogui_idc_t idc, uint8_t color_key, RETROFLAT_COLOR color_val) |
| |
|
MERROR_RETVAL | retrogui_set_ctl_text (struct RETROGUI *gui, retrogui_idc_t idc, size_t buffer_sz, const char *fmt,...) |
| |
| MERROR_RETVAL | retrogui_set_ctl_image (struct RETROGUI *gui, retrogui_idc_t idc, const maug_path path, uint8_t flags) |
| | Set the image displayed by an IMAGE-type RETROGUI_CTL. More...
|
| |
|
MERROR_RETVAL | retrogui_set_ctl_image_blit (struct RETROGUI *gui, retrogui_idc_t idc, retroflat_blit_t *blit, uint8_t flags) |
| | Blit the given image onto the control, ensuring that the size is sufficient to hold it.
|
| |
| MERROR_RETVAL | retrogui_set_ctl_level (struct RETROGUI *gui, retrogui_idc_t idc, uint16_t level, uint16_t max, uint8_t flags) |
| | Set the current progress level displayed by a FILLBAR-type RETROGUI_CTL. More...
|
| |
|
MERROR_RETVAL | retrogui_init_ctl (union RETROGUI_CTL *ctl, uint8_t type, retrogui_idc_t idc) |
| |
| retrogui_idc_t | retrogui_focus_iter (struct RETROGUI *gui, size_t start, ssize_t incr) |
| | Increment RETROGUI::focus, skipping elements that cannot hold focus. More...
|
| |
| MERROR_RETVAL | retrogui_init (struct RETROGUI *gui) |
| | Prepare a RETROGUI controller for use. More...
|
| |
| MERROR_RETVAL | retrogui_remove_ctl (struct RETROGUI *gui, retrogui_idc_t idc) |
| | Remove a control with the given unique identifier index from the given RETROGUI controller. More...
|
| |
| MERROR_RETVAL | retrogui_destroy (struct RETROGUI *gui) |
| | Free memory held by a RETROGUI controller internally and clean up any subordinate controls. More...
|
| |
Tools for drawing interactive GUI elements in a RetroFlat program.
Here is a brief example of how to create a
RETROGUI with a button, a LABEL, and a FILLBAR.This example presumes that gui_p EITHER points to a separate
RETROGUI that has been created on the stack and had
retrogui_init() called on it, OR it is set to win->gui_p from the
RetroWin Example.
/ * These are arbitrary; they only must be unique! * /
# define EXAMPLE_IDC_LABEL 10
# define EXAMPLE_IDC_BUTTON 20
# define EXAMPLE_IDC_FILLBAR 30
/ * Insert the label control. * /
retrogui_init_ctl( &ctl, RETROGUI_CTL_TYPE_LABEL, EXAMPLE_IDC_LABEL );
ctl.base.x = 10;
ctl.base.y = 10;
ctl.base.w = 100;
ctl.base.h = 20;
ctl.base.fg_color = RETROFLAT_COLOR_WHITE;
ctl.BUTTON.label = "Example\nLabel";
retval = retrogui_push_ctl( gui_p, &ctl );
maug_cleanup_if_not_ok();
/ * Insert the button control. * /
retrogui_init_ctl(
&ctl, RETROGUI_CTL_TYPE_BUTTON, EXAMPLE_IDC_BUTTON );
ctl.base.x = 10;
ctl.base.y = 40;
ctl.base.w = 60;
ctl.base.h = 20;
ctl.BUTTON.label = "Test";
retval = retrogui_push_ctl( gui_p, &ctl );
maug_cleanup_if_not_ok();
/ * Insert the fillbar control. * /
retrogui_init_ctl(
&ctl, RETROGUI_CTL_TYPE_FILLBAR, EXAMPLE_IDC_FILLBAR );
ctl.base.x = 10;
ctl.base.y = 70;
ctl.base.w = 100;
ctl.base.h = 10;
ctl.base.bg_color = RETROGUI_COLOR_BORDER;
ctl.base.fg_color = RETROFLAT_COLOR_RED;
retval = retrogui_push_ctl( gui_p, &ctl );
maug_cleanup_if_not_ok();
/ * Set the level of the inserted fillbar to 50%. * /
retval = retrogui_set_ctl_level(
gui_p, EXAMPLE_IDC_FILLBAR, 50, 100, 0 );