Add drop shadow to ItemWidget (Fixes #3545)

coverity_scan^2
scrawl 8 years ago
parent 15046c961b
commit 612c3e995f

@ -28,6 +28,7 @@ namespace MWGui
ItemWidget::ItemWidget() ItemWidget::ItemWidget()
: mItem(NULL) : mItem(NULL)
, mItemShadow(NULL)
, mFrame(NULL) , mFrame(NULL)
, mText(NULL) , mText(NULL)
{ {
@ -44,6 +45,9 @@ namespace MWGui
assignWidget(mItem, "Item"); assignWidget(mItem, "Item");
if (mItem) if (mItem)
mItem->setNeedMouseFocus(false); mItem->setNeedMouseFocus(false);
assignWidget(mItemShadow, "ItemShadow");
if (mItemShadow)
mItemShadow->setNeedMouseFocus(false);
assignWidget(mFrame, "Frame"); assignWidget(mFrame, "Frame");
if (mFrame) if (mFrame)
mFrame->setNeedMouseFocus(false); mFrame->setNeedMouseFocus(false);
@ -63,6 +67,8 @@ namespace MWGui
void ItemWidget::setIcon(const std::string &icon) void ItemWidget::setIcon(const std::string &icon)
{ {
if (mItemShadow)
mItemShadow->setImageTexture(icon);
if (mItem) if (mItem)
mItem->setImageTexture(icon); mItem->setImageTexture(icon);
} }

@ -44,6 +44,7 @@ namespace MWGui
virtual void initialiseOverride(); virtual void initialiseOverride();
MyGUI::ImageBox* mItem; MyGUI::ImageBox* mItem;
MyGUI::ImageBox* mItemShadow;
MyGUI::ImageBox* mFrame; MyGUI::ImageBox* mFrame;
MyGUI::TextBox* mText; MyGUI::TextBox* mText;
}; };

@ -120,6 +120,10 @@
<Property key="TextShadow" value="true"/> <Property key="TextShadow" value="true"/>
</Widget> </Widget>
<Widget type="ImageBox" skin="ImageBox" position="5 5 32 32" align="Stretch" name="Item"/> <Widget type="ImageBox" skin="ImageBox" position="5 5 32 32" align="Stretch" name="Item"/>
<Widget type="ImageBox" skin="ImageBox" position="9 9 32 32" align="Stretch" name="ItemShadow">
<Property key="Colour" value="0 0 0"/>
<Property key="Alpha" value="0.5"/>
</Widget>
</Widget> </Widget>
</Widget> </Widget>
</Resource> </Resource>

Loading…
Cancel
Save