Pebble Foundation Classes  0.2.0
C++ for Pebble
Pebble::MenuEvents Class Referenceabstract

Protected Member Functions

void EnableMenuEvents (MenuLayer &menuLayer, bool hasHeaders, bool hasSeparators, bool longClicks, bool customBackground)
 
virtual uint16_t OnGetNumSections ()
 
virtual uint16_t OnGetNumRows (uint16_t section_index)=0
 
virtual int16_t OnGetCellHeight (const MenuIndex &cell_index)
 
virtual int16_t OnGetHeaderHeight (uint16_t section_index)
 
virtual int16_t OnGetSeparatorHeight (const MenuIndex &cell_index)
 
virtual void OnDrawRow (const GContext &ctx, const Layer &cell_layer, const MenuIndex &cell_index)=0
 
virtual void OnDrawHeader (const GContext &ctx, const Layer &cell_layer, uint16_t section_index)
 
virtual void OnDrawSeparator (const GContext &ctx, const Layer &cell_layer, const MenuIndex &cell_index)
 
virtual void OnSelectClick (const MenuIndex &cell_index)
 
virtual void OnSelectLongClick (const MenuIndex &cell_index)
 
virtual void OnSelectionChanged (const MenuIndex &new_index, const MenuIndex &old_index)
 
virtual void OnSelectionWillChange (MenuIndex &new_index, const MenuIndex &old_index)
 
virtual void OnDrawBackground (const GContext &ctx, const Layer &bg_layer, bool highlight)
 

Member Function Documentation

◆ EnableMenuEvents()

void Pebble::MenuEvents::EnableMenuEvents ( MenuLayer menuLayer,
bool  hasHeaders,
bool  hasSeparators,
bool  longClicks,
bool  customBackground 
)
inlineprotected

Enable the events for the menu. This can be called anytime but should be called when the events will return correct data. If the data changes, you must call ReloadData()

◆ OnDrawBackground()

virtual void Pebble::MenuEvents::OnDrawBackground ( const GContext ctx,
const Layer bg_layer,
bool  highlight 
)
inlineprotectedvirtual

Function signature for the callback which draws the menu's background. The background is underneath the cells of the menu, and is visible in the padding below the bottom cell, or if a cell's background color is set to GColorClear.

Parameters
ctxThe destination graphics context to draw into.
bg_layerThe background's layer, containing the geometry of the background.
highlightWhether this should be rendered as highlighted or not. Highlight style should match the highlight style of cells, since this color can be used for animating selection.

◆ OnDrawHeader()

virtual void Pebble::MenuEvents::OnDrawHeader ( const GContext ctx,
const Layer cell_layer,
uint16_t  section_index 
)
inlineprotectedvirtual

Function signature for the callback to render the section header at a given

Parameters
ctxThe destination graphics context to draw into
cell_layerThe header cell's layer, containing the geometry of the header cell
section_indexThe section index of the section header that needs to be drawn
Note
The cell_layer argument is provided to make it easy to re-use an .update_proc implementation in this callback. Only the bounds and frame of the cell_layer are actually valid and other properties should be ignored.
See also
menu_layer_set_callbacks()
MenuLayerCallbacks

◆ OnDrawRow()

virtual void Pebble::MenuEvents::OnDrawRow ( const GContext ctx,
const Layer cell_layer,
const MenuIndex cell_index 
)
protectedpure virtual

Function signature for the callback to render the menu cell at a given MenuIndex.

Parameters
ctxThe destination graphics context to draw into
cell_layerThe cell's layer, containing the geometry of the cell
cell_indexThe MenuIndex of the cell that needs to be drawn
Note
The cell_layer argument is provided to make it easy to re-use an .update_proc implementation in this callback. Only the bounds and frame of the cell_layer are actually valid and other properties should be ignored.
See also
menu_layer_set_callbacks()
MenuLayerCallbacks

◆ OnDrawSeparator()

virtual void Pebble::MenuEvents::OnDrawSeparator ( const GContext ctx,
const Layer cell_layer,
const MenuIndex cell_index 
)
inlineprotectedvirtual

Function signature for the callback to render the separator at a given MenuIndex.

