EasyGUI  Version v1.0
Radio box

Radio box widget. More...

Data Structures

struct  gui_radio_t
 Radio object structure. More...
 

Enumerations

enum  gui_radio_color_t {
  GUI_RADIO_COLOR_BG = 0x00, GUI_RADIO_COLOR_FG, GUI_RADIO_COLOR_BORDER, GUI_RADIO_COLOR_DISABLED_BG,
  GUI_RADIO_COLOR_TEXT
}
 List of radio colors. More...
 

Functions

gui_handle_p gui_radio_create (gui_id_t id, float x, float y, float width, float height, gui_handle_p parent, gui_widget_evt_fn evt_fn, uint16_t flags)
 Create new radio widget. More...
 
uint8_t gui_radio_setcolor (gui_handle_p h, gui_radio_color_t index, gui_color_t color)
 Set color to specific part of widget. More...
 
uint8_t gui_radio_setgroup (gui_handle_p h, uint8_t groupId)
 Set radio group for widget. More...
 
uint8_t gui_radio_getgroup (gui_handle_p h)
 Get radio group for widget. More...
 
uint8_t gui_radio_setvalue (gui_handle_p h, uint32_t value)
 Set value for widget when pressed. More...
 
uint32_t gui_radio_getvalue (gui_handle_p h)
 Get value for specific widget. More...
 
uint32_t gui_radio_getselectedvalue (gui_handle_p h)
 Get value of selected widget from widget group. More...
 
uint8_t gui_radio_setdisabled (gui_handle_p h, uint8_t disabled)
 Disable widget to prevent state change. More...
 
uint8_t gui_radio_isdisabled (gui_handle_p h)
 Check if radio is disabled. More...
 
uint8_t gui_radio_setselected (gui_handle_p h)
 Set radio widget selected in radio group. More...
 

Detailed Description

Radio box widget.

Radiobox widget acts in a group of radio widgets to have support for single selection from multiple available choices

image_widget_radiobox.png
Radiobox widgets in different states

Sample code to create example image above

Enumeration Type Documentation

◆ gui_radio_color_t

List of radio colors.

Enumerator
GUI_RADIO_COLOR_BG 

Background color index

GUI_RADIO_COLOR_FG 

Foreground color index

GUI_RADIO_COLOR_BORDER 

Border color index

GUI_RADIO_COLOR_DISABLED_BG 

Background color index when disabled

GUI_RADIO_COLOR_TEXT 

Text color index

Function Documentation

◆ gui_radio_create()

gui_handle_p gui_radio_create ( gui_id_t  id,
float  x,
float  y,
float  width,
float  height,
gui_handle_p  parent,
gui_widget_evt_fn  evt_fn,
uint16_t  flags 
)

Create new radio widget.

Parameters
[in]idWidget unique ID to use for identity for callback processing
[in]xWidget X position relative to parent widget
[in]yWidget Y position relative to parent widget
[in]widthWidget width in units of pixels
[in]heightWidget height in units of pixels
[in]parentParent widget handle. Set to NULL to use current active parent widget
[in]evt_fnCustom widget callback function. Set to NULL to use default callback
[in]flagsflags for widget creation
Returns
Widget handle on success, NULL otherwise

◆ gui_radio_getgroup()

uint8_t gui_radio_getgroup ( gui_handle_p  h)

Get radio group for widget.

Parameters
[in]hWidget handle
Returns
Widget group

◆ gui_radio_getselectedvalue()

uint32_t gui_radio_getselectedvalue ( gui_handle_p  h)

Get value of selected widget from widget group.

Note
If 3 widgets share the same group ID, no matter which widget is used in this function, result will be always the same
Parameters
[in]hWidget handle
Returns
Widget selected value

◆ gui_radio_getvalue()

uint32_t gui_radio_getvalue ( gui_handle_p  h)

Get value for specific widget.

Parameters
[in]hWidget handle
Returns
Widget value

◆ gui_radio_isdisabled()

uint8_t gui_radio_isdisabled ( gui_handle_p  h)

Check if radio is disabled.

Parameters
[in]hWidget handle
Returns
1 on success, 0 otherwise

◆ gui_radio_setcolor()

uint8_t gui_radio_setcolor ( gui_handle_p  h,
gui_radio_color_t  index,
gui_color_t  color 
)

Set color to specific part of widget.

Parameters
[in]hWidget handle
[in]indexColor index
[in]colorColor value
Returns
1 on success, 0 otherwise

◆ gui_radio_setdisabled()

uint8_t gui_radio_setdisabled ( gui_handle_p  h,
uint8_t  disabled 
)

Disable widget to prevent state change.

Parameters
[in]hWidget handle
[in]disabledSet to 1 to disable, 0 otherwise
Returns
1 on success, 0 otherwise

◆ gui_radio_setgroup()

uint8_t gui_radio_setgroup ( gui_handle_p  h,
uint8_t  groupId 
)

Set radio group for widget.

Note
Radio widgets with the same group must be on the same parent widget
Parameters
[in]hWidget handle
[in]groupIdGroup ID for widget
Returns
1 on success, 0 otherwise

◆ gui_radio_setselected()

uint8_t gui_radio_setselected ( gui_handle_p  h)

Set radio widget selected in radio group.

Parameters
[in]hWidget handle
Returns
1 on success, 0 otherwise

◆ gui_radio_setvalue()

uint8_t gui_radio_setvalue ( gui_handle_p  h,
uint32_t  value 
)

Set value for widget when pressed.

Parameters
[in]hWidget handle
[in]valueValue of widget group when specific widget is selected
Returns
1 on success, 0 otherwise