From fdee206d9313d2e5a88c9351405403c8e4559bb4 Mon Sep 17 00:00:00 2001 From: Ayla Date: Thu, 15 Sep 2011 20:12:02 +0200 Subject: [PATCH] The ButtonBox now features a clear() function which empties the list of buttons. --- src/buttonbox.cpp | 8 ++++++-- src/buttonbox.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/buttonbox.cpp b/src/buttonbox.cpp index 0a8d112..af2791f 100644 --- a/src/buttonbox.cpp +++ b/src/buttonbox.cpp @@ -10,8 +10,7 @@ ButtonBox::ButtonBox(GMenu2X *gmenu2x) : gmenu2x(gmenu2x) ButtonBox::~ButtonBox() { - for (ButtonList::const_iterator it = buttons.begin(); it != buttons.end(); ++it) - delete *it; + clear(); } void ButtonBox::add(Button *button) @@ -19,6 +18,11 @@ void ButtonBox::add(Button *button) buttons.push_back(button); } +void ButtonBox::clear() +{ + buttons.clear(); +} + void ButtonBox::paint(unsigned int posX) { for (ButtonList::const_iterator it = buttons.begin(); it != buttons.end(); ++it) diff --git a/src/buttonbox.h b/src/buttonbox.h index e96316a..52a8e4b 100644 --- a/src/buttonbox.h +++ b/src/buttonbox.h @@ -13,6 +13,7 @@ public: ~ButtonBox(); void add(Button *button); + void clear(); void paint(unsigned int posX); void handleTS();