summaryrefslogtreecommitdiff
path: root/src/gui/widgets/listbox.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-01-23 22:33:26 +0300
committerAndrei Karas <akaras@inbox.ru>2013-01-23 22:33:26 +0300
commitc3755c31222a7cd4e90f772eb88a992dd64f6c06 (patch)
treeca0240e6b8597276a3e761d3ba18d838d8a94bc5 /src/gui/widgets/listbox.cpp
parent533e703a2c394b9c4a0c0e2d7367dd5cc48c1502 (diff)
downloadmv-c3755c31222a7cd4e90f772eb88a992dd64f6c06.tar.gz
mv-c3755c31222a7cd4e90f772eb88a992dd64f6c06.tar.bz2
mv-c3755c31222a7cd4e90f772eb88a992dd64f6c06.tar.xz
mv-c3755c31222a7cd4e90f772eb88a992dd64f6c06.zip
Use in different listbox derived classes different xml skin.
Diffstat (limited to 'src/gui/widgets/listbox.cpp')
-rw-r--r--src/gui/widgets/listbox.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp
index 9eb5f23a2..b89fc9688 100644
--- a/src/gui/widgets/listbox.cpp
+++ b/src/gui/widgets/listbox.cpp
@@ -38,11 +38,10 @@
#include "debug.h"
float ListBox::mAlpha = 1.0;
-Skin *ListBox::mSkin = nullptr;
-int ListBox::mInstances = 0;
ListBox::ListBox(const Widget2 *const widget,
- gcn::ListModel *const listModel) :
+ gcn::ListModel *const listModel,
+ const std::string &skin) :
gcn::ListBox(listModel),
Widget2(widget),
mHighlightColor(getThemeColor(Theme::HIGHLIGHT)),
@@ -53,12 +52,9 @@ ListBox::ListBox(const Widget2 *const widget,
{
mForegroundColor = getThemeColor(Theme::LISTBOX);
- if (mInstances == 0)
- {
- if (Theme::instance())
- mSkin = Theme::instance()->load("listbox.xml", "");
- }
- mInstances ++;
+ Theme *const theme = Theme::instance();
+ if (theme)
+ mSkin = Theme::instance()->load(skin, "listbox.xml");
if (mSkin)
mPadding = mSkin->getPadding();
@@ -68,8 +64,7 @@ ListBox::ListBox(const Widget2 *const widget,
ListBox::~ListBox()
{
- mInstances --;
- if (mInstances == 0 && Theme::instance())
+ if (Theme::instance())
Theme::instance()->unload(mSkin);
}