Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Check box widget

Functions

struct win_windowwtk_check_box_as_child (struct wtk_check_box *check_box)
 This function returns a reference to the window that should be used when managing the widget, such as move, resize, destroy and reparenting. More...
 
struct wtk_check_boxwtk_check_box_create (struct win_window *parent, struct win_area const *area, char const *caption, bool selected, win_command_t command_data)
 This function creates a new check box widget. More...
 
win_command_t wtk_check_box_get_command (struct wtk_check_box *check_box)
 This function returns the window command of the specified check box, as set when the widget was created. More...
 
bool wtk_check_box_is_selected (struct wtk_check_box const *check_box)
 This function returns true if the check box is selected. More...
 
void wtk_check_box_set (struct wtk_check_box *check_box, bool selected)
 This function sets the value of the check box according to the "selected" parameter. More...
 
void wtk_check_box_size_hint (struct win_point *size, const char *caption)
 Get minimum widget size. More...
 
void wtk_check_box_toggle (struct wtk_check_box *check_box)
 This function toggles the value of a check box. More...
 
#define WTK_CHECKBOX_BOX_SIZE   12
 Size of checkbox square. More...
 
#define WTK_CHECKBOX_BOX_X   0
 Checkbox square X offset. More...
 
#define WTK_CHECKBOX_BOX_Y   0
 Checkbox square Y offset. More...
 
#define WTK_CHECKBOX_CAPTION_X   (WTK_CHECKBOX_BOX_SIZE + 4)
 Checkbox caption text X offset. More...
 
#define WTK_CHECKBOX_CAPTION_Y   0
 Checkbox caption text Y offset. More...
 
#define WTK_CHECKBOX_BOX_COLOR   GFX_COLOR_BLACK
 Checkbox square frame color. More...
 
#define WTK_CHECKBOX_BACKGROUND_COLOR   GFX_COLOR_WHITE
 Checkbox square background color. More...
 
#define WTK_CHECKBOX_SELECT_COLOR   GFX_COLOR_DK_RED
 Checkbox square select mark color. More...
 
#define WTK_CHECKBOX_CAPTION_COLOR   GFX_COLOR_BLACK
 Checkbox caption text color. More...
 
#define WTK_CHECKBOX_BOX_SIZE   12
 Size of checkbox square. More...
 
#define WTK_CHECKBOX_BOX_X   0
 Checkbox square X offset. More...
 
#define WTK_CHECKBOX_BOX_Y   0
 Checkbox square Y offset. More...
 
#define WTK_CHECKBOX_CAPTION_X   (WTK_CHECKBOX_BOX_SIZE + 4)
 Checkbox caption text X offset. More...
 
#define WTK_CHECKBOX_CAPTION_Y   0
 Checkbox caption text Y offset. More...
 
#define WTK_CHECKBOX_BOX_COLOR   GFX_COLOR_BLACK
 Checkbox square frame color. More...
 
#define WTK_CHECKBOX_BACKGROUND_COLOR   GFX_COLOR_WHITE
 Checkbox square background color. More...
 
#define WTK_CHECKBOX_SELECT_COLOR   GFX_COLOR_DK_RED
 Checkbox square select mark color. More...
 
#define WTK_CHECKBOX_CAPTION_COLOR   GFX_COLOR_BLACK
 Checkbox caption text color. More...
 
#define WTK_CHECKBOX_BOX_SIZE   12
 Size of checkbox square. More...
 
#define WTK_CHECKBOX_BOX_X   0
 Checkbox square X offset. More...
 
#define WTK_CHECKBOX_BOX_Y   0
 Checkbox square Y offset. More...
 
#define WTK_CHECKBOX_CAPTION_X   (WTK_CHECKBOX_BOX_SIZE + 4)
 Checkbox caption text X offset. More...
 
#define WTK_CHECKBOX_CAPTION_Y   0
 Checkbox caption text Y offset. More...
 
#define WTK_CHECKBOX_BOX_COLOR   GFX_COLOR_BLACK
 Checkbox square frame color. More...
 
