maug
Quick and dirty C mini-augmentation library.
Loading...
Searching...
No Matches
RetroGUI API
Collaboration diagram for RetroGUI API:

Topics

 RetroGUI Controls
 

Files

file  retrogui.h
 

Data Structures

struct  RETROGUI
 

Macros

#define RETROGUI_FLAGS_DIRTY   0x01
 RETROGUI::flags indicating controls should be redrawn.
 
#define RETROGUI_TRACE_LVL   0
 
#define RETROGUI_CTL_TEXT_SZ_MAX   128
 
#define RETROGUI_CTL_SZ_MAX_INIT   20
 
#define RETROGUI_PADDING   5
 
#define RETROGUI_BTN_LBL_SZ_MAX   64
 
#define RETROGUI_BTN_LBL_PADDED_X   8
 
#define RETROGUI_BTN_LBL_PADDED_Y   8
 
#define RETROGUI_CTL_TEXT_BLINK_FRAMES   15
 
#define retrogui_lock(gui)
 
#define retrogui_unlock(gui)
 
#define retrogui_is_locked(gui)
 
#define _retrogui_copy_str(field, src_str, dest_ctl, str_tmp, str_sz)
 
#define RETROGUI_IDC_NONE   0
 
#define RETROGUI_CTL_TABLE_CONSTS(idx, c_name, c_fields)
 

Typedefs

typedef size_t retrogui_idc_t
 Unique identifying constant number for controls.
 
typedef void(* retrogui_xy_cb) (size_t *x, size_t *y, void *data)
 

Functions

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.
 
MERROR_RETVAL retrogui_redraw_ctls (struct RETROGUI *gui)
 
MERROR_RETVAL retrogui_sz_ctl (struct RETROGUI *gui, retrogui_idc_t idc, size_t *p_w, size_t *p_h, size_t max_w, size_t max_h)
 
MERROR_RETVAL retrogui_pos_ctl (struct RETROGUI *gui, retrogui_idc_t idc, size_t x, size_t y, size_t w, size_t h)
 
MERROR_RETVAL retrogui_push_ctl (struct RETROGUI *gui, union RETROGUI_CTL *ctl)
 
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, size_t idc)
 
MERROR_RETVAL retrogui_set_ctl_text (struct RETROGUI *gui, retrogui_idc_t idc, size_t buffer_sz, const char *fmt,...)
 
MERROR_RETVAL retrogui_init_ctl (union RETROGUI_CTL *ctl, uint8_t type, size_t idc)
 
MERROR_RETVAL retrogui_init (struct RETROGUI *gui)
 
MERROR_RETVAL retrogui_remove_ctl (struct RETROGUI *gui, retrogui_idc_t idc)
 
MERROR_RETVAL retrogui_free (struct RETROGUI *gui)
 

Variables

MAUG_CONST char * gc_retrogui_ctl_names []
 

Detailed Description

Macro Definition Documentation

◆ _retrogui_copy_str

#define _retrogui_copy_str ( field,
src_str,
dest_ctl,
str_tmp,
str_sz )
Value:
/* Sanity checking. */ \
assert( NULL != src_str ); \
debug_printf( RETROGUI_TRACE_LVL, \
"copying string \"%s\" to " #dest_ctl, src_str ); \
if( 0 == str_sz ) { \
str_sz = maug_strlen( src_str ); \
debug_printf( RETROGUI_TRACE_LVL, \
"determined str sz of \"%s\": " SIZE_T_FMT, src_str, str_sz ); \
} \
if( (MAUG_MHANDLE)NULL != dest_ctl. field ## _h ) { \
/* Free the existing string. */ \
maug_mfree( dest_ctl. field ## _h ); \
} \
\
/* Allocate new string space. */ \
dest_ctl. field ## _h = maug_malloc( str_sz + 1, 1 ); \
debug_printf( RETROGUI_TRACE_LVL, \
"allocated str sz for \"%s\": " SIZE_T_FMT, src_str, str_sz + 1 ); \
maug_cleanup_if_null_alloc( MAUG_MHANDLE, dest_ctl. field ## _h ); \
maug_mlock( dest_ctl. field ## _h, str_tmp ); \
maug_cleanup_if_null_lock( char*, str_tmp ); \
\
/* Copy the string over. */ \
assert( NULL != str_tmp ); \
maug_mzero( str_tmp, str_sz + 1 ); \
debug_printf( RETROGUI_TRACE_LVL, \
"zeroed str sz for \"%s\": " SIZE_T_FMT, src_str, str_sz + 1 ); \
maug_strncpy( str_tmp, src_str, str_sz ); \
debug_printf( RETROGUI_TRACE_LVL, "copied str as: \"%s\"", str_tmp ); \
maug_munlock( dest_ctl. field ## _h, str_tmp );

◆ RETROGUI_CTL_TABLE_CONSTS

#define RETROGUI_CTL_TABLE_CONSTS ( idx,
c_name,
c_fields )
Value:
extern MAUG_CONST uint8_t RETROGUI_CTL_TYPE_ ## c_name;

◆ retrogui_is_locked

#define retrogui_is_locked ( gui)
Value:
(mdata_vector_is_locked( &((gui)->ctls) ))

Function Documentation

◆ retrogui_poll_ctls()

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.

Parameters
inputInput integer returned from retroflat_poll_input().
input_evtRETROFLAT_INPUT initialized by retroflat_poll_input().
Returns
IDC of clicked control or RETROGUI_IDC_NONE if none clicked since last poll.