Library for creating menu systems in displays.

Dependents:   VS1053Player

Files at this revision

API Documentation at this revision

Comitter:
ollie8
Date:
Thu May 30 07:29:33 2013 +0000
Parent:
8:4a276e420f73
Child:
10:af54763d3d21
Commit message:
Added Menu destructor

Changed in this revision

Menu.cpp Show annotated file Show diff for this revision Revisions of this file
Menu.h Show annotated file Show diff for this revision Revisions of this file
--- a/Menu.cpp	Thu May 30 07:21:22 2013 +0000
+++ b/Menu.cpp	Thu May 30 07:29:33 2013 +0000
@@ -15,6 +15,13 @@
     nodes = new MenuNode*[size];
 }
 
+Menu::~Menu() {
+    for (int i=0; i < sizeof(nodes); i++) {
+        delete nodes[i];
+    }
+    delete nodes;
+}
+
 void Menu::addMenuNode(MenuNode & node) {
     nodes[nodeCount] = &node;
     nodeCount++;
@@ -75,11 +82,7 @@
     selected = true;
     selection(this);
 }
-/*
-void MenuNode::deSelect() {
-    selected = false;
-}
-*/
+
 bool MenuNode::isSelected() {
     return selected;
 }
--- a/Menu.h	Thu May 30 07:21:22 2013 +0000
+++ b/Menu.h	Thu May 30 07:29:33 2013 +0000
@@ -109,6 +109,9 @@
      */
     Menu(EnterMenu, SelectionChange, char*, int);
     
+    /** Clears down all contained MenuNodes*/
+    ~Menu();
+    
     /** Adds the given node to the Menu. MenuNodes are ordered by the order in which they are added.
      * Note that a Menu is also a MenuNode meaning that a menu can bee added as a MenuNode to create a sub Menu.
      *