Accept a ConstPtr in ItemPtr tooltips

openmw-38
scrawl 9 years ago
parent 5a7bbbd508
commit 41c8ec56e0

@ -139,7 +139,7 @@ namespace MWGui
if (!iter->isEmpty()) if (!iter->isEmpty())
{ {
mApparatus.at (index)->setUserString ("ToolTipType", "ItemPtr"); mApparatus.at (index)->setUserString ("ToolTipType", "ItemPtr");
mApparatus.at (index)->setUserData (*iter); mApparatus.at (index)->setUserData (MWWorld::ConstPtr(*iter));
} }
} }
@ -207,9 +207,9 @@ namespace MWGui
continue; continue;
ingredient->setUserString("ToolTipType", "ItemPtr"); ingredient->setUserString("ToolTipType", "ItemPtr");
ingredient->setUserData(item); ingredient->setUserData(MWWorld::ConstPtr(item));
ingredient->setCount(ingredient->getUserData<MWWorld::Ptr>()->getRefData().getCount()); ingredient->setCount(ingredient->getUserData<MWWorld::ConstPtr>()->getRefData().getCount());
} }
mItemView->update(); mItemView->update();

@ -79,7 +79,7 @@ namespace MWGui
{ {
mSoulBox->setItem(gem); mSoulBox->setItem(gem);
mSoulBox->setUserString ("ToolTipType", "ItemPtr"); mSoulBox->setUserString ("ToolTipType", "ItemPtr");
mSoulBox->setUserData(gem); mSoulBox->setUserData(MWWorld::ConstPtr(gem));
mEnchanting.setSoulGem(gem); mEnchanting.setSoulGem(gem);
} }
} }
@ -97,7 +97,7 @@ namespace MWGui
mName->setCaption(item.getClass().getName(item)); mName->setCaption(item.getClass().getName(item));
mItemBox->setItem(item); mItemBox->setItem(item);
mItemBox->setUserString ("ToolTipType", "ItemPtr"); mItemBox->setUserString ("ToolTipType", "ItemPtr");
mItemBox->setUserData(item); mItemBox->setUserData(MWWorld::ConstPtr(item));
mEnchanting.setOldItem(item); mEnchanting.setOldItem(item);
} }
} }

@ -417,7 +417,7 @@ namespace MWGui
mSpellStatus->setProgressPosition(chargePercent); mSpellStatus->setProgressPosition(chargePercent);
mSpellBox->setUserString("ToolTipType", "ItemPtr"); mSpellBox->setUserString("ToolTipType", "ItemPtr");
mSpellBox->setUserData(item); mSpellBox->setUserData(MWWorld::ConstPtr(item));
mSpellImage->setItem(item); mSpellImage->setItem(item);
} }
@ -435,7 +435,7 @@ namespace MWGui
mWeapBox->clearUserStrings(); mWeapBox->clearUserStrings();
mWeapBox->setUserString("ToolTipType", "ItemPtr"); mWeapBox->setUserString("ToolTipType", "ItemPtr");
mWeapBox->setUserData(item); mWeapBox->setUserData(MWWorld::ConstPtr(item));
mWeapStatus->setProgressRange(100); mWeapStatus->setProgressRange(100);
mWeapStatus->setProgressPosition(durabilityPercent); mWeapStatus->setProgressPosition(durabilityPercent);

@ -87,11 +87,11 @@ void MerchantRepair::startRepair(const MWWorld::Ptr &actor)
currentY += 18; currentY += 18;
button->setUserString("Price", MyGUI::utility::toString(price)); button->setUserString("Price", MyGUI::utility::toString(price));
button->setUserData(*iter);
button->setCaptionWithReplacing(name); button->setCaptionWithReplacing(name);
button->setSize(button->getTextSize().width,18); button->setSize(button->getTextSize().width,18);
button->eventMouseWheel += MyGUI::newDelegate(this, &MerchantRepair::onMouseWheel); button->eventMouseWheel += MyGUI::newDelegate(this, &MerchantRepair::onMouseWheel);
button->setUserString("ToolTipType", "ItemPtr"); button->setUserString("ToolTipType", "ItemPtr");
button->setUserData(MWWorld::ConstPtr(*iter));
button->eventMouseButtonClick += MyGUI::newDelegate(this, &MerchantRepair::onRepairButtonClick); button->eventMouseButtonClick += MyGUI::newDelegate(this, &MerchantRepair::onRepairButtonClick);
} }
} }

