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)
|
void ItemWidget::setIcon(const std::string &icon)
|
||||||
{
|
{
|
||||||
|
if (mCurrentIcon != icon)
|
||||||
|
{
|
||||||
|
mCurrentIcon = icon;
|
||||||
|
|
||||||
if (mItemShadow)
|
if (mItemShadow)
|
||||||
mItemShadow->setImageTexture(icon);
|
mItemShadow->setImageTexture(icon);
|
||||||
if (mItem)
|
if (mItem)
|
||||||
mItem->setImageTexture(icon);
|
mItem->setImageTexture(icon);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ItemWidget::setFrame(const std::string &frame, const MyGUI::IntCoord &coord)
|
void ItemWidget::setFrame(const std::string &frame, const MyGUI::IntCoord &coord)
|
||||||
{
|
{
|
||||||
if (mFrame)
|
if (mFrame)
|
||||||
{
|
{
|
||||||
mFrame->setImageTexture(frame);
|
|
||||||
mFrame->setImageTile(MyGUI::IntSize(coord.width, coord.height)); // Why is this needed? MyGUI bug?
|
mFrame->setImageTile(MyGUI::IntSize(coord.width, coord.height)); // Why is this needed? MyGUI bug?
|
||||||
mFrame->setImageCoord(coord);
|
mFrame->setImageCoord(coord);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mCurrentFrame != frame)
|
||||||
|
{
|
||||||
|
mCurrentFrame = frame;
|
||||||
|
mFrame->setImageTexture(frame);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ItemWidget::setIcon(const MWWorld::Ptr &ptr)
|
void ItemWidget::setIcon(const MWWorld::Ptr &ptr)
|
||||||
|
@ -105,6 +115,8 @@ namespace MWGui
|
||||||
mItemShadow->setImageTexture("");
|
mItemShadow->setImageTexture("");
|
||||||
mItem->setImageTexture("");
|
mItem->setImageTexture("");
|
||||||
mText->setCaption("");
|
mText->setCaption("");
|
||||||
|
mCurrentIcon.clear();
|
||||||
|
mCurrentFrame.clear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,9 @@ namespace MWGui
|
||||||
MyGUI::ImageBox* mItemShadow;
|
MyGUI::ImageBox* mItemShadow;
|
||||||
MyGUI::ImageBox* mFrame;
|
MyGUI::ImageBox* mFrame;
|
||||||
MyGUI::TextBox* mText;
|
MyGUI::TextBox* mText;
|
||||||
|
|
||||||
|
std::string mCurrentIcon;
|
||||||
|
std::string mCurrentFrame;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue