Refactor exitCurrentGuiMode

new-script-api
scrawl 7 years ago
parent 20766fb508
commit 4fff2e2e34

@ -59,7 +59,7 @@ namespace MWGui
void AlchemyWindow::onCancelButtonClicked(MyGUI::Widget* _sender)
{
exit();
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Alchemy);
}
void AlchemyWindow::onCreateButtonClicked(MyGUI::Widget* _sender)
@ -103,6 +103,7 @@ namespace MWGui
void AlchemyWindow::onOpen()
{
mAlchemy->clear();
mAlchemy->setAlchemist (MWMechanics::getPlayer());
InventoryItemModel* model = new InventoryItemModel(MWMechanics::getPlayer());
@ -129,12 +130,6 @@ namespace MWGui
update();
}
void AlchemyWindow::exit() {
mAlchemy->clear();
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Alchemy);
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Inventory);
}
void AlchemyWindow::onIngredientSelected(MyGUI::Widget* _sender)
{
removeIngredient(_sender);

@ -25,7 +25,6 @@ namespace MWGui
AlchemyWindow();
virtual void onOpen();
virtual void exit();
private:
std::string mSuggestedPotionName;

@ -22,6 +22,8 @@ namespace MWGui
void setNextButtonShow(bool shown);
virtual void onOpen();
bool exit() { return false; }
// Events
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;

@ -96,11 +96,6 @@ namespace MWGui
setTakeButtonShow(showTakeButton);
}
void BookWindow::exit()
{
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Book);
}
void BookWindow::setTakeButtonShow(bool show)
{
mTakeButtonShow = show;
@ -115,7 +110,7 @@ namespace MWGui
void BookWindow::onCloseButtonClicked (MyGUI::Widget* sender)
{
exit();
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Book);
}
void BookWindow::onTakeButtonClicked (MyGUI::Widget* sender)

@ -14,8 +14,6 @@ namespace MWGui
public:
BookWindow();
virtual void exit();
void setPtr(const MWWorld::Ptr& book);
void setInventoryAllowed(bool allowed);

@ -730,9 +730,10 @@ namespace MWGui
exit();
}
void SelectSpecializationDialog::exit()
bool SelectSpecializationDialog::exit()
{
eventCancel();
return true;
}
/* SelectAttributeDialog */
@ -778,9 +779,10 @@ namespace MWGui
exit();
}
void SelectAttributeDialog::exit()
bool SelectAttributeDialog::exit()
{
eventCancel();
return true;
}
@ -869,9 +871,10 @@ namespace MWGui
exit();
}
void SelectSkillDialog::exit()
bool SelectSkillDialog::exit()
{
eventCancel();
return true;
}
/* DescriptionDialog */

@ -23,6 +23,8 @@ namespace MWGui
virtual void onOpen();
bool exit() { return false; }
// Events
typedef MyGUI::delegates::CMultiDelegate1<int> EventHandle_Int;
@ -67,6 +69,8 @@ namespace MWGui
std::string getClassId() const;
void setClassId(const std::string &classId);
bool exit() { return false; }
// Events
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
@ -102,6 +106,8 @@ namespace MWGui
void setNextButtonShow(bool shown);
virtual void onOpen();
bool exit() { return false; }
// Events
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
@ -142,7 +148,7 @@ namespace MWGui
SelectSpecializationDialog();
~SelectSpecializationDialog();
virtual void exit();
virtual bool exit();
ESM::Class::Specialization getSpecializationId() const { return mSpecializationId; }
@ -175,7 +181,7 @@ namespace MWGui
SelectAttributeDialog();
~SelectAttributeDialog();
virtual void exit();
virtual bool exit();
ESM::Attribute::AttributeID getAttributeId() const { return mAttributeId; }
@ -206,7 +212,7 @@ namespace MWGui
SelectSkillDialog();
~SelectSkillDialog();
virtual void exit();
virtual bool exit();
ESM::Skill::SkillEnum getSkillId() const { return mSkillId; }
@ -262,6 +268,8 @@ namespace MWGui
CreateClassDialog();
virtual ~CreateClassDialog();
bool exit() { return false; }
std::string getName() const;
std::string getDescription() const;
ESM::Class::Specialization getSpecializationId() const;