#define WTK_CHECKBOX_BACKGROUND_COLOR   GFX_COLOR_WHITE
 Checkbox square background color. More...
 
#define WTK_CHECKBOX_SELECT_COLOR   GFX_COLOR_DK_RED
 Checkbox square select mark color. More...
 
#define WTK_CHECKBOX_CAPTION_COLOR   GFX_COLOR_BLACK
 Checkbox caption text color. More...
 
#define WTK_CHECKBOX_BOX_SIZE   12
 Size of checkbox square. More...
 
#define WTK_CHECKBOX_BOX_X   0
 Checkbox square X offset. More...
 
#define WTK_CHECKBOX_BOX_Y   0
 Checkbox square Y offset. More...
 
#define WTK_CHECKBOX_CAPTION_X   (WTK_CHECKBOX_BOX_SIZE + 4)
 Checkbox caption text X offset. More...
 
#define WTK_CHECKBOX_CAPTION_Y   0
 Checkbox caption text Y offset. More...
 
#define WTK_CHECKBOX_BOX_COLOR   GFX_COLOR_BLACK
 Checkbox square frame color. More...
 
#define WTK_CHECKBOX_BACKGROUND_COLOR   GFX_COLOR_WHITE
 Checkbox square background color. More...
 
#define WTK_CHECKBOX_SELECT_COLOR   GFX_COLOR_DK_RED
 Checkbox square select mark color. More...
 
#define WTK_CHECKBOX_CAPTION_COLOR   GFX_COLOR_BLACK
 Checkbox caption text color. More...
 
#define WTK_CHECKBOX_BOX_SIZE   12
 Size of checkbox square. More...
 
#define WTK_CHECKBOX_BOX_X   0
 Checkbox square X offset. More...
 
#define WTK_CHECKBOX_BOX_Y   0
 Checkbox square Y offset. More...
 
#define WTK_CHECKBOX_CAPTION_X   (WTK_CHECKBOX_BOX_SIZE + 4)
 Checkbox caption text X offset. More...
 
#define WTK_CHECKBOX_CAPTION_Y   0
 Checkbox caption text Y offset. More...
 
#define WTK_CHECKBOX_BOX_COLOR   GFX_COLOR_BLACK
 Checkbox square frame color. More...
 
#define WTK_CHECKBOX_BACKGROUND_COLOR   GFX_COLOR_WHITE
 Checkbox square background color. More...
 
#define WTK_CHECKBOX_SELECT_COLOR   GFX_COLOR_DK_RED
 Checkbox square select mark color. More...
 
#define WTK_CHECKBOX_CAPTION_COLOR   GFX_COLOR_BLACK
 Checkbox caption text color. More...
 
enum  wtk_check_box_state {
  WTK_CHECKBOX_NORMAL,
  WTK_CHECKBOX_PRESSED
}
 Valid states for check box, relevant to pointer and keyboard operations. More...
 
static bool wtk_check_box_handler (struct win_window *win, enum win_event_type type, void const *data)
 This function is the window event handler for check box widgets. More...
 

#define WTK_CHECKBOX_BACKGROUND_COLOR   GFX_COLOR_WHITE

Checkbox square background color.

Referenced by wtk_check_box_handler().

#define WTK_CHECKBOX_BACKGROUND_COLOR   GFX_COLOR_WHITE

Checkbox square background color.

#define WTK_CHECKBOX_BACKGROUND_COLOR   GFX_COLOR_WHITE

Checkbox square background color.

#define WTK_CHECKBOX_BACKGROUND_COLOR   GFX_COLOR_WHITE

Checkbox square background color.

#define WTK_CHECKBOX_BACKGROUND_COLOR   GFX_COLOR_WHITE

Checkbox square background color.

#define WTK_CHECKBOX_BOX_COLOR   GFX_COLOR_BLACK

Checkbox square frame color.

Referenced by wtk_check_box_handler().

#define WTK_CHECKBOX_BOX_COLOR   GFX_COLOR_BLACK

Checkbox square frame color.

#define WTK_CHECKBOX_BOX_COLOR   GFX_COLOR_BLACK

Checkbox square frame color.

