diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-07-27 02:38:38 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-07-27 02:38:38 +0300 |
commit | de43e2592dfce797245e63e865a0f8e8567b4ac7 (patch) | |
tree | 4d7fdbf2095767a47a085667e3438f2edd6cabef /src | |
parent | 0419f9b7ea98b9de36b6af97fccd964d3cda4750 (diff) | |
download | manaplus-de43e2592dfce797245e63e865a0f8e8567b4ac7.tar.gz manaplus-de43e2592dfce797245e63e865a0f8e8567b4ac7.tar.bz2 manaplus-de43e2592dfce797245e63e865a0f8e8567b4ac7.tar.xz manaplus-de43e2592dfce797245e63e865a0f8e8567b4ac7.zip |
Remove all pages after status window deleted.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/windows/statuswindow.cpp | 13 | ||||
-rw-r--r-- | src/gui/windows/statuswindow.h | 5 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp index 57ca97206..6106372bf 100644 --- a/src/gui/windows/statuswindow.cpp +++ b/src/gui/windows/statuswindow.cpp @@ -52,6 +52,8 @@ #include "resources/item/item.h" +#include "utils/delete2.h" +#include "utils/dtor.h" #include "utils/gettext.h" #include "debug.h" @@ -64,6 +66,7 @@ StatusWindow::StatusWindow() : ActionListener(), AttributeListener(), StatListener(), + mPages(), mTabs(CREATEWIDGETR(TabbedArea, this)), // TRANSLATORS: status window label mLvlLabel(new Label(this, strprintf(_("Level: %d"), 0))), @@ -211,6 +214,12 @@ StatusWindow::StatusWindow() : addTabs(); } +StatusWindow::~StatusWindow() +{ + delete2(mBasicStatsPage); + delete_all(mPages); +} + void StatusWindow::addTabs() { // TRANSLATORS: status window tab name @@ -225,8 +234,10 @@ void StatusWindow::addTabs() void StatusWindow::addTab(const std::string &name) { + StatsPage *const page = new StatsPage(this, name); mTabs->addTab(name, - new StatsPage(this, name)); + page); + mPages.push_back(page); } void StatusWindow::addTabBasic(const std::string &name) diff --git a/src/gui/windows/statuswindow.h b/src/gui/windows/statuswindow.h index 2bb457acf..ecb7c604a 100644 --- a/src/gui/windows/statuswindow.h +++ b/src/gui/windows/statuswindow.h @@ -34,6 +34,7 @@ class Button; class Label; class ProgressBar; class ScrollArea; +class StatsPage; class StatsPageBasic; class TabbedArea; class VertContainer; @@ -56,6 +57,8 @@ class StatusWindow final : public Window, A_DELETE_COPY(StatusWindow) + ~StatusWindow(); + void setPointsNeeded(const AttributesT id, const int needed); @@ -100,6 +103,8 @@ class StatusWindow final : public Window, static std::string translateLetter(const char *const letters); static std::string translateLetter2(const std::string &letters); + std::vector<StatsPage*> mPages; + TabbedArea *mTabs A_NONNULLPOINTER; Label *mLvlLabel A_NONNULLPOINTER; Label *mMoneyLabel A_NONNULLPOINTER; |