@ -139,10 +139,11 @@ void CompanionWindow::updateEncumbranceBar()
void CompanionWindow::onCloseButtonClicked(MyGUI::Widget* _sender)
{
exit();
if (exit())
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Companion);
}
void CompanionWindow::exit()
bool CompanionWindow::exit()
{
if (mModel && mModel->hasProfit(mPtr) && getProfit(mPtr) < 0)
{
@ -151,9 +152,9 @@ void CompanionWindow::exit()
buttons.push_back("#{sCompanionWarningButtonTwo}");
mMessageBoxManager->createInteractiveMessageBox("#{sCompanionWarningMessage}", buttons);
mMessageBoxManager->eventButtonPressed += MyGUI::newDelegate(this, &CompanionWindow::onMessageBoxButtonClicked);
return false;
}
else
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Companion);
return true;
}
void CompanionWindow::onMessageBoxButtonClicked(int button)

@ -18,7 +18,7 @@ namespace MWGui
public:
CompanionWindow(DragAndDrop* dragAndDrop, MessageBoxManager* manager);
virtual void exit();
virtual bool exit();
virtual void resetReference();

@ -46,15 +46,16 @@ namespace MWGui
center();
}
void ConfirmationDialog::exit()
bool ConfirmationDialog::exit()
{
setVisible(false);
eventCancelClicked();
return true;
}
void ConfirmationDialog::onCancelButtonClicked(MyGUI::Widget* _sender)
{
setVisible(false);
exit();
}

@ -11,7 +11,7 @@ namespace MWGui
ConfirmationDialog();
void askForConfirmation(const std::string& message);
void askForConfirmation(const std::string& message, const std::string& confirmMessage, const std::string& cancelMessage);
virtual void exit();
virtual bool exit();
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;

@ -159,11 +159,6 @@ namespace MWGui
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(NULL);
}
void Console::exit()
{
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Console);
}
void Console::setFont(const std::string &fntName)
{
mHistory->setFontName(fntName);

@ -42,8 +42,6 @@ namespace MWGui
virtual void onOpen();
virtual void onClose();
virtual void exit();
void setFont(const std::string &fntName);
void onResChange(int width, int height);

@ -198,17 +198,9 @@ namespace MWGui
}
}
void ContainerWindow::exit()
{
if(mDragAndDrop == NULL || !mDragAndDrop->mIsOnDragAndDrop)
{
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Container);
}
}
void ContainerWindow::onCloseButtonClicked(MyGUI::Widget* _sender)
{
exit();
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Container);
}
void ContainerWindow::onTakeAllButtonClicked(MyGUI::Widget* _sender)

@ -38,8 +38,6 @@ namespace MWGui
virtual void resetReference();
virtual void exit();
private:
DragAndDrop* mDragAndDrop;

@ -56,19 +56,9 @@ namespace MWGui
mItemEdit->setValue(maxCount);
}
void CountDialog::cancel() //Keeping this here as I don't know if anything else relies on it.
{
exit();
}
void CountDialog::exit()
{
setVisible(false);
}
void CountDialog::onCancelButtonClicked(MyGUI::Widget* _sender)
{
cancel();
setVisible(false);
}
void CountDialog::onOkButtonClicked(MyGUI::Widget* _sender)

@ -15,8 +15,6 @@ namespace MWGui
public:
CountDialog();
void openCountDialog(const std::string& item, const std::string& message, const int maxCount);
void cancel();
virtual void exit();
typedef MyGUI::delegates::CMultiDelegate2<MyGUI::Widget*, int> EventHandle_WidgetInt;

