|
|
|
@ -33,6 +33,7 @@ namespace MWGui
|
|
|
|
|
|
|
|
|
|
Recharge::Recharge()
|
|
|
|
|
: WindowBase("openmw_recharge_dialog.layout")
|
|
|
|
|
, mItemSelectionDialog(NULL)
|
|
|
|
|
{
|
|
|
|
|
getWidget(mBox, "Box");
|
|
|
|
|
getWidget(mGemBox, "GemBox");
|
|
|
|
@ -45,6 +46,8 @@ Recharge::Recharge()
|
|
|
|
|
|
|
|
|
|
mBox->setDisplayMode(ItemChargeView::DisplayMode_EnchantmentCharge);
|
|
|
|
|
|
|
|
|
|
mGemIcon->eventMouseButtonClick += MyGUI::newDelegate(this, &Recharge::onSelectItem);
|
|
|
|
|
|
|
|
|
|
setVisible(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -87,6 +90,12 @@ void Recharge::updateView()
|
|
|
|
|
mGemBox->setVisible(toolBoxVisible);
|
|
|
|
|
mGemBox->setUserString("Hidden", toolBoxVisible ? "false" : "true");
|
|
|
|
|
|
|
|
|
|
if (!toolBoxVisible)
|
|
|
|
|
{
|
|
|
|
|
mGemIcon->setItem(MWWorld::Ptr());
|
|
|
|
|
mGemIcon->clearUserStrings();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mBox->update();
|
|
|
|
|
|
|
|
|
|
Gui::Box* box = dynamic_cast<Gui::Box*>(mMainWidget);
|
|
|
|
@ -102,6 +111,34 @@ void Recharge::onCancel(MyGUI::Widget *sender)
|
|
|
|
|
exit();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Recharge::onSelectItem(MyGUI::Widget *sender)
|
|
|
|
|
{
|
|
|
|
|
delete mItemSelectionDialog;
|
|
|
|
|
mItemSelectionDialog = new ItemSelectionDialog("#{sSoulGemsWithSouls}");
|
|
|
|
|
mItemSelectionDialog->eventItemSelected += MyGUI::newDelegate(this, &Recharge::onItemSelected);
|
|
|
|
|
mItemSelectionDialog->eventDialogCanceled += MyGUI::newDelegate(this, &Recharge::onItemCancel);
|
|
|
|
|
mItemSelectionDialog->setVisible(true);
|
|
|
|
|
mItemSelectionDialog->openContainer(MWMechanics::getPlayer());
|
|
|
|
|
mItemSelectionDialog->setFilter(SortFilterItemModel::Filter_OnlyChargedSoulstones);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Recharge::onItemSelected(MWWorld::Ptr item)
|
|
|
|
|
{
|
|
|
|
|
mItemSelectionDialog->setVisible(false);
|
|
|
|
|
|
|
|
|
|
mGemIcon->setItem(item);
|
|
|
|
|
mGemIcon->setUserString ("ToolTipType", "ItemPtr");
|
|
|
|
|
mGemIcon->setUserData(item);
|
|
|
|
|
|
|
|
|
|
MWBase::Environment::get().getSoundManager()->playSound(item.getClass().getDownSoundId(item), 1, 1);
|
|
|
|
|
updateView();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Recharge::onItemCancel()
|
|
|
|
|
{
|
|
|
|
|
mItemSelectionDialog->setVisible(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Recharge::onItemClicked(MyGUI::Widget *sender, const MWWorld::Ptr& item)
|
|
|
|
|
{
|
|
|
|
|
MWWorld::Ptr gem = *mGemIcon->getUserData<MWWorld::Ptr>();
|
|
|
|
|