diff options
author | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2010-02-08 22:31:38 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2010-02-08 22:31:38 +0100 |
commit | bc5c031e43eff506c925682349dd2a52b89d6565 (patch) | |
tree | 6c429dfa2386fcde5e1e9b8f8994dc8bd77b0b2f /src/gui/widgets | |
parent | ed39c71b2b6b47931f352ca07b49f631d6bf713a (diff) | |
download | mana-client-bc5c031e43eff506c925682349dd2a52b89d6565.tar.gz mana-client-bc5c031e43eff506c925682349dd2a52b89d6565.tar.bz2 mana-client-bc5c031e43eff506c925682349dd2a52b89d6565.tar.xz mana-client-bc5c031e43eff506c925682349dd2a52b89d6565.zip |
Delete models explicitly rather than relying on booleans
It is more clear in the end. Also fixed deleting of the mode list model.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/dropdown.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/dropdown.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/listbox.cpp | 9 | ||||
-rw-r--r-- | src/gui/widgets/listbox.h | 4 |
4 files changed, 6 insertions, 13 deletions
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index 80c3747e..b8f5b895 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -43,10 +43,10 @@ Image *DropDown::buttons[2][2]; ImageRect DropDown::skin; float DropDown::mAlpha = 1.0; -DropDown::DropDown(gcn::ListModel *listModel, bool deleteModel): +DropDown::DropDown(gcn::ListModel *listModel): gcn::DropDown::DropDown(listModel, new ScrollArea, - new ListBox(listModel, deleteModel)) + new ListBox(listModel)) { setFrameSize(2); diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h index eda7b1fa..568e20a5 100644 --- a/src/gui/widgets/dropdown.h +++ b/src/gui/widgets/dropdown.h @@ -45,7 +45,7 @@ class DropDown : public gcn::DropDown * @param listBox the listBox to use. * @see ListModel, ScrollArea, ListBox. */ - DropDown(gcn::ListModel *listModel = NULL, bool deleteModel = false); + DropDown(gcn::ListModel *listModel = 0); ~DropDown(); diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp index e97f1d63..a24cf599 100644 --- a/src/gui/widgets/listbox.cpp +++ b/src/gui/widgets/listbox.cpp @@ -34,18 +34,13 @@ float ListBox::mAlpha = 1.0; -ListBox::ListBox(gcn::ListModel *listModel, bool deleteModel): - gcn::ListBox(listModel), - mDeleteModel(deleteModel) +ListBox::ListBox(gcn::ListModel *listModel): + gcn::ListBox(listModel) { } ListBox::~ListBox() { - if (mDeleteModel) - { - delete mListModel; - } } void ListBox::updateAlpha() diff --git a/src/gui/widgets/listbox.h b/src/gui/widgets/listbox.h index c0662ed2..ed17c6ad 100644 --- a/src/gui/widgets/listbox.h +++ b/src/gui/widgets/listbox.h @@ -39,7 +39,7 @@ class ListBox : public gcn::ListBox /** * Constructor. */ - ListBox(gcn::ListModel *listModel, bool deleteModel = false); + ListBox(gcn::ListModel *listModel); ~ListBox(); @@ -67,8 +67,6 @@ class ListBox : public gcn::ListBox private: static float mAlpha; - - bool mDeleteModel; }; #endif |