summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-09-03 21:03:23 +0300
committerAndrei Karas <akaras@inbox.ru>2013-09-03 21:03:23 +0300
commit6938df9b82239a23637181f0de6f478336a0c33e (patch)
tree5f4558276759b8c959ea4e6352bca9a8f6732c6e /src/gui/widgets
parent85accb7f6f5fdfa9f5861ef364be51be37b34513 (diff)
downloadmv-6938df9b82239a23637181f0de6f478336a0c33e.tar.gz
mv-6938df9b82239a23637181f0de6f478336a0c33e.tar.bz2
mv-6938df9b82239a23637181f0de6f478336a0c33e.tar.xz
mv-6938df9b82239a23637181f0de6f478336a0c33e.zip
show icon on protected items.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/itemcontainer.cpp12
-rw-r--r--src/gui/widgets/itemcontainer.h1
2 files changed, 13 insertions, 0 deletions
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 99aedabcd..5ed03c516 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -166,6 +166,7 @@ ItemContainer::ItemContainer(const Widget2 *const widget,
gcn::WidgetListener(),
mInventory(inventory),
mSelImg(Theme::getImageFromThemeXml("item_selection.xml", "")),
+ mProtectedImg(Theme::getImageFromTheme("lock.png")),
mName(),
mItemPopup(new ItemPopup),
mShowMatrix(nullptr),
@@ -211,6 +212,12 @@ ItemContainer::~ItemContainer()
mSelImg->decRef();
mSelImg = nullptr;
}
+ if (mProtectedImg)
+ {
+ mProtectedImg->decRef();
+ mProtectedImg = nullptr;
+ }
+
if (Theme::instance())
Theme::instance()->unload(mSkin);
@@ -278,6 +285,11 @@ void ItemContainer::draw(gcn::Graphics *graphics)
image->setAlpha(1.0f); // ensure the image if fully drawn...
g->drawImage(image, itemX + mPaddingItemX,
itemY + mPaddingItemY);
+ if (mProtectedImg && PlayerInfo::isItemProtected(item->getId()))
+ {
+ g->drawImage(mProtectedImg, itemX + mPaddingItemX,
+ itemY + mPaddingItemY);
+ }
}
}
}
diff --git a/src/gui/widgets/itemcontainer.h b/src/gui/widgets/itemcontainer.h
index da9167a7e..d17261c1c 100644
--- a/src/gui/widgets/itemcontainer.h
+++ b/src/gui/widgets/itemcontainer.h
@@ -194,6 +194,7 @@ class ItemContainer final : public gcn::Widget,
Inventory *mInventory;
Image *mSelImg;
+ Image *mProtectedImg;
std::string mName;
ItemPopup *mItemPopup;