diff options
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/itemcontainer.cpp | 14 | ||||
-rw-r--r-- | src/gui/widgets/itemlinkhandler.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/setuptabscroll.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/shoplistbox.cpp | 28 | ||||
-rw-r--r-- | src/gui/widgets/shoplistbox.h | 4 | ||||
-rw-r--r-- | src/gui/widgets/textpreview.cpp | 12 | ||||
-rw-r--r-- | src/gui/widgets/textpreview.h | 2 |
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 |