@ -52,7 +52,7 @@ namespace MWGui
void PersuasionDialog::onCancel(MyGUI::Widget *sender)
{
exit();
setVisible(false);
}
void PersuasionDialog::onPersuade(MyGUI::Widget *sender)
@ -88,11 +88,6 @@ namespace MWGui
mGoldLabel->setCaptionWithReplacing("#{sGold}: " + MyGUI::utility::toString(playerGold));
}
void PersuasionDialog::exit()
{
setVisible(false);
}
// --------------------------------------------------------------------------------------------------
Response::Response(const std::string &text, const std::string &title, bool needMargin)
@ -275,18 +270,18 @@ namespace MWGui
mMainWidget->castType<MyGUI::Window>()->eventWindowChangeCoord += MyGUI::newDelegate(this, &DialogueWindow::onWindowResize);
}
void DialogueWindow::exit()
bool DialogueWindow::exit()
{
if ((!mEnabled || MWBase::Environment::get().getDialogueManager()->isInChoice())
&& !mGoodbye)
{
// in choice, not allowed to escape, but give access to main menu to allow loading other saves
MWBase::Environment::get().getWindowManager()->pushGuiMode (MWGui::GM_MainMenu);
return false;
}
else
{
MWBase::Environment::get().getDialogueManager()->goodbyeSelected();
mTopicsList->scrollToTop();
return true;
}
}
@ -311,7 +306,8 @@ namespace MWGui
void DialogueWindow::onByeClicked(MyGUI::Widget* _sender)
{
exit();
if (exit())
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Dialogue);
}
void DialogueWindow::onSelectTopic(const std::string& topic, int id)

@ -29,7 +29,6 @@ namespace MWGui
PersuasionDialog();
virtual void onOpen();
virtual void exit();
private:
MyGUI::Button* mCancelButton;
@ -100,7 +99,7 @@ namespace MWGui
public:
DialogueWindow();
virtual void exit();
virtual bool exit();
// Events
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;

@ -100,11 +100,6 @@ namespace MWGui
}
}
void EnchantingDialog::exit()
{
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Enchanting);
}
void EnchantingDialog::updateLabels()
{
std::stringstream enchantCost;
@ -194,7 +189,7 @@ namespace MWGui
void EnchantingDialog::onCancelButtonClicked(MyGUI::Widget* sender)
{
exit();
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Enchanting);
}
void EnchantingDialog::onSelectItem(MyGUI::Widget *sender)

@ -21,8 +21,6 @@ namespace MWGui
virtual void onOpen();
virtual void exit();
void setSoulGem (const MWWorld::Ptr& gem);
void setItem (const MWWorld::Ptr& item);

@ -29,9 +29,10 @@ namespace MWGui
center();
}
void ItemSelectionDialog::exit()
bool ItemSelectionDialog::exit()
{
eventDialogCanceled();
return true;
}
void ItemSelectionDialog::openContainer(const MWWorld::Ptr& container)

@ -21,7 +21,7 @@ namespace MWGui
public:
ItemSelectionDialog(const std::string& label);
virtual void exit();
virtual bool exit();
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
typedef MyGUI::delegates::CMultiDelegate1<MWWorld::Ptr> EventHandle_Item;

@ -14,6 +14,8 @@ namespace MWGui
void onFrame(float dt);
bool exit() { return false; }
private:
int mDays;

@ -1114,11 +1114,6 @@ namespace MWGui
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mTextEdit);
}
void EditNoteDialog::exit()
{
setVisible(false);
}
void EditNoteDialog::onCancelButtonClicked(MyGUI::Widget *sender)
{
setVisible(false);

@ -170,7 +170,6 @@ namespace MWGui
EditNoteDialog();
virtual void onOpen();
virtual void exit();
void showDeleteButton(bool show);
bool getDeleteButtonShown();

@ -118,11 +118,6 @@ void MerchantRepair::onOpen()
mList->setViewOffset(MyGUI::IntPoint(0, 0));
}
void MerchantRepair::exit()
{
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_MerchantRepair);
}
void MerchantRepair::onRepairButtonClick(MyGUI::Widget *sender)
{
MWWorld::Ptr player = MWMechanics::getPlayer();
@ -150,7 +145,7 @@ void MerchantRepair::onRepairButtonClick(MyGUI::Widget *sender)
void MerchantRepair::onOkButtonClick(MyGUI::Widget *sender)
{
exit();
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_MerchantRepair);
}
}