#define WTK_CHECKBOX_BOX_COLOR   GFX_COLOR_BLACK

Checkbox square frame color.

#define WTK_CHECKBOX_BOX_COLOR   GFX_COLOR_BLACK

Checkbox square frame color.

#define WTK_CHECKBOX_BOX_SIZE   12

Size of checkbox square.

#define WTK_CHECKBOX_BOX_SIZE   12

Size of checkbox square.

Referenced by wtk_check_box_handler(), and wtk_check_box_size_hint().

#define WTK_CHECKBOX_BOX_SIZE   12

Size of checkbox square.

#define WTK_CHECKBOX_BOX_SIZE   12

Size of checkbox square.

#define WTK_CHECKBOX_BOX_SIZE   12

Size of checkbox square.

#define WTK_CHECKBOX_BOX_X   0

Checkbox square X offset.

#define WTK_CHECKBOX_BOX_X   0

Checkbox square X offset.

#define WTK_CHECKBOX_BOX_X   0

Checkbox square X offset.

Referenced by wtk_check_box_handler().

#define WTK_CHECKBOX_BOX_X   0

Checkbox square X offset.

#define WTK_CHECKBOX_BOX_X   0

Checkbox square X offset.

#define WTK_CHECKBOX_BOX_Y   0

Checkbox square Y offset.

#define WTK_CHECKBOX_BOX_Y   0

Checkbox square Y offset.

#define WTK_CHECKBOX_BOX_Y   0

Checkbox square Y offset.

#define WTK_CHECKBOX_BOX_Y   0

Checkbox square Y offset.

#define WTK_CHECKBOX_BOX_Y   0

Checkbox square Y offset.

Referenced by wtk_check_box_handler().

#define WTK_CHECKBOX_CAPTION_COLOR   GFX_COLOR_BLACK

Checkbox caption text color.

#define WTK_CHECKBOX_CAPTION_COLOR   GFX_COLOR_BLACK

Checkbox caption text color.

#define WTK_CHECKBOX_CAPTION_COLOR   GFX_COLOR_BLACK

Checkbox caption text color.

Referenced by wtk_check_box_handler().

#define WTK_CHECKBOX_CAPTION_COLOR   GFX_COLOR_BLACK

Checkbox caption text color.

#define WTK_CHECKBOX_CAPTION_COLOR   GFX_COLOR_BLACK

Checkbox caption text color.

#define WTK_CHECKBOX_CAPTION_X   (WTK_CHECKBOX_BOX_SIZE + 4)

Checkbox caption text X offset.

#define WTK_CHECKBOX_CAPTION_X   (WTK_CHECKBOX_BOX_SIZE + 4)

Checkbox caption text X offset.

Referenced by wtk_check_box_handler(), and wtk_check_box_size_hint().

#define WTK_CHECKBOX_CAPTION_X   (WTK_CHECKBOX_BOX_SIZE + 4)

Checkbox caption text X offset.

#define WTK_CHECKBOX_CAPTION_X   (WTK_CHECKBOX_BOX_SIZE + 4)

Checkbox caption text X offset.

#define WTK_CHECKBOX_CAPTION_X   (WTK_CHECKBOX_BOX_SIZE + 4)

Checkbox caption text X offset.

#define WTK_CHECKBOX_CAPTION_Y   0

Checkbox caption text Y offset.

#define WTK_CHECKBOX_CAPTION_Y   0

Checkbox caption text Y offset.

Referenced by wtk_check_box_handler(), and wtk_check_box_size_hint().

#define WTK_CHECKBOX_CAPTION_Y   0

Checkbox caption text Y offset.

#define WTK_CHECKBOX_CAPTION_Y   0

Checkbox caption text Y offset.

#define WTK_CHECKBOX_CAPTION_Y   0

Checkbox caption text Y offset.

#define WTK_CHECKBOX_SELECT_COLOR   GFX_COLOR_DK_RED

Checkbox square select mark color.

#define WTK_CHECKBOX_SELECT_COLOR   GFX_COLOR_DK_RED

Checkbox square select mark color.

#define WTK_CHECKBOX_SELECT_COLOR   GFX_COLOR_DK_RED

