From 6938df9b82239a23637181f0de6f478336a0c33e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 3 Sep 2013 21:03:23 +0300 Subject: show icon on protected items. --- data/graphics/gui/CMakeLists.txt | 1 + data/graphics/gui/Makefile.am | 1 + data/graphics/gui/lock.png | Bin 0 -> 391 bytes src/gui/widgets/itemcontainer.cpp | 12 ++++++++++++ src/gui/widgets/itemcontainer.h | 1 + 5 files changed, 15 insertions(+) create mode 100644 data/graphics/gui/lock.png diff --git a/data/graphics/gui/CMakeLists.txt b/data/graphics/gui/CMakeLists.txt index 439542f66..afb414b4c 100644 --- a/data/graphics/gui/CMakeLists.txt +++ b/data/graphics/gui/CMakeLists.txt @@ -36,6 +36,7 @@ SET (FILES keyboard_icon.xml label.xml listbox.xml + lock.png ministatus.xml mouse.png npc.xml diff --git a/data/graphics/gui/Makefile.am b/data/graphics/gui/Makefile.am index 710cf0688..c3c8f5990 100644 --- a/data/graphics/gui/Makefile.am +++ b/data/graphics/gui/Makefile.am @@ -39,6 +39,7 @@ gui_DATA = \ keyboard_icon.xml \ label.xml \ listbox.xml \ + lock.png \ ministatus.xml \ mouse.png \ npc.xml \ diff --git a/data/graphics/gui/lock.png b/data/graphics/gui/lock.png new file mode 100644 index 000000000..457195c7a Binary files /dev/null and b/data/graphics/gui/lock.png differ 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; -- cgit v1.2.3-60-g2f50