Public Member Functions | List of all members
MenuItemIterator Class Reference

#include <MenuIterator.h>

Public Member Functions

void setPredicate (MenuItemPredicate *predicate)
void reset ()
MenuItemnextItem ()
MenuItemcurrentParent ()

Detailed Description

This provides a way to non recursively iterate through the entire menu structure. Each call to nextItem() finds the next item that matches the predicate, traversing through submenus if needed. This has a limitation of traversing only up to MAX_MENU_DEPTH levels of menus. Adjust this value in MenuIterator.h to support more menu levels.

Member Function Documentation

◆ setPredicate()

void MenuItemIterator::setPredicate ( MenuItemPredicate predicate)

Set the predicate that will be used on subsequent calls

predicatea predicate that will filter returned results.

◆ reset()

void MenuItemIterator::reset ( )

Reset the state so that the next call to nextItem() returns the first

◆ nextItem()

MenuItem * MenuItemIterator::nextItem ( )

Gets the next menu item in this iterators order, filtered by the current predicate. When the last item is passed this iterator returns NULL and then calls reset().

the next item or NULL when the end is reached.

◆ currentParent()

MenuItem * MenuItemIterator::currentParent ( )

Returns the parent of the item that will be returned by nextItem(), always call AFTER calling nextItem() as next item will possibly alter this value. Result will be NULL when there is no parent (root). The result when not null will be the nearest submenu.

the parent of the next item or NULL for root, must be called before nextItem().

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