Parameters
ctxThe destination graphics context to draw into
cell_layerThe cell's layer, containing the geometry of the cell
cell_indexThe MenuIndex of the separator that needs to be drawn
callback_contextThe callback context
Note
The cell_layer argument is provided to make it easy to re-use an .update_proc implementation in this callback. Only the bounds and frame of the cell_layer are actually valid and other properties should be ignored.
See also
menu_layer_set_callbacks()
MenuLayerCallbacks

◆ OnGetCellHeight()

virtual int16_t Pebble::MenuEvents::OnGetCellHeight ( const MenuIndex cell_index)
inlineprotectedvirtual

Function signature for the callback to get the height of the menu cell at a given index.

Parameters
menu_layerThe MenuLayer for which the data is requested
cell_indexThe MenuIndex for which the cell height is requested
callback_contextThe callback context
Returns
The height of the cell at the given MenuIndex
See also
menu_layer_set_callbacks()
MenuLayerCallbacks

◆ OnGetHeaderHeight()

virtual int16_t Pebble::MenuEvents::OnGetHeaderHeight ( uint16_t  section_index)
inlineprotectedvirtual

Event to get the height of the section header at a given section index.

Parameters
section_indexThe index of the section for which the header height is requested
Returns
The height of the section header at the given section index
See also
menu_layer_set_callbacks()
MenuLayerCallbacks

◆ OnGetNumRows()

virtual uint16_t Pebble::MenuEvents::OnGetNumRows ( uint16_t  section_index)
protectedpure virtual

Event to get the number of rows in a given section in a menu.

Parameters
section_indexThe index of the section of the menu for which the number of items it contains is requested
Returns
The number of rows in the given section in the menu
See also
menu_layer_set_callbacks()
MenuLayerCallbacks

◆ OnGetNumSections()

virtual uint16_t Pebble::MenuEvents::OnGetNumSections ( )
inlineprotectedvirtual

Event to get the number of sections in a menu.

Returns
The number of sections in the menu
See also
menu_layer_set_callbacks()
MenuLayerCallbacks

◆ OnGetSeparatorHeight()

virtual int16_t Pebble::MenuEvents::OnGetSeparatorHeight ( const MenuIndex cell_index)
inlineprotectedvirtual

Function signature for the callback to get the height of the separator at a given index.

Parameters
menu_layerThe MenuLayer for which the data is requested
cell_indexThe MenuIndex for which the cell height is requested
callback_contextThe callback context
Returns
The height of the separator at the given MenuIndex
See also
menu_layer_set_callbacks()
MenuLayerCallbacks

◆ OnSelectClick()

virtual void Pebble::MenuEvents::OnSelectClick ( const MenuIndex cell_index)
inlineprotectedvirtual

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

Parameters
cell_indexThe MenuIndex of the cell that is selected
See also
menu_layer_set_callbacks()
MenuLayerCallbacks

◆ OnSelectionChanged()

virtual void Pebble::MenuEvents::OnSelectionChanged ( const MenuIndex new_index,
const MenuIndex old_index 
)
inlineprotectedvirtual

Function signature for the callback to handle a change in the current selected item in the menu.

Parameters
new_indexThe MenuIndex of the new item that is selected now
old_indexThe MenuIndex of the old item that was selected before
See also
menu_layer_set_callbacks()
MenuLayerCallbacks

◆ OnSelectionWillChange()

virtual void Pebble::MenuEvents::OnSelectionWillChange ( MenuIndex new_index,
const MenuIndex old_index 
)
inlineprotectedvirtual

Function signature for the callback which allows or changes selection behavior of the menu. In order to change the cell that should be selected, modify the passed in new_index. Preventing the selection from changing, new_index can be assigned the value of old_index.

Parameters
menu_layerThe MenuLayer for which the selection event that occured
new_indexPointer to the index that the MenuLayer is going to change selection to.
old_indexThe index that is being unselected.
callback_contextThe callback context
Note
menu_layer_set_selected_index will not trigger this callback when the selection changes, but menu_layer_set_selected_next will.

◆ OnSelectLongClick()

virtual void Pebble::MenuEvents::OnSelectLongClick ( const MenuIndex cell_index)
inlineprotectedvirtual

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

Parameters
cell_indexThe MenuIndex of the cell that is selected
See also
menu_layer_set_callbacks()
MenuLayerCallbacks

The documentation for this class was generated from the following file: