#include <winprogress.h>
Go to the source code of this file.
Functions | |
win_widget_t * | win_checkbox_new (char *label) |
Creates a new checkbox. | |
void | win_checkbox_set_label (win_widget_t *widget, char *label) |
Sets the label of a checkbox widget. | |
char * | win_text_get_text (win_widget_t *widget) |
Retrieves the label of a checkbox widget. | |
void | win_checkbox_set_selected (win_widget_t *widget, int sel) |
Sets the selection state of a checkbox widget. | |
int | win_text_is_selected (win_widget_t *widget) |
Retrieves the selection state of a checkbox widget. | |
void | win_checkbox_set_menu (win_widget_t *widget, win_widget_t *menu, int idx) |
Sets the menu tie-in for a checkbox. |
Check boxes are on/off selectable widgets which can be used to represent or edit boolean values.
Definition in file wincheckbox.h.
win_widget_t* win_checkbox_new | ( | char * | label | ) |
Creates a new checkbox.
Allocates and returns a new checkbox widget, with its initial label set to the given value.
The widget is initially set to black text on a white background, opaque, with the minifont.
label | The label of the check box. The label is used in-place, so this parameter should not point to a temporary buffer. |
void win_checkbox_set_label | ( | win_widget_t * | widget, | |
char * | label | |||
) |
Sets the label of a checkbox widget.
After this call, the widget will be assigned the new label. The size is not changed to match the new text. You may need to modify the width or height of the widget by calling win_widget_pack or win_widget_set_size to avoid cutting off the label.
widget | A pointer to the new checkbox widget. | |
label | The new label, as a null-terminated C string. |
void win_checkbox_set_menu | ( | win_widget_t * | widget, | |
win_widget_t * | menu, | |||
int | idx | |||
) |
Sets the menu tie-in for a checkbox.
Although a checkbox widget can always be toggled with the +/- key, it is common to also designate a soft menu tie-in. This will cause a soft menu item to become visible to toggle the checkbox widget when it has focus. Typically, the same menu item would be used for all checkbox widgets and all other widgets that support soft menu tie-in.
This should be set before the checkbox is added to the window system. Otherwise, the menu changes may not happen until the next time focus changes for the check box.
widget | A pointer to the checkbox widget. | |
menu | The soft menu to tie in to the checkbox. | |
idx | The menu item index used to tie in to the checkbox. |
void win_checkbox_set_selected | ( | win_widget_t * | widget, | |
int | sel | |||
) |
Sets the selection state of a checkbox widget.
After this call, the widget will be assigned the new selection state.
widget | A pointer to the new checkbox widget. | |
sel | The new selection state, either zero or non-zero. |
char* win_text_get_text | ( | win_widget_t * | widget | ) |
Retrieves the label of a checkbox widget.
The result of this method is the label assigned to a checkbox widget.
widget | A pointer to the checkbox widget. |
int win_text_is_selected | ( | win_widget_t * | widget | ) |
Retrieves the selection state of a checkbox widget.
The result of this method is non-zero if the checkbox widget is selected (checked), or zero if it is not selected.
widget | A pointer to the checkbox widget. |