@ -14,8 +14,6 @@ public:
virtual void onOpen();
virtual void exit();
void setPtr(const MWWorld::Ptr& actor);
private:

@ -64,11 +64,6 @@ namespace MWGui
}
}
void QuickKeysMenu::exit()
{
MWBase::Environment::get().getWindowManager()->removeGuiMode (MWGui::GM_QuickKeysMenu);
}
void QuickKeysMenu::clear()
{
mActivatedIndex = -1;
@ -449,11 +444,6 @@ namespace MWGui
center();
}
void QuickKeysMenuAssign::exit()
{
setVisible(false);
}
void QuickKeysMenu::write(ESM::ESMWriter &writer)
{
writer.startRecord(ESM::REC_KEYS);
@ -585,9 +575,10 @@ namespace MWGui
exit();
}
void MagicSelectionDialog::exit()
bool MagicSelectionDialog::exit()
{
mParent->onAssignMagicCancel();
return true;
}
void MagicSelectionDialog::onOpen ()

@ -22,8 +22,6 @@ namespace MWGui
QuickKeysMenu();
~QuickKeysMenu();
virtual void exit();
void onItemButtonClicked(MyGUI::Widget* sender);
void onMagicButtonClicked(MyGUI::Widget* sender);
void onUnassignButtonClicked(MyGUI::Widget* sender);
@ -77,7 +75,6 @@ namespace MWGui
{
public:
QuickKeysMenuAssign(QuickKeysMenu* parent);
virtual void exit();
private:
MyGUI::TextBox* mLabel;
@ -95,7 +92,7 @@ namespace MWGui
MagicSelectionDialog(QuickKeysMenu* parent);
virtual void onOpen();
virtual void exit();
virtual bool exit();
private:
MyGUI::Button* mCancelButton;

@ -54,6 +54,8 @@ namespace MWGui
virtual void onOpen();
virtual void onClose();
bool exit() { return false; }
// Events
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;

@ -62,11 +62,6 @@ void Recharge::onOpen()
mBox->resetScrollbars();
}
void Recharge::exit()
{
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Recharge);
}
void Recharge::setPtr (const MWWorld::Ptr &item)
{
mGemIcon->setItem(item);
@ -107,7 +102,7 @@ void Recharge::updateView()
void Recharge::onCancel(MyGUI::Widget *sender)
{
exit();
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Recharge);
}
void Recharge::onSelectItem(MyGUI::Widget *sender)

@ -24,8 +24,6 @@ public:
virtual void onOpen();
virtual void exit();
void setPtr (const MWWorld::Ptr& gem);
protected:

@ -58,11 +58,6 @@ void Repair::onOpen()
mRepairBox->resetScrollbars();
}
void Repair::exit()
{
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Repair);
}
void Repair::setPtr(const MWWorld::Ptr &item)
{
MWBase::Environment::get().getWindowManager()->playSound("Item Repair Up");
@ -145,7 +140,7 @@ void Repair::onItemCancel()
void Repair::onCancel(MyGUI::Widget* /*sender*/)
{
exit();
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Repair);
}
void Repair::onRepairItem(MyGUI::Widget* /*sender*/, const MWWorld::Ptr& ptr)

@ -21,8 +21,6 @@ public:
virtual void onOpen();
virtual void exit();
void setPtr (const MWWorld::Ptr& item);
protected:

