|
Functions | |
| 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_data) |
| struct win_window * | wtk_check_box_as_child (struct wtk_check_box *check_box) |
| void | wtk_check_box_toggle (struct wtk_check_box *check_box) |
| void | wtk_check_box_set (struct wtk_check_box *check_box, bool selected) |
| bool | wtk_check_box_is_selected (struct wtk_check_box const *check_box) |
| void | wtk_check_box_size_hint (struct win_point *size, const char *caption) |
| Get minimum widget size. | |
|
| |
| enum | wtk_check_box_state { WTK_CHECKBOX_NORMAL, WTK_CHECKBOX_PRESSED } |
| static bool | wtk_check_box_handler (struct win_window *win, enum win_event_type type, void const *data) |
|
| |
| #define | WTK_CHECKBOX_BOX_SIZE 8 |
| Size of checkbox square. | |
| #define | WTK_CHECKBOX_BOX_X 0 |
| Checkbox square X offset. | |
| #define | WTK_CHECKBOX_BOX_Y 0 |
| Checkbox square Y 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_BOX_COLOR GFX_COLOR(0, 0, 0) |
| Checkbox square frame color. | |
| #define | WTK_CHECKBOX_SELECT_COLOR GFX_COLOR(128, 0, 0) |
| Checkbox square select mark color. | |
| #define | WTK_CHECKBOX_CAPTION_COLOR GFX_COLOR(255, 255, 255) |
| Checkbox caption text color. | |
| #define WTK_CHECKBOX_BOX_COLOR GFX_COLOR(0, 0, 0) |
Checkbox square frame color.
Definition at line 234 of file wtk.h.
Referenced by wtk_check_box_handler().
| #define WTK_CHECKBOX_BOX_SIZE 8 |
Size of checkbox square.
Definition at line 209 of file wtk.h.
Referenced by wtk_check_box_handler(), and wtk_check_box_size_hint().
| #define WTK_CHECKBOX_BOX_X 0 |
Checkbox square X offset.
Definition at line 214 of file wtk.h.
Referenced by wtk_check_box_handler().
| #define WTK_CHECKBOX_BOX_Y 0 |
Checkbox square Y offset.
Definition at line 219 of file wtk.h.
Referenced by wtk_check_box_handler().
| #define WTK_CHECKBOX_CAPTION_COLOR GFX_COLOR(255, 255, 255) |
Checkbox caption text color.
Definition at line 244 of file wtk.h.
Referenced by wtk_check_box_handler().
| #define WTK_CHECKBOX_CAPTION_X (WTK_CHECKBOX_BOX_SIZE + 4) |
Checkbox caption text X offset.
Definition at line 224 of file wtk.h.
Referenced by wtk_check_box_handler(), and wtk_check_box_size_hint().
| #define WTK_CHECKBOX_CAPTION_Y 0 |
Checkbox caption text Y offset.
Definition at line 229 of file wtk.h.
Referenced by wtk_check_box_handler(), and wtk_check_box_size_hint().
| #define WTK_CHECKBOX_SELECT_COLOR GFX_COLOR(128, 0, 0) |
Checkbox square select mark color.
Definition at line 239 of file wtk.h.
Referenced by wtk_check_box_handler().
| enum wtk_check_box_state |
Valid states for check box, relevant to pointer and keyboard operations.
For internal use only.
| WTK_CHECKBOX_NORMAL |
Normal state, no highlight or press. |
| WTK_CHECKBOX_PRESSED |
Widget pressed, action occurs when released. |
Definition at line 54 of file wtk_check_box.c.
| struct win_window* wtk_check_box_as_child | ( | struct wtk_check_box * | check_box | ) | [read] |
This function returns a reference to the window that should be used when managing the widget, such as move, resize, destroy and reparenting.
| check_box | Check box widget to manage. |
Definition at line 89 of file wtk_check_box.c.
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 | |||
| ) | [read] |
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.
| parent | Parent window, possibly wtk_frame_as_parent(my_frame_ptr). | |
| area | Area of the internal contents. | |
| caption | Pointer to caption string. Will be copied into widget. | |
| selected | Initial state of check box, true if checked/selected. | |
| command | Command to send to parent window. Must be non-zero to be enabled. |
Definition at line 333 of file wtk_check_box.c.
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(), wtk_check_box::selected, wtk_check_box::state, strlen(), WIN_BEHAVIOR_REDRAW_PARENT, win_create(), wtk_check_box_handler(), WTK_CHECKBOX_NORMAL, and wtk_copy_string().
| static bool wtk_check_box_handler | ( | struct win_window * | win, | |
| enum win_event_type | type, | |||
| void const * | data | |||
| ) | [static] |
This function is the window event handler for check box widgets. It handles all events sent to the windows composing the widget.
| win | Window receiving the event. | |
| type | The event type. | |
| data | Custom data, depending on event type. |
Definition at line 146 of file wtk_check_box.c.
References assert, wtk_check_box::caption, wtk_check_box::command, wtk_check_box::container, win_command_event::data, GFX_COLOR_TRANSPARENT, gfx_draw_filled_rect, gfx_draw_rect, gfx_draw_string(), membag_free(), win_clip_region::origin, win_command_event::recipient, wtk_check_box::selected, win_command_event::sender, wtk_check_box::state, sysfont, WIN_EVENT_DESTROY, WIN_EVENT_DRAW, WIN_EVENT_POINTER, win_get_custom_data(), win_grab_pointer(), win_is_inside_window(), WIN_POINTER_PRESS, WIN_POINTER_RELEASE, win_queue_command_event(), win_redraw(), wtk_check_box_toggle(), WTK_CHECKBOX_BOX_COLOR, WTK_CHECKBOX_BOX_SIZE, WTK_CHECKBOX_BOX_X, WTK_CHECKBOX_BOX_Y, WTK_CHECKBOX_CAPTION_COLOR, WTK_CHECKBOX_CAPTION_X, WTK_CHECKBOX_CAPTION_Y, WTK_CHECKBOX_NORMAL, WTK_CHECKBOX_PRESSED, and WTK_CHECKBOX_SELECT_COLOR.
Referenced by wtk_check_box_create().
| bool wtk_check_box_is_selected | ( | struct wtk_check_box const * | check_box | ) |
This function returns true if the check box is selected.
Definition at line 130 of file wtk_check_box.c.
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.
| check_box | Check box to update. | |
| selected | Value to set for checkbox. True if check box is selected, false otherwise |
Definition at line 118 of file wtk_check_box.c.
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.
| size | Suggested size for the widget |
| caption | Pointer to caption string to use for widget. |
Definition at line 302 of file wtk_check_box.c.
References assert, gfx_get_string_bounding_box(), font::height, max_s, font::scale, sysfont, WTK_CHECKBOX_BOX_SIZE, WTK_CHECKBOX_CAPTION_X, and WTK_CHECKBOX_CAPTION_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.
| check_box | Check box to toggle. |
Definition at line 102 of file wtk_check_box.c.
References assert, wtk_check_box::container, wtk_check_box::selected, and win_redraw().
Referenced by wtk_check_box_handler().
1.6.3