Wrapper around MenuLayer, that uses static data to display a list menu.
SimpleMenuLayer* simple_menu_layer_create | ( | GRect | frame, |
Window * | window, | ||
const SimpleMenuSection * | sections, | ||
int32_t | num_sections, | ||
void * | callback_context | ||
) |
Creates a new SimpleMenuLayer on the heap and initializes it. It also sets the internal click configuration provider onto given window.
frame | The frame at which to initialize the menu |
window | The window onto which to set the click configuration provider |
sections | Array with sections that need to be displayed in the menu |
num_sections | The number of sections in the sections array. |
callback_context | Pointer to application specific data, that is passed into the callbacks. |
sections
array is not deep-copied and can therefore not be stack allocated, but needs to be backed by long-lived storage. NULL
if the SimpleMenuLayer could not be created void simple_menu_layer_destroy | ( | SimpleMenuLayer * | menu_layer) |
Destroys a SimpleMenuLayer previously created by simple_menu_layer_create.
Layer* simple_menu_layer_get_layer | ( | const SimpleMenuLayer * | simple_menu) |
Gets the "root" Layer of the simple menu layer, which is the parent for the sub-layers used for its implementation.
simple_menu | Pointer to the SimpleMenuLayer for which to get the "root" Layer |
MenuLayer* simple_menu_layer_get_menu_layer | ( | SimpleMenuLayer * | simple_menu) |
simple_menu | The SimpleMenuLayer to get the MenuLayer from. |
int simple_menu_layer_get_selected_index | ( | const SimpleMenuLayer * | simple_menu) |
Gets the row index of the currently selection menu item.
simple_menu | The SimpleMenuLayer for which to get the current selected row index. |
void simple_menu_layer_set_selected_index | ( | SimpleMenuLayer * | simple_menu, |
int32_t | index, | ||
bool | animated | ||
) |
Selects the item in the first section at given row index.
simple_menu | The SimpleMenuLayer for which to change the selection |
index | The row index of the item to select |
animated | Supply true to animate changing the selection, or false to change the selection instantly. |
struct SimpleMenuItem |
Data structure containing the information of a menu item.
Data Fields | ||
---|---|---|
SimpleMenuLayerSelectCallback | callback |
The callback that needs to be called upon a click on the SELECT button. Optional, leave NULL if unused. |
GBitmap * | icon |
The icon of the menu item. Optional, leave NULL if unused. |
const char * | subtitle |
The subtitle of the menu item. Optional, leave NULL if unused. |
const char * | title | The title of the menu item. Required. |
struct SimpleMenuSection |
Data structure containing the information of a menu section.
Data Fields | ||
---|---|---|
const SimpleMenuItem * | items | Array of items in the section. |
uint32_t | num_items |
Number of items in the .items array. |
const char * | title |
Title of the section. Optional, leave NULL if unused. |
typedef void(* SimpleMenuLayerSelectCallback)(int index, void *context) |
Function signature for the callback to handle the event that a user hits the SELECT button.
index | The row index of the item |
context | The callback context |