@ -31,6 +31,8 @@ namespace MWGui
ReviewDialog();
bool exit() { return false; }
void setPlayerName(const std::string &name);
void setRace(const std::string &raceId);
void setClass(const ESM::Class& class_);

@ -191,11 +191,6 @@ namespace MWGui
}
void SaveGameDialog::exit()
{
setVisible(false);
}
void SaveGameDialog::setLoadOrSave(bool load)
{
mSaving = !load;
@ -217,7 +212,7 @@ namespace MWGui
void SaveGameDialog::onCancelButtonClicked(MyGUI::Widget *sender)
{
exit();
setVisible(false);
}
void SaveGameDialog::onDeleteButtonClicked(MyGUI::Widget *sender)

@ -19,8 +19,6 @@ namespace MWGui
virtual void onOpen();
virtual void exit();
void setLoadOrSave(bool load);
private:

@ -76,11 +76,6 @@ namespace MWGui
setTakeButtonShow(showTakeButton);
}
void ScrollWindow::exit()
{
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Scroll);
}
void ScrollWindow::setTakeButtonShow(bool show)
{
mTakeButtonShow = show;
@ -95,7 +90,7 @@ namespace MWGui
void ScrollWindow::onCloseButtonClicked (MyGUI::Widget* _sender)
{
exit();
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Scroll);
}
void ScrollWindow::onTakeButtonClicked (MyGUI::Widget* _sender)

@ -18,7 +18,6 @@ namespace MWGui
ScrollWindow ();
void setPtr (const MWWorld::Ptr& scroll);
virtual void exit();
void setInventoryAllowed(bool allowed);
protected:

@ -258,7 +258,7 @@ namespace MWGui
void SettingsWindow::onOkButtonClicked(MyGUI::Widget* _sender)
{
exit();
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Settings);
}
void SettingsWindow::onResolutionSelected(MyGUI::ListBox* _sender, size_t index)
@ -559,11 +559,6 @@ namespace MWGui
resetScrollbars();
}
void SettingsWindow::exit()
{
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Settings);
}
void SettingsWindow::onWindowResize(MyGUI::Window *_sender)
{
layoutControlsBox();

@ -17,8 +17,6 @@ namespace MWGui
virtual void onOpen();
virtual void exit();
void updateControlsBox();
protected:

@ -31,11 +31,6 @@ namespace MWGui
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SpellBuyingWindow::onCancelButtonClicked);
}
void SpellBuyingWindow::exit()
{
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_SpellBuying);
}
bool SpellBuyingWindow::sortSpells (const ESM::Spell* left, const ESM::Spell* right)
{
std::string leftName = Misc::StringUtils::lowerCase(left->mName);
@ -173,7 +168,7 @@ namespace MWGui
void SpellBuyingWindow::onCancelButtonClicked(MyGUI::Widget* _sender)
{
exit();
MWBase::Environment::get().getWindowManager()->removeGuiMode (MWGui::GM_SpellBuying);
}
void SpellBuyingWindow::updateLabels()

@ -28,8 +28,6 @@ namespace MWGui
void setPtr(const MWWorld::Ptr& actor);
void setPtr(const MWWorld::Ptr& actor, int startOffset);
virtual void exit();
protected:
MyGUI::Button* mCancelButton;
MyGUI::TextBox* mPlayerGold;

@ -102,13 +102,13 @@ namespace MWGui
center();
}
void EditEffectDialog::exit()
bool EditEffectDialog::exit()
{
setVisible(false);
if(mEditing)
eventEffectModified(mOldEffect);
else
eventEffectRemoved(mEffect);
return true;
}
void EditEffectDialog::newEffect (const ESM::MagicEffect *effect)
@ -275,6 +275,7 @@ namespace MWGui
void EditEffectDialog::onCancelButtonClicked (MyGUI::Widget* sender)
{
setVisible(false);
exit();
}
@ -362,7 +363,7 @@ namespace MWGui
void SpellCreationDialog::onCancelButtonClicked (MyGUI::Widget* sender)
{
exit();
MWBase::Environment::get().getWindowManager()->removeGuiMode (MWGui::GM_SpellCreation);
}
void SpellCreationDialog::onBuyButtonClicked (MyGUI::Widget* sender)
@ -420,11 +421,6 @@ namespace MWGui
center();
}
void SpellCreationDialog::exit()
{
MWBase::Environment::get().getWindowManager()->removeGuiMode (MWGui::GM_SpellCreation);
}
void SpellCreationDialog::onReferenceUnavailable ()
{
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Dialogue);

