summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-01-08 13:47:32 +0300
committerAndrei Karas <akaras@inbox.ru>2014-01-08 14:39:55 +0300
commit0975dc4cd9012b098061f0201028896d578649f8 (patch)
treeccb3991a51ef9de47877a7d2549664d0f0ae4f79 /src/gui/widgets
parent4a823c0ba94c620bd0e51fc61f22c068661946cf (diff)
downloadmanaplus-0975dc4cd9012b098061f0201028896d578649f8.tar.gz
manaplus-0975dc4cd9012b098061f0201028896d578649f8.tar.bz2
manaplus-0975dc4cd9012b098061f0201028896d578649f8.tar.xz
manaplus-0975dc4cd9012b098061f0201028896d578649f8.zip
Remove duplicate variables from some classes.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/colorpage.cpp6
-rw-r--r--src/gui/widgets/colorpage.h4
-rw-r--r--src/gui/widgets/progressbar.cpp9
-rw-r--r--src/gui/widgets/progressbar.h2
-rw-r--r--src/gui/widgets/shoplistbox.cpp6
-rw-r--r--src/gui/widgets/shoplistbox.h10
6 files changed, 10 insertions, 27 deletions
diff --git a/src/gui/widgets/colorpage.cpp b/src/gui/widgets/colorpage.cpp
index ee5a37c3c..11dd1f07e 100644
--- a/src/gui/widgets/colorpage.cpp
+++ b/src/gui/widgets/colorpage.cpp
@@ -29,10 +29,10 @@
ColorPage::ColorPage(const Widget2 *const widget,
gcn::ListModel *const listModel,
const std::string &skin) :
- ListBox(widget, listModel, skin),
- mItemPadding(mSkin ? mSkin->getOption("itemPadding") : 1),
- mRowHeight(13)
+ ListBox(widget, listModel, skin)
{
+ mItemPadding = mSkin ? mSkin->getOption("itemPadding") : 1;
+ mRowHeight = 13;
const gcn::Font *const font = getFont();
if (font)
mRowHeight = font->getHeight() + 2 * mItemPadding;
diff --git a/src/gui/widgets/colorpage.h b/src/gui/widgets/colorpage.h
index 06699cbbd..c1c90eddf 100644
--- a/src/gui/widgets/colorpage.h
+++ b/src/gui/widgets/colorpage.h
@@ -41,10 +41,6 @@ class ColorPage final : public ListBox
void resetAction();
void adjustSize() override final;
-
- private:
- int mItemPadding;
- unsigned int mRowHeight;
};
#endif // GUI_WIDGETS_COLORPAGE_H
diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp
index 97c29bd8c..6454cf47a 100644
--- a/src/gui/widgets/progressbar.cpp
+++ b/src/gui/widgets/progressbar.cpp
@@ -46,10 +46,6 @@ ProgressBar::ProgressBar(const Widget2 *const widget, float progress,
mSkin(nullptr),
mProgress(progress),
mProgressToGo(progress),
- mBackgroundColor(Theme::getProgressColor(backColor >= 0
- ? backColor : 0, mProgress)),
- mBackgroundColorToGo(mBackgroundColor),
- mForegroundColor2(getThemeColor(Theme::PROGRESS_BAR_OUTLINE)),
mText(),
mVertexes(new ImageCollection),
mProgressPalette(backColor),
@@ -60,6 +56,11 @@ ProgressBar::ProgressBar(const Widget2 *const widget, float progress,
mSmoothColorChange(true),
mRedraw(true)
{
+ mBackgroundColor = Theme::getProgressColor(backColor >= 0
+ ? backColor : 0, mProgress);
+ mBackgroundColorToGo = mBackgroundColor;
+ mForegroundColor2 = getThemeColor(Theme::PROGRESS_BAR_OUTLINE);
+
// The progress value is directly set at load time:
if (mProgress > 1.0F || mProgress < 0.0F)
mProgress = 1.0F;
diff --git a/src/gui/widgets/progressbar.h b/src/gui/widgets/progressbar.h
index 9e503526c..eefabe83a 100644
--- a/src/gui/widgets/progressbar.h
+++ b/src/gui/widgets/progressbar.h
@@ -144,9 +144,7 @@ class ProgressBar final : public gcn::Widget,
float mProgress;
float mProgressToGo;
- gcn::Color mBackgroundColor;
gcn::Color mBackgroundColorToGo;
- gcn::Color mForegroundColor2;
std::string mText;
ImageCollection *mVertexes;
diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp
index 9b368a10c..58f9ec8eb 100644
--- a/src/gui/widgets/shoplistbox.cpp
+++ b/src/gui/widgets/shoplistbox.cpp
@@ -42,20 +42,18 @@
const int ITEM_ICON_SIZE = 32;
-float ShopListBox::mAlpha = 1.0;
-
ShopListBox::ShopListBox(const Widget2 *const widget,
gcn::ListModel *const listModel) :
ListBox(widget, listModel, "shoplistbox.xml"),
mPlayerMoney(0),
mShopItems(nullptr),
mItemPopup(new ItemPopup),
- mRowHeight(getFont()->getHeight()),
mBackgroundColor(getThemeColor(Theme::BACKGROUND)),
mWarningColor(getThemeColor(Theme::SHOP_WARNING)),
mPriceCheck(true),
mProtectItems(false)
{
+ mRowHeight = getFont()->getHeight();
mItemPopup->postInit();
mHighlightColor = getThemeColor(Theme::HIGHLIGHT);
mForegroundColor = getThemeColor(Theme::LISTBOX);
@@ -68,12 +66,12 @@ ShopListBox::ShopListBox(const Widget2 *const widget,
mPlayerMoney(0),
mShopItems(shopListModel),
mItemPopup(new ItemPopup),
- mRowHeight(std::max(getFont()->getHeight(), ITEM_ICON_SIZE)),
mBackgroundColor(getThemeColor(Theme::BACKGROUND)),
mWarningColor(getThemeColor(Theme::SHOP_WARNING)),
mPriceCheck(true),
mProtectItems(false)
{
+ mRowHeight = std::max(getFont()->getHeight(), ITEM_ICON_SIZE);
mItemPopup->postInit();
mHighlightColor = getThemeColor(Theme::HIGHLIGHT);
mForegroundColor = getThemeColor(Theme::LISTBOX);
diff --git a/src/gui/widgets/shoplistbox.h b/src/gui/widgets/shoplistbox.h
index 5cbc66158..095d187eb 100644
--- a/src/gui/widgets/shoplistbox.h
+++ b/src/gui/widgets/shoplistbox.h
@@ -59,12 +59,6 @@ class ShopListBox final : public ListBox
void draw(gcn::Graphics *graphics) override final;
/**
- * Returns the height of a row.
- */
- unsigned int getRowHeight() const override final A_WARN_UNUSED
- { return mRowHeight; }
-
- /**
* gives information about the current player's money
*/
void setPlayersMoney(const int money);
@@ -100,15 +94,11 @@ class ShopListBox final : public ListBox
ItemPopup *mItemPopup;
- unsigned int mRowHeight; /**< Row Height */
-
gcn::Color mBackgroundColor;
gcn::Color mWarningColor;
bool mPriceCheck;
bool mProtectItems;
-
- static float mAlpha;
};
#endif // GUI_WIDGETS_SHOPLISTBOX_H