diff options
-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; |