Functions | |
struct win_window * | wtk_radio_button_as_child (struct wtk_radio_button *radio_button) |
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_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) |
This function creates a new radio button widget. More... | |
win_command_t | wtk_radio_button_get_command (struct wtk_radio_button *radio_button) |
This function returns the window command of the specified radio button, as set when the widget was created. More... | |
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. More... | |
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. More... | |
void | wtk_radio_button_size_hint (struct win_point *size, const char *caption) |
Get minimum widget size. More... | |
struct wtk_radio_group * | wtk_radio_group_create (void) |
This function creates a new radio button group, allocating required memory and properly initializing the object. More... | |
struct wtk_radio_button * | wtk_radio_group_get_selected (struct wtk_radio_group *group) |
This function retrieves a pointer to the currently selected radio button in a radio group. More... | |
typedef uint8_t | wtk_radio_group_size_t |
Datatype holding reference count for radio button groups. More... | |
typedef uint8_t | wtk_radio_group_size_t |
Datatype holding reference count for radio button groups. More... | |
typedef uint8_t | wtk_radio_group_size_t |
Datatype holding reference count for radio button groups. More... | |
typedef uint8_t | wtk_radio_group_size_t |
Datatype holding reference count for radio button groups. More... | |
typedef uint8_t | wtk_radio_group_size_t |
Datatype holding reference count for radio button groups. More... | |
enum | wtk_radio_button_state { WTK_RADIOBUTTON_NORMAL, WTK_RADIOBUTTON_PRESSED } |
Valid states for radio button, relevant to pointer and keyboard operations. More... | |
static bool | wtk_radio_button_handler (struct win_window *win, enum win_event_type type, void const *data) |
This function is the window event handler for radio button widgets. More... | |
typedef uint8_t wtk_radio_group_size_t |
Datatype holding reference count for radio button groups.
typedef uint8_t wtk_radio_group_size_t |
Datatype holding reference count for radio button groups.
typedef uint8_t wtk_radio_group_size_t |
Datatype holding reference count for radio button groups.
typedef uint8_t wtk_radio_group_size_t |
Datatype holding reference count for radio button groups.
typedef uint8_t wtk_radio_group_size_t |
Datatype holding reference count for radio button groups.
struct win_window* wtk_radio_button_as_child | ( | struct wtk_radio_button * | radio_button | ) |
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. |
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 | ||
) |
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. |
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, membag_alloc(), membag_free(), wtk_radio_group::num_references, wtk_radio_group::selected, wtk_radio_button::state, WIN_BEHAVIOR_REDRAW_PARENT, win_create(), wtk_copy_string(), wtk_radio_button_handler(), wtk_radio_button_select(), and WTK_RADIOBUTTON_NORMAL.
win_command_t wtk_radio_button_get_command | ( | struct wtk_radio_button * | radio_button | ) |
This function returns the window command of the specified radio button, as set when the widget was created.
radio_button | Radio button widget to manage. |
References Assert, and wtk_radio_button::command.
|
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. |
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_BACKGROUND_COLOR, 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, WTK_RADIOBUTTON_SELECT_COLOR, win_point::x, and win_point::y.
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.
radio_button | Radio button widget to check. |
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. |
References Assert, wtk_radio_button::container, wtk_radio_button::group, wtk_radio_group::selected, and win_redraw().
Referenced by wtk_radio_button_create(), and 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. |
References Assert, gfx_get_string_bounding_box(), sysfont, WTK_RADIOBUTTON_BUTTON_Y, WTK_RADIOBUTTON_CAPTION_X, WTK_RADIOBUTTON_CAPTION_Y, WTK_RADIOBUTTON_RADIUS, win_point::x, and win_point::y.
struct wtk_radio_group* wtk_radio_group_create | ( | void | ) |
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.
References membag_alloc(), wtk_radio_group::num_references, and wtk_radio_group::selected.
struct wtk_radio_button* wtk_radio_group_get_selected | ( | struct wtk_radio_group * | group | ) |
This function retrieves a pointer to the currently selected radio button in a radio group.
References Assert, and wtk_radio_group::selected.