EasyGUI  Version v1.0
Checkbox

Checkbox widget. More...

Data Structures

struct  gui_checkbox_t
 Checkbox object structure. More...
 

Enumerations

enum  gui_checkbox_color_t {
  GUI_CHECKBOX_COLOR_BG = 0x00, GUI_CHECKBOX_COLOR_FG, GUI_CHECKBOX_COLOR_BORDER, GUI_CHECKBOX_COLOR_DISABLED_BG,
  GUI_CHECKBOX_COLOR_TEXT
}
 List of checkbox colors. More...
 

Functions

gui_handle_p gui_checkbox_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 checkbox widget. More...
 
uint8_t gui_checkbox_setcolor (gui_handle_p h, gui_checkbox_color_t index, gui_color_t color)
 Set color to specific part of widget. More...
 
uint8_t gui_checkbox_setchecked (gui_handle_p h, uint8_t checked)
 Set checked status to widget. More...
 
uint8_t gui_checkbox_ischecked (gui_handle_p h)
 Check if checkbox is checked. More...
 
uint8_t gui_checkbox_setdisabled (gui_handle_p h, uint8_t disabled)
 Set disabled status to widget. More...
 
uint8_t gui_checkbox_isdisabled (gui_handle_p h)
 Check if checkbox is disabled. More...
 

Detailed Description

Checkbox widget.

Checkbox widget can hold state of checked or cleared value. On top of it, it can be disabled to make look and usage even more comparable to Windows applications

image_widget_checkbox.png
Checkbox widgets in different states

Example code of image above:

Enumeration Type Documentation

◆ gui_checkbox_color_t

List of checkbox colors.

Enumerator
GUI_CHECKBOX_COLOR_BG 

Background color index

GUI_CHECKBOX_COLOR_FG 

Foreground color index

GUI_CHECKBOX_COLOR_BORDER 

Border color index

GUI_CHECKBOX_COLOR_DISABLED_BG 

Background color index when disabled

GUI_CHECKBOX_COLOR_TEXT 

Text color index

Function Documentation

◆ gui_checkbox_create()

gui_handle_p gui_checkbox_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 checkbox 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_checkbox_ischecked()

uint8_t gui_checkbox_ischecked ( gui_handle_p  h)

Check if checkbox is checked.

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

◆ gui_checkbox_isdisabled()

uint8_t gui_checkbox_isdisabled ( gui_handle_p  h)

Check if checkbox is disabled.

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

◆ gui_checkbox_setchecked()

uint8_t gui_checkbox_setchecked ( gui_handle_p  h,
uint8_t  checked 
)

Set checked status to widget.

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

◆ gui_checkbox_setcolor()

uint8_t gui_checkbox_setcolor ( gui_handle_p  h,
gui_checkbox_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_checkbox_setdisabled()

uint8_t gui_checkbox_setdisabled ( gui_handle_p  h,
uint8_t  disabled 
)

Set disabled status to widget.

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