@ -24,7 +24,7 @@ namespace MWGui
EditEffectDialog();
virtual void onOpen();
virtual void exit();
virtual bool exit();
void setConstantEffect(bool constant);
@ -151,7 +151,6 @@ namespace MWGui
SpellCreationDialog();
virtual void onOpen();
virtual void exit();
void setPtr(const MWWorld::Ptr& actor);

@ -22,6 +22,8 @@ namespace MWGui
void setTextLabel(const std::string &label);
virtual void onOpen();
bool exit() { return false; }
/** Event : Dialog finished, OK button clicked.\n
signature : void method()\n
*/

@ -171,11 +171,11 @@ namespace MWGui
return mPtr.getClass().getServices(mPtr);
}
void TradeWindow::exit()
bool TradeWindow::exit()
{
mTradeModel->abort();
MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getTradeModel()->abort();
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Barter);
return true;
}
void TradeWindow::onItemSelected (int index)
@ -362,6 +362,7 @@ namespace MWGui
void TradeWindow::onCancelButtonClicked(MyGUI::Widget* _sender)
{
exit();
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Barter);
}
void TradeWindow::onMaxSaleButtonClicked(MyGUI::Widget* _sender)

@ -34,7 +34,7 @@ namespace MWGui
int getMerchantServices();
virtual void exit();
virtual bool exit();
virtual void resetReference();

@ -60,11 +60,6 @@ namespace MWGui
center();
}
void TrainingWindow::exit()
{
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Training);
}
void TrainingWindow::setPtr (const MWWorld::Ptr& actor)
{
mPtr = actor;
@ -124,7 +119,7 @@ namespace MWGui
void TrainingWindow::onCancelButtonClicked (MyGUI::Widget *sender)
{
exit();
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Training);
}
void TrainingWindow::onTrainingSelected (MyGUI::Widget *sender)

@ -16,8 +16,6 @@ namespace MWGui
virtual void onOpen();
virtual void exit();
void setPtr(const MWWorld::Ptr& actor);
void onFrame(float dt);

@ -45,11 +45,6 @@ namespace MWGui
mSelect->getHeight());
}
void TravelWindow::exit()
{
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Travel);
}
void TravelWindow::addDestination(const std::string& name,ESM::Position pos,bool interior)
{
int price;
@ -194,7 +189,7 @@ namespace MWGui
void TravelWindow::onCancelButtonClicked(MyGUI::Widget* _sender)
{
exit();
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Travel);
}
void TravelWindow::updateLabels()

@ -24,8 +24,6 @@ namespace MWGui
public:
TravelWindow();
virtual void exit();
void setPtr (const MWWorld::Ptr& actor);
protected:

@ -79,10 +79,9 @@ namespace MWGui
mProgressBar.setVisible (false);
}
void WaitDialog::exit()
bool WaitDialog::exit()
{
if(!mProgressBar.isVisible()) //Only exit if not currently waiting
MWBase::Environment::get().getWindowManager()->popGuiMode();
return (!mProgressBar.isVisible()); //Only exit if not currently waiting
}
void WaitDialog::onOpen()

@ -29,7 +29,7 @@ namespace MWGui
virtual void onOpen();
virtual void exit();
virtual bool exit();
void onFrame(float dt);

