|
Functions | |
| struct wtk_radio_group * | wtk_radio_group_create (void) |
| struct wtk_radio_button * | wtk_radio_button_create (struct win_window *parent, struct win_area const *area, char const *caption, bool selected, struct wtk_radio_group *group, win_command_t command_data) |
| struct win_window * | wtk_radio_button_as_child (struct wtk_radio_button *radio_button) |
| void | wtk_radio_button_select (struct wtk_radio_button *radio_button) |
| bool | wtk_radio_button_is_selected (struct wtk_radio_button const *radio_button) |
| void | wtk_radio_button_size_hint (struct win_point *size, const char *caption) |
| Get minimum widget size. | |
|
| |
| enum | wtk_radio_button_state { WTK_RADIOBUTTON_NORMAL, WTK_RADIOBUTTON_PRESSED } |
| static bool | wtk_radio_button_handler (struct win_window *win, enum win_event_type type, void const *data) |
|
| |
| typedef uint8_t | wtk_radio_group_size_t |
| Datatype holding reference count for radio button groups. | |
| typedef uint8_t wtk_radio_group_size_t |
Valid states for radio button, relevant to pointer and keyboard operations.
For internal use only.
| WTK_RADIOBUTTON_NORMAL |
Normal state, no highlight or press. |
| WTK_RADIOBUTTON_PRESSED |
Widget pressed, action occurs when released. |
Definition at line 54 of file wtk_radio_button.c.
| struct win_window* wtk_radio_button_as_child | ( | struct wtk_radio_button * | radio_button | ) | [read] |
This function returns a reference to the window that should be used when managing the widget, such as move, resize, destroy and reparenting.
| radio_button | Radio button widget to manage. |
Definition at line 105 of file wtk_radio_button.c.
References assert, and wtk_radio_button::container.
| struct wtk_radio_button* wtk_radio_button_create | ( | struct win_window * | parent, | |
| struct win_area const * | area, | |||
| char const * | caption, | |||
| bool | selected, | |||
| struct wtk_radio_group * | group, | |||
| win_command_t | command | |||
| ) | [read] |
This function creates a new radio button 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 radio button's child reference, given by wtk_radio_button_as_child(), like this: "win_destroy(wtk_radio_button_as_child(myButtonPtr));". Usually it will be destroyed automatically when it's parent is destroyed.
| parent | Parent window, possibly wtk_frame_as_parent(myFramePtr). | |
| area | Area of the internal contents. | |
| caption | Pointer to caption string. Will be copied into widget. | |
| selected | Initial state of radio button, true if checked/selected. | |
| group | Radio button group to be a member of. | |
| command | Command to send to parent window. Must be non-zero to be enabled. |
Definition at line 372 of file wtk_radio_button.c.
References win_attributes::area, assert, win_attributes::background, win_attributes::behavior, wtk_radio_button::caption, wtk_radio_button::command, wtk_radio_button::container, win_attributes::custom, win_attributes::event_handler, wtk_radio_button::group, L, membag_alloc(), membag_free(), wtk_radio_group::num_references, wtk_radio_group::selected, wtk_radio_button::state, strlen(), WIN_BEHAVIOR_REDRAW_PARENT, win_create(), win_redraw(), wtk_copy_string(), wtk_radio_button_handler(), and WTK_RADIOBUTTON_NORMAL.
| static bool wtk_radio_button_handler | ( | struct win_window * | win, | |
| enum win_event_type | type, | |||
| void const * | data | |||
| ) | [static] |
This function is the window event handler for radio button 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 162 of file wtk_radio_button.c.
References assert, wtk_radio_button::caption, wtk_radio_button::command, wtk_radio_button::container, win_command_event::data, GFX_COLOR_TRANSPARENT, gfx_draw_circle, gfx_draw_filled_circle, gfx_draw_string(), GFX_WHOLE, wtk_radio_button::group, membag_free(), wtk_radio_group::num_references, win_clip_region::origin, win_command_event::recipient, wtk_radio_group::selected, win_command_event::sender, wtk_radio_button::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_radio_button_select(), WTK_RADIOBUTTON_BUTTON_COLOR, WTK_RADIOBUTTON_BUTTON_X, WTK_RADIOBUTTON_BUTTON_Y, WTK_RADIOBUTTON_CAPTION_COLOR, WTK_RADIOBUTTON_CAPTION_X, WTK_RADIOBUTTON_CAPTION_Y, WTK_RADIOBUTTON_NORMAL, WTK_RADIOBUTTON_PRESSED, WTK_RADIOBUTTON_RADIUS, and WTK_RADIOBUTTON_SELECT_COLOR.
Referenced by wtk_radio_button_create().
| bool wtk_radio_button_is_selected | ( | struct wtk_radio_button const * | radio_button | ) |
This function returns true if the radio button is the one currently selected within its radio button group.
Definition at line 146 of file wtk_radio_button.c.
References assert, wtk_radio_button::group, and wtk_radio_group::selected.
| void wtk_radio_button_select | ( | struct wtk_radio_button * | radio_button | ) |
This function sets this radio button to be the single radio button selected within its group. If another radio button was selected, it will be deselected. Both widgets will be redrawn if visible.
| radio_button | Radio button widget to select. |
Definition at line 119 of file wtk_radio_button.c.
References assert, wtk_radio_button::container, wtk_radio_button::group, wtk_radio_group::selected, and win_redraw().
Referenced by wtk_radio_button_handler().
| void wtk_radio_button_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 340 of file wtk_radio_button.c.
References assert, gfx_get_string_bounding_box(), font::height, max_s, font::scale, sysfont, WTK_RADIOBUTTON_BUTTON_Y, WTK_RADIOBUTTON_CAPTION_X, WTK_RADIOBUTTON_CAPTION_Y, and WTK_RADIOBUTTON_RADIUS.
| struct wtk_radio_group* wtk_radio_group_create | ( | void | ) | [read] |
This function creates a new radio button group, allocating required memory and properly initializing the object. If there is not enough memory, the function returns NULL. The radio button group will keep a reference count for its members, and will be automatically destroyed when the last member is destroyed.
Definition at line 453 of file wtk_radio_button.c.
References membag_alloc(), wtk_radio_group::num_references, and wtk_radio_group::selected.
1.6.3