summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-06-06 00:04:33 +0300
committerAndrei Karas <akaras@inbox.ru>2012-06-06 00:04:33 +0300
commit7b155f111daf5d7ae477b16d0f0789b1113bea74 (patch)
tree2d2711ab1f9daed793171383af1a7e1fa6ff737c /src/gui/widgets
parentc3afff20d4989ab2835545715bbe67e5b5d9b353 (diff)
downloadmanaplus-7b155f111daf5d7ae477b16d0f0789b1113bea74.tar.gz
manaplus-7b155f111daf5d7ae477b16d0f0789b1113bea74.tar.bz2
manaplus-7b155f111daf5d7ae477b16d0f0789b1113bea74.tar.xz
manaplus-7b155f111daf5d7ae477b16d0f0789b1113bea74.zip
Fix some issues after auto checking.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/itemcontainer.cpp14
-rw-r--r--src/gui/widgets/itemlinkhandler.cpp4
-rw-r--r--src/gui/widgets/setuptabscroll.cpp4
-rw-r--r--src/gui/widgets/shoplistbox.cpp28
-rw-r--r--src/gui/widgets/shoplistbox.h4
-rw-r--r--src/gui/widgets/textpreview.cpp12
-rw-r--r--src/gui/widgets/textpreview.h2
7 files changed, 35 insertions, 33 deletions
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index c46131379..5994b1e1a 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -61,10 +61,9 @@ static const int BOX_HEIGHT = 43;
class ItemIdPair
{
public:
- ItemIdPair(int id, Item* item)
+ ItemIdPair(int id, Item* item) :
+ mId(id), mItem(item)
{
- mId = id;
- mItem = item;
}
int mId;
@@ -166,18 +165,17 @@ ItemContainer::ItemContainer(Inventory *inventory, bool forceQuantity):
mDescItems(false),
mTag(0),
mSortType(0),
- mShowMatrix(nullptr)
+ mItemPopup(new ItemPopup),
+ mShowMatrix(nullptr),
+ mEquipedColor(Theme::getThemeColor(Theme::ITEM_EQUIPPED)),
+ mUnEquipedColor(Theme::getThemeColor(Theme::ITEM_NOT_EQUIPPED))
{
- mItemPopup = new ItemPopup;
setFocusable(true);
mSelImg = Theme::getImageFromTheme("selection.png");
if (!mSelImg)
logger->log1("Error: Unable to load selection.png");
- mEquipedColor = Theme::getThemeColor(Theme::ITEM_EQUIPPED);
- mUnEquipedColor = Theme::getThemeColor(Theme::ITEM_NOT_EQUIPPED);
-
addKeyListener(this);
addMouseListener(this);
addWidgetListener(this);
diff --git a/src/gui/widgets/itemlinkhandler.cpp b/src/gui/widgets/itemlinkhandler.cpp
index 61d929f0b..98d820164 100644
--- a/src/gui/widgets/itemlinkhandler.cpp
+++ b/src/gui/widgets/itemlinkhandler.cpp
@@ -34,9 +34,9 @@
#include "debug.h"
-ItemLinkHandler::ItemLinkHandler()
+ItemLinkHandler::ItemLinkHandler() :
+ mItemPopup(new ItemPopup)
{
- mItemPopup = new ItemPopup;
}
ItemLinkHandler::~ItemLinkHandler()
diff --git a/src/gui/widgets/setuptabscroll.cpp b/src/gui/widgets/setuptabscroll.cpp
index 13c2668f5..d7ff749d2 100644
--- a/src/gui/widgets/setuptabscroll.cpp
+++ b/src/gui/widgets/setuptabscroll.cpp
@@ -29,10 +29,10 @@
SetupTabScroll::SetupTabScroll() :
SetupTab(),
+ mContainer(new VertContainer(25, false, 8)),
+ mScroll(new ScrollArea(mContainer)),
mPreferredFirstItemSize(200)
{
- mContainer = new VertContainer(25, false, 8);
- mScroll = new ScrollArea(mContainer);
mScroll->setOpaque(false);
mScroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER);
mScroll->setVerticalScrollPolicy(ScrollArea::SHOW_AUTO);
diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp
index ab6400149..3031460c4 100644
--- a/src/gui/widgets/shoplistbox.cpp
+++ b/src/gui/widgets/shoplistbox.cpp
@@ -47,29 +47,33 @@ float ShopListBox::mAlpha = 1.0;
ShopListBox::ShopListBox(gcn::ListModel *listModel):
ListBox(listModel),
mPlayerMoney(0),
- mShopItems(nullptr)
+ mShopItems(nullptr),
+ mItemPopup(new ItemPopup),
+ mRowHeight(getFont()->getHeight()),
+ mPriceCheck(true),
+ mHighlightColor(Theme::getThemeColor(Theme::HIGHLIGHT)),
+ mBackgroundColor(Theme::getThemeColor(Theme::BACKGROUND)),
+ mWarningColor(Theme::getThemeColor(Theme::SHOP_WARNING))
{
- mRowHeight = getFont()->getHeight();
- init();
+ setForegroundColor(Theme::getThemeColor(Theme::TEXT));
}
ShopListBox::ShopListBox(gcn::ListModel *listModel, ShopItems *shopListModel):
ListBox(listModel),
mPlayerMoney(0),
- mShopItems(shopListModel)
+ mShopItems(shopListModel),
+ mItemPopup(new ItemPopup),
+ mRowHeight(std::max(getFont()->getHeight(), ITEM_ICON_SIZE)),
+ mPriceCheck(true),
+ mHighlightColor(Theme::getThemeColor(Theme::HIGHLIGHT)),
+ mBackgroundColor(Theme::getThemeColor(Theme::BACKGROUND)),
+ mWarningColor(Theme::getThemeColor(Theme::SHOP_WARNING))
{
- mRowHeight = std::max(getFont()->getHeight(), ITEM_ICON_SIZE);
- init();
+ setForegroundColor(Theme::getThemeColor(Theme::TEXT));
}
void ShopListBox::init()
{
- mPriceCheck = true;
- mItemPopup = new ItemPopup;
- mHighlightColor = Theme::getThemeColor(Theme::HIGHLIGHT);
- mBackgroundColor = Theme::getThemeColor(Theme::BACKGROUND);
- mWarningColor = Theme::getThemeColor(Theme::SHOP_WARNING);
- setForegroundColor(Theme::getThemeColor(Theme::TEXT));
}
void ShopListBox::setPlayersMoney(int money)
diff --git a/src/gui/widgets/shoplistbox.h b/src/gui/widgets/shoplistbox.h
index 694fdb92e..75598aa94 100644
--- a/src/gui/widgets/shoplistbox.h
+++ b/src/gui/widgets/shoplistbox.h
@@ -94,13 +94,13 @@ class ShopListBox : public ListBox
unsigned int mRowHeight; /**< Row Height */
- static float mAlpha;
-
bool mPriceCheck;
gcn::Color mHighlightColor;
gcn::Color mBackgroundColor;
gcn::Color mWarningColor;
+
+ static float mAlpha;
};
#endif // SHOPLISTBOX_H
diff --git a/src/gui/widgets/textpreview.cpp b/src/gui/widgets/textpreview.cpp
index f3ea962bc..36533864e 100644
--- a/src/gui/widgets/textpreview.cpp
+++ b/src/gui/widgets/textpreview.cpp
@@ -37,16 +37,16 @@
float TextPreview::mAlpha = 1.0;
TextPreview::TextPreview(const std::string &text):
+ mFont(gui->getFont()),
mText(text),
+ mTextColor(&Theme::getThemeColor(Theme::TEXT)),
+ mBGColor(&Theme::getThemeColor(Theme::BACKGROUND)),
+ mTextBGColor(nullptr),
+ mTextAlpha(false),
+ mOpaque(false),
mShadow(false),
mOutline(false)
{
- mTextAlpha = false;
- mFont = gui->getFont();
- mTextColor = &Theme::getThemeColor(Theme::TEXT);
- mTextBGColor = nullptr;
- mBGColor = &Theme::getThemeColor(Theme::BACKGROUND);
- mOpaque = false;
}
void TextPreview::draw(gcn::Graphics* graphics)
diff --git a/src/gui/widgets/textpreview.h b/src/gui/widgets/textpreview.h
index 81e27fd06..06c588215 100644
--- a/src/gui/widgets/textpreview.h
+++ b/src/gui/widgets/textpreview.h
@@ -121,11 +121,11 @@ class TextPreview : public gcn::Widget
const gcn::Color *mTextColor;
const gcn::Color *mBGColor;
const gcn::Color *mTextBGColor;
- static float mAlpha;
bool mTextAlpha;
bool mOpaque;
bool mShadow;
bool mOutline;
+ static float mAlpha;
};
#endif