Go to the source code of this file.
Data Structures | |
struct | win_softmenu_event_t |
Data structure to hold information about menu button presses. More... | |
Defines | |
#define | WIN_SOFTMENU_MAX_ITEMS 30 |
Maximum number of items that can be added to a menu. | |
Functions | |
win_widget_t * | win_softmenu_new (void) |
Creates a new soft menu widget. | |
void | win_softmenu_set_item (win_widget_t *menu, int pos, char *label, int event_num, void *extra_data) |
Sets the menu item at the given position. | |
int | win_softmenu_add_item (win_widget_t *menu, char *label, int event_num, void *extra_data) |
Adds the menu item in the first unused position. | |
void | win_softmenu_insert_item (win_widget_t *menu, int pos, char *label, int event_num, void *extra_data) |
Inserts the menu item into the given position. | |
void | win_softmenu_delete_item (win_widget_t *menu, int pos, int pack) |
Deletes an item from a menu. | |
void | win_softmenu_set_colors (win_widget_t *menu, int pos, unsigned char fg_color, unsigned char bg_color) |
Sets the active colors for a menu item. | |
void | win_softmenu_set_disable_colors (win_widget_t *menu, int pos, unsigned char fg_color, unsigned char bg_color) |
Sets the disabled colors for a menu item. | |
void | win_softmenu_set_enabled (win_widget_t *menu, int pos, int val) |
Enables or disables a menu item. |
Soft menus are the six buttons along the bottom edge of the calculator screen. They are generally associated with graphical boxes along the bottom of the screen. The user can choose the menu with the F1 through F6 keys, and can scroll through menu options with the NXT and PREV buttons.
A soft menu widget ignores its location and size, and always takes up the bottom of the screen.
Definition in file winsoftmenu.h.
#define WIN_SOFTMENU_MAX_ITEMS 30 |
Maximum number of items that can be added to a menu.
Constant representing the maximum number of items that can exist on a menu. This can be greater than the number of visible menu items, which is always 6, and the NXT and PREV keys will navigate the menu.
Definition at line 57 of file winsoftmenu.h.
int win_softmenu_add_item | ( | win_widget_t * | menu, | |
char * | label, | |||
int | event_num, | |||
void * | extra_data | |||
) |
Adds the menu item in the first unused position.
This function is used for indirect control menu items when the precise location of each item is not important. The menu item will be added at the first available location on the menu.
menu | The menu on which to put the item. | |
label | The text that will appear on the new item. | |
event_num | The number of the event to fire when the item is selected. | |
extra_data | Arbitrary data to send to the event handler. |
void win_softmenu_delete_item | ( | win_widget_t * | menu, | |
int | pos, | |||
int | pack | |||
) |
Deletes an item from a menu.
Optionally, the items after the deleted item can be shifted backward to fill the empty space.
menu | The menu from which to delete the item. | |
pos | The position of the menu item, beginning at zero. | |
pack | The last index to be shifted to the left to fill empty space. To disable this behavior, pass 0 for the pack parameter. To pack all items, it is sufficient to pass a very large value such as 1000. |
void win_softmenu_insert_item | ( | win_widget_t * | menu, | |
int | pos, | |||
char * | label, | |||
int | event_num, | |||
void * | extra_data | |||
) |
Inserts the menu item into the given position.
This function is used for general control of the positions of menu items. Any menu items at or after the inserted position will be pushed to the right, filling any unused spaces. If the menu is full, then the last item will be dropped from the menu.
menu | The menu on which to put the item. | |
pos | The position of the menu item, beginning at zero. | |
label | The text that will appear on the new item. | |
event_num | The number of the event to fire when the item is selected. | |
extra_data | Arbitrary data to send to the event handler. |
win_widget_t* win_softmenu_new | ( | void | ) |
Creates a new soft menu widget.
Allocates and returns a new soft menu widget. Initially, the menu has no items.
void win_softmenu_set_item | ( | win_widget_t * | menu, | |
int | pos, | |||
char * | label, | |||
int | event_num, | |||
void * | extra_data | |||
) |
Sets the menu item at the given position.
This function is used for direct control of the positions of menu items. If there is already a menu item at the given position, it is overwritten by the new item.
menu | The menu on which to put the item. | |
pos | The position of the menu item, beginning at zero. | |
label | The text that will appear on the new item. | |
event_num | The number of the event to fire when the item is selected. | |
extra_data | Arbitrary data to send to the event handler. |