Checkbox square select mark color.

Referenced by wtk_check_box_handler().

#define WTK_CHECKBOX_SELECT_COLOR   GFX_COLOR_DK_RED

Checkbox square select mark color.

#define WTK_CHECKBOX_SELECT_COLOR   GFX_COLOR_DK_RED

Checkbox square select mark color.

Valid states for check box, relevant to pointer and keyboard operations.

Enumerator
WTK_CHECKBOX_NORMAL 

Normal state, no highlight or press.

WTK_CHECKBOX_PRESSED 

Widget pressed, action occurs when released.

struct win_window* wtk_check_box_as_child ( struct wtk_check_box check_box)

This function returns a reference to the window that should be used when managing the widget, such as move, resize, destroy and reparenting.

Parameters
check_boxCheck box widget to manage.
Returns
Window to be used for managing the check box.

References Assert, and wtk_check_box::container.

struct wtk_check_box* wtk_check_box_create ( struct win_window parent,
struct win_area const *  area,
char const *  caption,
bool  selected,
win_command_t  command 
)

This function creates a new check box widget.

It allocates required memory and intializes necessary windows to create the widget. If there is not enough memory, the function returns NULL.

To destroy the widget and all its contents, and free its memory, call win_destroy() on the check box' child reference, given by wtk_check_box_as_child(), like this: "win_destroy(wtk_check_box_as_child(my_check_box_ptr));". Usually it will be destroyed automatically when it's parent is destroyed.

Parameters
parentParent window, possibly wtk_frame_as_parent(my_frame_ptr).
areaArea of the internal contents.
captionPointer to caption string. Will be copied into widget.
selectedInitial state of check box, true if checked/selected.
commandCommand to send to parent window. Must be non-zero to be enabled.
Returns
Pointer to check box, or NULL if failed.

References win_attributes::area, Assert, win_attributes::background, win_attributes::behavior, wtk_check_box::caption, wtk_check_box::command, wtk_check_box::container, win_attributes::custom, win_attributes::event_handler, membag_alloc(), membag_free(), NULL, wtk_check_box::selected, wtk_check_box::state, WIN_BEHAVIOR_REDRAW_PARENT, win_create(), wtk_check_box_handler(), WTK_CHECKBOX_NORMAL, and wtk_copy_string().

win_command_t wtk_check_box_get_command ( struct wtk_check_box check_box)

This function returns the window command of the specified check box, as set when the widget was created.

Parameters
check_boxCheck box widget to manage.
Returns
Associated window command of the check box widget.

References Assert, and wtk_check_box::command.

bool wtk_check_box_is_selected ( struct wtk_check_box const *  check_box)

This function returns true if the check box is selected.

Returns
True if check box is selected.

References Assert, and wtk_check_box::selected.

void wtk_check_box_set ( struct wtk_check_box check_box,
bool  selected 
)

This function sets the value of the check box according to the "selected" parameter.

The graphics will be updated if the box is visible.

Parameters
check_boxCheck box to update.
selectedValue to set for checkbox. True if check box is selected, false otherwise

References Assert, wtk_check_box::container, wtk_check_box::selected, and win_redraw().

void wtk_check_box_size_hint ( struct win_point size,
const char *  caption 
)

Get minimum widget size.

This function returns the minimum size that is required for showing the full widget and the caption.

Return values
sizeSuggested size for the widget
Parameters
captionPointer to caption string to use for widget.

References Assert, gfx_get_string_bounding_box(), sysfont, WTK_CHECKBOX_BOX_SIZE, WTK_CHECKBOX_CAPTION_X, WTK_CHECKBOX_CAPTION_Y, win_point::x, and win_point::y.

void wtk_check_box_toggle ( struct wtk_check_box check_box)

This function toggles the value of a check box.

If it is not selected, it will be set to a selected/checked state, and vice versa. The graphics will be updated if the box is visible.

Parameters
check_boxCheck box to toggle.

References Assert, wtk_check_box::container, wtk_check_box::selected, and win_redraw().

Referenced by wtk_check_box_handler().