Pebble Foundation Classes  0.2.0
C++ for Pebble
SimpleMenuLayer

Wrapper around MenuLayer, that uses static data to display a list menu. More...

Collaboration diagram for SimpleMenuLayer:

Classes

struct  SimpleMenuItem
 Data structure containing the information of a menu item. More...
 
struct  SimpleMenuSection
 Data structure containing the information of a menu section. More...
 

Typedefs

typedef struct SimpleMenuLayer SimpleMenuLayer
 
typedef void(* SimpleMenuLayerSelectCallback) (int index, void *context)
 

Functions

SimpleMenuLayer * simple_menu_layer_create (GRect frame, Window *window, const SimpleMenuSection *sections, int32_t num_sections, void *callback_context)
 
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)
 
int simple_menu_layer_get_selected_index (const SimpleMenuLayer *simple_menu)
 
void simple_menu_layer_set_selected_index (SimpleMenuLayer *simple_menu, int32_t index, bool animated)
 
MenuLayer * simple_menu_layer_get_menu_layer (SimpleMenuLayer *simple_menu)
 

Detailed Description

Wrapper around MenuLayer, that uses static data to display a list menu.

Typedef Documentation

◆ SimpleMenuLayerSelectCallback

typedef void(* SimpleMenuLayerSelectCallback) (int index, void *context)

Function signature for the callback to handle the event that a user hits the SELECT button.

Parameters
indexThe row index of the item
contextThe callback context

Function Documentation

◆ simple_menu_layer_create()

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.

Parameters
frameThe frame at which to initialize the menu
windowThe window onto which to set the click configuration provider
sectionsArray with sections that need to be displayed in the menu
num_sectionsThe number of sections in the sections array.
callback_contextPointer to application specific data, that is passed into the callbacks.
Note
The sections array is not deep-copied and can therefore not be stack allocated, but needs to be backed by long-lived storage.
This function does not add the menu's layer to the window.
Returns
A pointer to the SimpleMenuLayer. NULL if the SimpleMenuLayer could not be created

◆ simple_menu_layer_get_layer()

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.

Parameters
simple_menuPointer to the SimpleMenuLayer for which to get the "root" Layer
Returns
The "root" Layer of the menu layer.

◆ simple_menu_layer_get_menu_layer()

MenuLayer* simple_menu_layer_get_menu_layer ( SimpleMenuLayer *  simple_menu)
Parameters
simple_menuThe SimpleMenuLayer to get the MenuLayer from.
Returns
The MenuLayer.

◆ simple_menu_layer_get_selected_index()

int simple_menu_layer_get_selected_index ( const SimpleMenuLayer *  simple_menu)

Gets the row index of the currently selection menu item.

Parameters
simple_menuThe SimpleMenuLayer for which to get the current selected row index.

◆ simple_menu_layer_set_selected_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.

Parameters
simple_menuThe SimpleMenuLayer for which to change the selection
indexThe row index of the item to select
animatedSupply true to animate changing the selection, or false to change the selection instantly.