forked from teamnwah/openmw-tes3coop
ItemWidget: skip setImageTexture if the icon has not changed
This commit is contained in:
parent
5f2539adb6
commit
7201cf5fe2
2 changed files with 20 additions and 5 deletions
|
@ -67,20 +67,30 @@ namespace MWGui
|
|||
|
||||
void ItemWidget::setIcon(const std::string &icon)
|
||||
{
|
||||
if (mItemShadow)
|
||||
mItemShadow->setImageTexture(icon);
|
||||
if (mItem)
|
||||
mItem->setImageTexture(icon);
|
||||
if (mCurrentIcon != icon)
|
||||
{
|
||||
mCurrentIcon = icon;
|
||||
|
||||
if (mItemShadow)
|
||||
mItemShadow->setImageTexture(icon);
|
||||
if (mItem)
|
||||
mItem->setImageTexture(icon);
|
||||
}
|
||||
}
|
||||
|
||||
void ItemWidget::setFrame(const std::string &frame, const MyGUI::IntCoord &coord)
|
||||
{
|
||||
if (mFrame)
|
||||
{
|
||||
mFrame->setImageTexture(frame);
|
||||
mFrame->setImageTile(MyGUI::IntSize(coord.width, coord.height)); // Why is this needed? MyGUI bug?
|
||||
mFrame->setImageCoord(coord);
|
||||
}
|
||||
|
||||
if (mCurrentFrame != frame)
|
||||
{
|
||||
mCurrentFrame = frame;
|
||||
mFrame->setImageTexture(frame);
|
||||
}
|
||||
}
|
||||
|
||||
void ItemWidget::setIcon(const MWWorld::Ptr &ptr)
|
||||
|
@ -105,6 +115,8 @@ namespace MWGui
|
|||
mItemShadow->setImageTexture("");
|
||||
mItem->setImageTexture("");
|
||||
mText->setCaption("");
|
||||
mCurrentIcon.clear();
|
||||
mCurrentFrame.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,6 +47,9 @@ namespace MWGui
|
|||
MyGUI::ImageBox* mItemShadow;
|
||||
MyGUI::ImageBox* mFrame;
|
||||
MyGUI::TextBox* mText;
|
||||
|
||||
std::string mCurrentIcon;
|
||||
std::string mCurrentFrame;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue