EasyGUI  Version v1.0
Checkbox

Checkbox widget. More...

Data Structures

struct  gui_checkbox_t
 Checkbox object structure. More...
 

Macros

#define GUI_FLAG_CHECKBOX_CHECKED   0x01
 
#define GUI_FLAG_CHECKBOX_DISABLED   0x02
 

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_callback_t cb, 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:

/* First checkbox widget */
handle = gui_checkbox_create(0, 10, 10, 400, 40, 0, 0, 0);
gui_widget_settext(handle, _GT("Check box default"));
/* Second checkbox widget */
handle = gui_checkbox_create(0, 10, 50, 400, 40, 0, 0, 0);
gui_widget_settext(handle, _GT("Check box checked"));
/* Third checkbox widget */
handle = gui_checkbox_create(0, 10, 90, 400, 40, 0, 0, 0);
gui_widget_settext(handle, _GT("Check box disabled"));
/* Forth checkbox widget */
handle = gui_checkbox_create(0, 10, 130, 400, 40, 0, 0, 0);
gui_widget_settext(handle, _GT("Check box checked disabled"));

Macro Definition Documentation

◆ GUI_FLAG_CHECKBOX_CHECKED

#define GUI_FLAG_CHECKBOX_CHECKED   0x01

Indicates checkbox is checked

◆ GUI_FLAG_CHECKBOX_DISABLED

#define GUI_FLAG_CHECKBOX_DISABLED   0x02

Indicates checkbox is disabled

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_callback_t  cb,
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 uints of pixels
[in]parentParent widget handle. Set to NULL to use current active parent widget
[in]cbPointer to gui_widget_callback_t callback function. Set to NULL to use default widget callback
[in]flagsflags for widget creation
Returns
gui_handle_p object of created widget on success, NULL otherwise

◆ gui_checkbox_ischecked()

uint8_t gui_checkbox_ischecked ( gui_handle_p  h)

Check if checkbox is checked.

Parameters
[in,out]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,out]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,out]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,out]hWidget handle
[in]indexColor index. This parameter can be a value of gui_checkbox_color_t enumeration
[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,out]hWidget handle
[in]disabledDisabled status
Returns
1 on success, 0 otherwise