@ -34,7 +34,7 @@ namespace MWGui
/// Notify that window has been hidden
virtual void onClose () {}
/// Gracefully exits the window
virtual void exit() {}
virtual bool exit() {return true;}
/// Sets the visibility of the window
virtual void setVisible(bool visible);
/// Returns the visibility state of the window
@ -52,7 +52,7 @@ namespace MWGui
WindowModal(const std::string& parLayout);
virtual void onOpen();
virtual void onClose();
virtual void exit() {}
virtual bool exit() {return true;}
};
/// A window that cannot be the target of a drag&drop action.

@ -769,89 +769,19 @@ namespace MWGui
return;
}
switch(mGuiModes.back()) {
case GM_QuickKeysMenu:
mQuickKeysMenu->exit();
break;
case GM_MainMenu:
removeGuiMode(GM_MainMenu); //Simple way to remove it
break;
case GM_Settings:
mSettingsWindow->exit();
break;
case GM_Console:
mConsole->exit();
break;
case GM_Scroll:
mScrollWindow->exit();
break;
case GM_Book:
mBookWindow->exit();
break;
case GM_Alchemy:
mAlchemyWindow->exit();
break;
case GM_Rest:
mWaitDialog->exit();
break;
case GM_RestBed:
mWaitDialog->exit();
break;
case GM_Name:
case GM_Race:
case GM_Class:
case GM_ClassPick:
case GM_ClassCreate:
case GM_Birth:
case GM_ClassGenerate:
case GM_Review:
break;
case GM_Inventory:
removeGuiMode(GM_Inventory); //Simple way to remove it
break;
case GM_Container:
mContainerWindow->exit();
break;
case GM_Companion:
mCompanionWindow->exit();
break;
case GM_Dialogue:
mDialogueWindow->exit();
break;
case GM_Barter:
mTradeWindow->exit();
break;
case GM_SpellBuying:
mSpellBuyingWindow->exit();
break;
case GM_Travel:
mTravelWindow->exit();
break;
case GM_SpellCreation:
mSpellCreationDialog->exit();
break;
case GM_Recharge:
mRecharge->exit();
break;
case GM_Enchanting:
mEnchantingDialog->exit();
break;
case GM_Training:
mTrainingWindow->exit();
break;
case GM_MerchantRepair:
mMerchantRepair->exit();
break;
case GM_Repair:
mRepair->exit();
break;
case GM_Journal:
removeGuiMode(GM_Journal); //Simple way to remove it
break;
default:
// Unsupported mode, switch back to game
break;
GuiModeState& state = mGuiModeStates[mGuiModes.back()];
for (WindowBase* window : state.mWindows)
{
if (!window->exit())
{
// unable to exit window, but give access to main menu
if (!MyGUI::InputManager::getInstance().isModalAny())
pushGuiMode (MWGui::GM_MainMenu);
return;
}
}
popGuiMode();
}
void WindowManager::interactiveMessageBox(const std::string &message, const std::vector<std::string> &buttons, bool block)
@ -1267,10 +1197,11 @@ namespace MWGui
if (!mGuiModes.empty())
{
mGuiModeStates[mGuiModes.back()].update(false);
if (!noSound)
playSound(mGuiModeStates[mGuiModes.back()].mCloseSound);
const GuiMode mode = mGuiModes.back();
mGuiModes.pop_back();
mGuiModeStates[mode].update(false);
if (!noSound)
playSound(mGuiModeStates[mode].mCloseSound);
}
if (!mGuiModes.empty())
@ -1849,10 +1780,11 @@ namespace MWGui
void WindowManager::exitCurrentModal()
{
if (!mCurrentModals.empty())
mCurrentModals.top()->exit();
if (mCurrentModals.empty())
MyGUI::InputManager::getInstance().setKeyFocusWidget(mSaveKeyFocus);
{
if (!mCurrentModals.top()->exit())
return;
mCurrentModals.top()->setVisible(false);
}
}
void WindowManager::addCurrentModal(WindowModal *input)

Loading…
Cancel
Save