Library for creating menu systems in displays.

Dependents:   VS1053Player

Embed: (wiki syntax)

« Back to documentation index

MenuNode Class Reference

MenuNode Class Reference

MenuNode represents an entry in a menu. More...

#include <Menu.h>

Inherited by Menu.

Public Types

typedef void(* SelectionChange )(MenuNode *)
 Defines a pointer to a functions that is called when the node is selected.

Public Member Functions

 MenuNode (EnterMenuNode, SelectionChange, char *)
 Constructs a new MenuNode object.
char * getName ()
 Gets the name of the node.
virtual void enter ()
 Enters this instance of MenuNode and ultimatley calls the entered callback function.
bool isSelected ()
 Determines wheter tgis instance is selected.
void select ()
 Selects this instance of MenuNode in its containing Menu and called the selected call back function.

Friends

class Menu

Detailed Description

MenuNode represents an entry in a menu.

Each menu node is instantiated with two callbacks, one for selecting the node and one for entering the node. Methods are provided for determining whether the node is selected and retrieving the row number set by the containing menu.

Definition at line 13 of file Menu.h.


Member Typedef Documentation

typedef void(* SelectionChange)(MenuNode *)

Defines a pointer to a functions that is called when the node is selected.

Definition at line 25 of file Menu.h.


Constructor & Destructor Documentation

MenuNode ( EnterMenuNode  enterAction,
SelectionChange  selectionChangeAct,
char *  newname 
)

Constructs a new MenuNode object.

The constructor takes two function pointers as arguments both of which must take a single argument of a MenuNode pointer.

  void enterNode(MenuNode *node) {

  }

  void selectNode(MenuNode *node) {

  }

  main() {
     MenuNode *node = new MenuNode(&enterNode, &selectNode, "name");
  }
Parameters:
EnterMenuNodeA pointer to a callback fuction called when the node is entered.
SelectionChangeA pointer to a callback fuction called when the node is selected.
nameThe name of the MenuNode.

Definition at line 59 of file Menu.cpp.


Member Function Documentation

void enter (  ) [virtual]

Enters this instance of MenuNode and ultimatley calls the entered callback function.

Reimplemented in Menu.

Definition at line 73 of file Menu.cpp.

char * getName (  )

Gets the name of the node.

Returns:
A char array containing the node name.

Definition at line 77 of file Menu.cpp.

bool isSelected (  )

Determines wheter tgis instance is selected.

Returns:
true if selected.

Definition at line 86 of file Menu.cpp.

void select (  )

Selects this instance of MenuNode in its containing Menu and called the selected call back function.

Definition at line 81 of file Menu.cpp.