Provides a number of utility functions for the processing of menu item structures. More...
Go to the source code of this file.
Classes | |
class | MenuItemPredicate |
class | RemoteNoMenuItemPredicate |
class | MenuItemTypePredicate |
class | MenuItemIterator |
Typedefs | |
typedef void(* | MenuVisitorFn) (MenuItem *item) |
Functions | |
MenuItem * | getParentRootAndVisit (MenuItem *current, MenuVisitorFn visitor) |
MenuItem * | getParentRoot (MenuItem *current) |
MenuItem * | getSubMenuFor (MenuItem *current) |
MenuItem * | getMenuItemById (menuid_t id) |
int | offsetOfCurrentActive (MenuItem *root) |
int | offsetOfItem (MenuItem *itemToFind) |
uint8_t | itemCount (MenuItem *item, bool includeNonVisble=false) |
Provides a number of utility functions for the processing of menu item structures.
typedef void(* MenuVisitorFn) (MenuItem *item) |
defines a function used when needing to visit all menu items
MenuItem* getParentRootAndVisit | ( | MenuItem * | current, |
MenuVisitorFn | visitor | ||
) |
Finds the parent root menu item to the item that's passed in, that is the root item that contains this menu item. Normally used by protocol and display layers when there's a need to traverse the menu structure. This version is also able to provide a function that will visit each element in the tree. It will always visit every item.
current | the menu item that is currently menu root |
Finds the parent root menu item to the item that's passed in, that is the root item that contains this menu item. This version will short circuit out of the traversal as soon as the item is found. Never returns NULL.
current | the menu item that is currently menu root |
Finds the submenu that a particular menu item belongs to, or nullptr
current | the menuitem that we are searching for |
MenuItem* getMenuItemById | ( | menuid_t | id | ) |
Gets the first match by ID of a menu item in the menu structure.
the | ID to locate the menu item for |
int offsetOfCurrentActive | ( | MenuItem * | root | ) |
Gets the zero based offset of the active item in the menu provided
root | the root of the current menu |
int offsetOfItem | ( | MenuItem * | itemToFind | ) |
Get the offset in the menu of the given item, but safely returns 0 if not the item is not found
itemToFind | the item to be found |
uint8_t itemCount | ( | MenuItem * | item, |
bool | includeNonVisble = false |
||
) |
returns the number of items in the current menu described by itemCount
item | the root item of the menu to be counted. |
includeNonVisble | include menu items that are not marked visible |