@ -185,7 +185,7 @@ namespace MWGui
button->setItem(item, ItemWidget::Barter); button->setItem(item, ItemWidget::Barter);
button->setUserString ("ToolTipType", "ItemPtr"); button->setUserString ("ToolTipType", "ItemPtr");
button->setUserData(item); button->setUserData(MWWorld::ConstPtr(item));
if (mItemSelectionDialog) if (mItemSelectionDialog)
mItemSelectionDialog->setVisible(false); mItemSelectionDialog->setVisible(false);
@ -209,7 +209,7 @@ namespace MWGui
button->setIcon(item); button->setIcon(item);
button->setUserString ("ToolTipType", "ItemPtr"); button->setUserString ("ToolTipType", "ItemPtr");
button->setUserData(item); button->setUserData(MWWorld::ConstPtr(item));
if (mMagicSelectionDialog) if (mMagicSelectionDialog)
mMagicSelectionDialog->setVisible(false); mMagicSelectionDialog->setVisible(false);
@ -278,7 +278,7 @@ namespace MWGui
if (Misc::StringUtils::ciEqual(it->getCellRef().getRefId(), id)) if (Misc::StringUtils::ciEqual(it->getCellRef().getRefId(), id))
{ {
item = *it; item = *it;
button->setUserData(item); button->setUserData(MWWorld::ConstPtr(item));
break; break;
} }
} }

@ -56,7 +56,7 @@ void Recharge::start (const MWWorld::Ptr &item)
{ {
mGemIcon->setItem(item); mGemIcon->setItem(item);
mGemIcon->setUserString("ToolTipType", "ItemPtr"); mGemIcon->setUserString("ToolTipType", "ItemPtr");
mGemIcon->setUserData(item); mGemIcon->setUserData(MWWorld::ConstPtr(item));
updateView(); updateView();
} }
@ -116,7 +116,7 @@ void Recharge::updateView()
"MW_ItemIconSmall", MyGUI::IntCoord(16, currentY, 32, 32), MyGUI::Align::Default); "MW_ItemIconSmall", MyGUI::IntCoord(16, currentY, 32, 32), MyGUI::Align::Default);
icon->setItem(*iter); icon->setItem(*iter);
icon->setUserString("ToolTipType", "ItemPtr"); icon->setUserString("ToolTipType", "ItemPtr");
icon->setUserData(*iter); icon->setUserData(MWWorld::ConstPtr(*iter));
icon->eventMouseButtonClick += MyGUI::newDelegate(this, &Recharge::onItemClicked); icon->eventMouseButtonClick += MyGUI::newDelegate(this, &Recharge::onItemClicked);
icon->eventMouseWheel += MyGUI::newDelegate(this, &Recharge::onMouseWheel); icon->eventMouseWheel += MyGUI::newDelegate(this, &Recharge::onMouseWheel);

@ -53,7 +53,7 @@ void Repair::startRepairItem(const MWWorld::Ptr &item)
mToolIcon->setItem(item); mToolIcon->setItem(item);
mToolIcon->setUserString("ToolTipType", "ItemPtr"); mToolIcon->setUserString("ToolTipType", "ItemPtr");
mToolIcon->setUserData(item); mToolIcon->setUserData(MWWorld::ConstPtr(item));
updateRepairView(); updateRepairView();
} }
@ -119,7 +119,7 @@ void Repair::updateRepairView()
"MW_ItemIconSmall", MyGUI::IntCoord(16, currentY, 32, 32), MyGUI::Align::Default); "MW_ItemIconSmall", MyGUI::IntCoord(16, currentY, 32, 32), MyGUI::Align::Default);
icon->setItem(*iter); icon->setItem(*iter);
icon->setUserString("ToolTipType", "ItemPtr"); icon->setUserString("ToolTipType", "ItemPtr");
icon->setUserData(*iter); icon->setUserData(MWWorld::ConstPtr(*iter));
icon->eventMouseButtonClick += MyGUI::newDelegate(this, &Repair::onRepairItem); icon->eventMouseButtonClick += MyGUI::newDelegate(this, &Repair::onRepairItem);
icon->eventMouseWheel += MyGUI::newDelegate(this, &Repair::onMouseWheel); icon->eventMouseWheel += MyGUI::newDelegate(this, &Repair::onMouseWheel);

@ -278,7 +278,7 @@ namespace MWGui
{ {
if (spell.mType == Spell::Type_EnchantedItem) if (spell.mType == Spell::Type_EnchantedItem)
{ {
widget->setUserData(spell.mItem); widget->setUserData(MWWorld::ConstPtr(spell.mItem));
widget->setUserString("ToolTipType", "ItemPtr"); widget->setUserString("ToolTipType", "ItemPtr");
} }
else else

@ -182,7 +182,7 @@ namespace MWGui
} }
else if (type == "ItemPtr") else if (type == "ItemPtr")
{ {
mFocusObject = *focus->getUserData<MWWorld::Ptr>(); mFocusObject = *focus->getUserData<MWWorld::ConstPtr>();
tooltipSize = getToolTipViaPtr(mFocusObject.getRefData().getCount(), false); tooltipSize = getToolTipViaPtr(mFocusObject.getRefData().getCount(), false);
} }
else if (type == "ItemModelIndex") else if (type == "ItemModelIndex")

Loading…
Cancel
Save