Skip to content

Commit 870a283

Browse files
committed
Menus: add deleteChilds()
1 parent 9891fed commit 870a283

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

libraries/menus/menus.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@ void subMenu::appendChild(abstractMenuEntry *child)
2828
}
2929
}
3030

31+
void subMenu::deleteChilds()
32+
{
33+
while (m_children) {
34+
abstractMenuEntry *e = m_children;
35+
m_children = m_children->getNext();
36+
delete(e);
37+
}
38+
}
39+
3140
abstractMenuEntry* subMenu::at(int index)
3241
{
3342
abstractMenuEntry *c = NULL;

libraries/menus/menus.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ struct subMenu: public abstractMenuEntry
3838
virtual bool isSubmenu() const { return true; }
3939
abstractMenuEntry *getChild() { return m_children; }
4040
void appendChild(abstractMenuEntry *child);
41+
void deleteChilds();
4142
void setParent(abstractMenuEntry *parent) { m_parent=parent; }
4243
abstractMenuEntry *getParent() const { return m_parent; }
4344
abstractMenuEntry *at(int index);

0 commit comments

Comments
 (0)