mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-28 20:36:42 +00:00
Added a method to remove a dialog safely, first hides the dialog then schedules for deletion in the garbage list.
This commit is contained in:
parent
16aa13721a
commit
506f61d254
2 changed files with 25 additions and 0 deletions
|
@ -459,6 +459,15 @@ void WindowManager::updateSkillArea()
|
||||||
stats->updateSkillArea();
|
stats->updateSkillArea();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WindowManager::removeDialog(OEngine::GUI::Layout*dialog)
|
||||||
|
{
|
||||||
|
assert(dialog);
|
||||||
|
if (!dialog)
|
||||||
|
return;
|
||||||
|
dialog->setVisible(false);
|
||||||
|
garbageDialogs.push_back(dialog);
|
||||||
|
}
|
||||||
|
|
||||||
void WindowManager::messageBox (const std::string& message, const std::vector<std::string>& buttons)
|
void WindowManager::messageBox (const std::string& message, const std::vector<std::string>& buttons)
|
||||||
{
|
{
|
||||||
std::cout << "message box: " << message << std::endl;
|
std::cout << "message box: " << message << std::endl;
|
||||||
|
|
|
@ -228,6 +228,13 @@ namespace MWGui
|
||||||
void updateSkillArea();
|
void updateSkillArea();
|
||||||
///< update display of skills, factions, birth sign, reputation and bounty
|
///< update display of skills, factions, birth sign, reputation and bounty
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
void removeDialog(T*& dialog);
|
||||||
|
///< Casts to OEngine::GUI::Layout and calls removeDialog, then resets pointer to nullptr.
|
||||||
|
|
||||||
|
void removeDialog(OEngine::GUI::Layout* dialog);
|
||||||
|
///< Hides dialog and schedules dialog to be deleted.
|
||||||
|
|
||||||
void messageBox (const std::string& message, const std::vector<std::string>& buttons);
|
void messageBox (const std::string& message, const std::vector<std::string>& buttons);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -275,5 +282,14 @@ namespace MWGui
|
||||||
void onReviewDialogDone();
|
void onReviewDialogDone();
|
||||||
void onReviewDialogBack();
|
void onReviewDialogBack();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
void WindowManager::removeDialog(T*& dialog)
|
||||||
|
{
|
||||||
|
OEngine::GUI::Layout *d = static_cast<OEngine::GUI::Layout*>(dialog);
|
||||||
|
removeDialog(d);
|
||||||
|
dialog = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue