mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 15:15:31 +00:00
Esc button exits all non-modal GUI windows
This commit is contained in:
parent
7697b9e868
commit
e3e51324a4
41 changed files with 321 additions and 96 deletions
|
@ -234,14 +234,19 @@ namespace MWBase
|
|||
|
||||
virtual void addVisitedLocation(const std::string& name, int x, int y) = 0;
|
||||
|
||||
/// Hides dialog and schedules dialog to be deleted.
|
||||
virtual void removeDialog(OEngine::GUI::Layout* dialog) = 0;
|
||||
///< Hides dialog and schedules dialog to be deleted.
|
||||
|
||||
///Gracefully attempts to exit the topmost GUI mode
|
||||
/** No guarentee of actually closing the window **/
|
||||
virtual void exitCurrentGuiMode() = 0;
|
||||
|
||||
virtual void messageBox (const std::string& message, const std::vector<std::string>& buttons = std::vector<std::string>(), enum MWGui::ShowInDialogueMode showInDialogueMode = MWGui::ShowInDialogueMode_IfPossible) = 0;
|
||||
virtual void staticMessageBox(const std::string& message) = 0;
|
||||
virtual void removeStaticMessageBox() = 0;
|
||||
|
||||
/// returns the index of the pressed button or -1 if no button was pressed (->MessageBoxmanager->InteractiveMessageBox)
|
||||
virtual int readPressedButton() = 0;
|
||||
///< returns the index of the pressed button or -1 if no button was pressed (->MessageBoxmanager->InteractiveMessageBox)
|
||||
|
||||
virtual void onFrame (float frameDuration) = 0;
|
||||
|
||||
|
|
|
@ -66,10 +66,7 @@ namespace MWGui
|
|||
|
||||
void AlchemyWindow::onCancelButtonClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
mAlchemy.clear();
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Alchemy);
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Inventory);
|
||||
exit();
|
||||
}
|
||||
|
||||
void AlchemyWindow::onCreateButtonClicked(MyGUI::Widget* _sender)
|
||||
|
@ -159,6 +156,12 @@ 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);
|
||||
|
|
|
@ -19,6 +19,7 @@ namespace MWGui
|
|||
AlchemyWindow();
|
||||
|
||||
virtual void open();
|
||||
virtual void exit();
|
||||
|
||||
private:
|
||||
ItemView* mItemView;
|
||||
|
|
|
@ -114,6 +114,14 @@ namespace MWGui
|
|||
setTakeButtonShow(true);
|
||||
}
|
||||
|
||||
void BookWindow::exit()
|
||||
{
|
||||
// no 3d sounds because the object could be in a container.
|
||||
MWBase::Environment::get().getSoundManager()->playSound ("book close", 1.0, 1.0);
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Book);
|
||||
}
|
||||
|
||||
void BookWindow::setTakeButtonShow(bool show)
|
||||
{
|
||||
mTakeButtonShow = show;
|
||||
|
@ -128,10 +136,7 @@ namespace MWGui
|
|||
|
||||
void BookWindow::onCloseButtonClicked (MyGUI::Widget* sender)
|
||||
{
|
||||
// no 3d sounds because the object could be in a container.
|
||||
MWBase::Environment::get().getSoundManager()->playSound ("book close", 1.0, 1.0);
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Book);
|
||||
exit();
|
||||
}
|
||||
|
||||
void BookWindow::onTakeButtonClicked (MyGUI::Widget* sender)
|
||||
|
|
|
@ -14,6 +14,8 @@ namespace MWGui
|
|||
public:
|
||||
BookWindow();
|
||||
|
||||
virtual void exit();
|
||||
|
||||
void open(MWWorld::Ptr book);
|
||||
void setTakeButtonShow(bool show);
|
||||
void nextPage();
|
||||
|
|
|
@ -118,6 +118,11 @@ void CompanionWindow::updateEncumbranceBar()
|
|||
}
|
||||
|
||||
void CompanionWindow::onCloseButtonClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
exit();
|
||||
}
|
||||
|
||||
void CompanionWindow::exit()
|
||||
{
|
||||
if (mPtr.getTypeName() == typeid(ESM::NPC).name() && mPtr.getClass().getNpcStats(mPtr).getProfit() < 0)
|
||||
{
|
||||
|
|
|
@ -18,6 +18,8 @@ namespace MWGui
|
|||
public:
|
||||
CompanionWindow(DragAndDrop* dragAndDrop, MessageBoxManager* manager);
|
||||
|
||||
virtual void exit();
|
||||
|
||||
void open(const MWWorld::Ptr& npc);
|
||||
void onFrame ();
|
||||
|
||||
|
|
|
@ -143,6 +143,11 @@ 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);
|
||||
|
|
|
@ -21,86 +21,83 @@
|
|||
|
||||
namespace MWGui
|
||||
{
|
||||
class Console : public WindowBase, private Compiler::ErrorHandler, public ReferenceInterface
|
||||
{
|
||||
private:
|
||||
class Console : public WindowBase, private Compiler::ErrorHandler, public ReferenceInterface
|
||||
{
|
||||
public:
|
||||
/// Set the implicit object for script execution
|
||||
void setSelectedObject(const MWWorld::Ptr& object);
|
||||
|
||||
Compiler::Extensions mExtensions;
|
||||
MWScript::CompilerContext mCompilerContext;
|
||||
std::vector<std::string> mNames;
|
||||
bool mConsoleOnlyScripts;
|
||||
MyGUI::EditBox* mCommandLine;
|
||||
MyGUI::EditBox* mHistory;
|
||||
|
||||
bool compile (const std::string& cmd, Compiler::Output& output);
|
||||
typedef std::list<std::string> StringList;
|
||||
|
||||
/// Report error to the user.
|
||||
virtual void report (const std::string& message, const Compiler::TokenLoc& loc, Type type);
|
||||
// History of previous entered commands
|
||||
StringList mCommandHistory;
|
||||
StringList::iterator mCurrent;
|
||||
std::string mEditString;
|
||||
|
||||
/// Report a file related error
|
||||
virtual void report (const std::string& message, Type type);
|
||||
Console(int w, int h, bool consoleOnlyScripts);
|
||||
|
||||
void listNames();
|
||||
///< Write all valid identifiers and keywords into mNames and sort them.
|
||||
/// \note If mNames is not empty, this function is a no-op.
|
||||
/// \note The list may contain duplicates (if a name is a keyword and an identifier at the same
|
||||
/// time).
|
||||
virtual void open();
|
||||
virtual void close();
|
||||
|
||||
public:
|
||||
virtual void exit();
|
||||
|
||||
void setSelectedObject(const MWWorld::Ptr& object);
|
||||
///< Set the implicit object for script execution
|
||||
void setFont(const std::string &fntName);
|
||||
|
||||
protected:
|
||||
void onResChange(int width, int height);
|
||||
|
||||
virtual void onReferenceUnavailable();
|
||||
void clearHistory();
|
||||
|
||||
// Print a message to the console. Messages may contain color
|
||||
// code, eg. "#FFFFFF this is white".
|
||||
void print(const std::string &msg);
|
||||
|
||||
public:
|
||||
MyGUI::EditBox* mCommandLine;
|
||||
MyGUI::EditBox* mHistory;
|
||||
// These are pre-colored versions that you should use.
|
||||
|
||||
typedef std::list<std::string> StringList;
|
||||
/// Output from successful console command
|
||||
void printOK(const std::string &msg);
|
||||
|
||||
// History of previous entered commands
|
||||
StringList mCommandHistory;
|
||||
StringList::iterator mCurrent;
|
||||
std::string mEditString;
|
||||
/// Error message
|
||||
void printError(const std::string &msg);
|
||||
|
||||
Console(int w, int h, bool consoleOnlyScripts);
|
||||
void execute (const std::string& command);
|
||||
|
||||
virtual void open();
|
||||
virtual void close();
|
||||
void executeFile (const std::string& path);
|
||||
|
||||
void setFont(const std::string &fntName);
|
||||
protected:
|
||||
|
||||
void onResChange(int width, int height);
|
||||
virtual void onReferenceUnavailable();
|
||||
|
||||
void clearHistory();
|
||||
private:
|
||||
|
||||
// Print a message to the console. Messages may contain color
|
||||
// code, eg. "#FFFFFF this is white".
|
||||
void print(const std::string &msg);
|
||||
void keyPress(MyGUI::Widget* _sender,
|
||||
MyGUI::KeyCode key,
|
||||
MyGUI::Char _char);
|
||||
|
||||
// These are pre-colored versions that you should use.
|
||||
void acceptCommand(MyGUI::EditBox* _sender);
|
||||
|
||||
/// Output from successful console command
|
||||
void printOK(const std::string &msg);
|
||||
std::string complete( std::string input, std::vector<std::string> &matches );
|
||||
|
||||
/// Error message
|
||||
void printError(const std::string &msg);
|
||||
Compiler::Extensions mExtensions;
|
||||
MWScript::CompilerContext mCompilerContext;
|
||||
std::vector<std::string> mNames;
|
||||
bool mConsoleOnlyScripts;
|
||||
|
||||
void execute (const std::string& command);
|
||||
bool compile (const std::string& cmd, Compiler::Output& output);
|
||||
|
||||
void executeFile (const std::string& path);
|
||||
/// Report error to the user.
|
||||
virtual void report (const std::string& message, const Compiler::TokenLoc& loc, Type type);
|
||||
|
||||
private:
|
||||
/// Report a file related error
|
||||
virtual void report (const std::string& message, Type type);
|
||||
|
||||
void keyPress(MyGUI::Widget* _sender,
|
||||
MyGUI::KeyCode key,
|
||||
MyGUI::Char _char);
|
||||
|
||||
void acceptCommand(MyGUI::EditBox* _sender);
|
||||
|
||||
std::string complete( std::string input, std::vector<std::string> &matches );
|
||||
/// Write all valid identifiers and keywords into mNames and sort them.
|
||||
/// \note If mNames is not empty, this function is a no-op.
|
||||
/// \note The list may contain duplicates (if a name is a keyword and an identifier at the same
|
||||
/// time).
|
||||
void listNames();
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -263,7 +263,7 @@ namespace MWGui
|
|||
}
|
||||
}
|
||||
|
||||
void ContainerWindow::onCloseButtonClicked(MyGUI::Widget* _sender)
|
||||
void ContainerWindow::exit()
|
||||
{
|
||||
if(mDragAndDrop == NULL || !mDragAndDrop->mIsOnDragAndDrop)
|
||||
{
|
||||
|
@ -271,6 +271,11 @@ namespace MWGui
|
|||
}
|
||||
}
|
||||
|
||||
void ContainerWindow::onCloseButtonClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
exit();
|
||||
}
|
||||
|
||||
void ContainerWindow::onTakeAllButtonClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
if(mDragAndDrop == NULL || !mDragAndDrop->mIsOnDragAndDrop)
|
||||
|
|
|
@ -54,6 +54,8 @@ namespace MWGui
|
|||
void open(const MWWorld::Ptr& container, bool loot=false);
|
||||
virtual void close();
|
||||
|
||||
virtual void exit();
|
||||
|
||||
private:
|
||||
DragAndDrop* mDragAndDrop;
|
||||
|
||||
|
|
|
@ -264,6 +264,13 @@ namespace MWGui
|
|||
static_cast<MyGUI::Window*>(mMainWidget)->eventWindowChangeCoord += MyGUI::newDelegate(this, &DialogueWindow::onWindowResize);
|
||||
}
|
||||
|
||||
void DialogueWindow::exit()
|
||||
{
|
||||
if (!mEnabled || MWBase::Environment::get().getDialogueManager()->isInChoice())
|
||||
return;
|
||||
MWBase::Environment::get().getDialogueManager()->goodbyeSelected();
|
||||
}
|
||||
|
||||
void DialogueWindow::onWindowResize(MyGUI::Window* _sender)
|
||||
{
|
||||
mTopicsList->adjustSize();
|
||||
|
@ -281,9 +288,7 @@ namespace MWGui
|
|||
|
||||
void DialogueWindow::onByeClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
if (!mEnabled || MWBase::Environment::get().getDialogueManager()->isInChoice())
|
||||
return;
|
||||
MWBase::Environment::get().getDialogueManager()->goodbyeSelected();
|
||||
exit();
|
||||
}
|
||||
|
||||
void DialogueWindow::onSelectTopic(const std::string& topic, int id)
|
||||
|
|
|
@ -103,6 +103,8 @@ namespace MWGui
|
|||
public:
|
||||
DialogueWindow();
|
||||
|
||||
virtual void exit();
|
||||
|
||||
// Events
|
||||
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
|
||||
|
||||
|
|
|
@ -61,6 +61,11 @@ namespace MWGui
|
|||
onRemoveSoul(NULL);
|
||||
}
|
||||
|
||||
void EnchantingDialog::exit()
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Enchanting);
|
||||
}
|
||||
|
||||
void EnchantingDialog::updateLabels()
|
||||
{
|
||||
std::stringstream enchantCost;
|
||||
|
@ -141,7 +146,7 @@ namespace MWGui
|
|||
|
||||
void EnchantingDialog::onCancelButtonClicked(MyGUI::Widget* sender)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Enchanting);
|
||||
exit();
|
||||
}
|
||||
|
||||
void EnchantingDialog::onSelectItem(MyGUI::Widget *sender)
|
||||
|
|
|
@ -19,6 +19,9 @@ namespace MWGui
|
|||
virtual ~EnchantingDialog();
|
||||
|
||||
virtual void open();
|
||||
|
||||
virtual void exit();
|
||||
|
||||
void startEnchanting(MWWorld::Ptr actor);
|
||||
void startSelfEnchanting(MWWorld::Ptr soulgem);
|
||||
|
||||
|
|
|
@ -110,6 +110,11 @@ void MerchantRepair::open()
|
|||
center();
|
||||
}
|
||||
|
||||
void MerchantRepair::exit()
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_MerchantRepair);
|
||||
}
|
||||
|
||||
void MerchantRepair::onRepairButtonClick(MyGUI::Widget *sender)
|
||||
{
|
||||
// repair
|
||||
|
@ -128,7 +133,7 @@ void MerchantRepair::onRepairButtonClick(MyGUI::Widget *sender)
|
|||
|
||||
void MerchantRepair::onOkButtonClick(MyGUI::Widget *sender)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_MerchantRepair);
|
||||
exit();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@ public:
|
|||
|
||||
virtual void open();
|
||||
|
||||
virtual void exit();
|
||||
|
||||
void startRepair(const MWWorld::Ptr& actor);
|
||||
|
||||
private:
|
||||
|
|
|
@ -57,6 +57,11 @@ namespace MWGui
|
|||
}
|
||||
}
|
||||
|
||||
void QuickKeysMenu::exit()
|
||||
{
|
||||
mAssignDialog->setVisible (false);
|
||||
}
|
||||
|
||||
void QuickKeysMenu::clear()
|
||||
{
|
||||
for (int i=0; i<10; ++i)
|
||||
|
@ -146,7 +151,7 @@ namespace MWGui
|
|||
|
||||
void QuickKeysMenu::onCancelButtonClicked(MyGUI::Widget* sender)
|
||||
{
|
||||
mAssignDialog->setVisible (false);
|
||||
exit();
|
||||
}
|
||||
|
||||
void QuickKeysMenu::onAssignItem(MWWorld::Ptr item)
|
||||
|
|
|
@ -18,6 +18,7 @@ namespace MWGui
|
|||
QuickKeysMenu();
|
||||
~QuickKeysMenu();
|
||||
|
||||
virtual void exit();
|
||||
|
||||
void onItemButtonClicked(MyGUI::Widget* sender);
|
||||
void onMagicButtonClicked(MyGUI::Widget* sender);
|
||||
|
|
|
@ -38,6 +38,11 @@ void Recharge::open()
|
|||
center();
|
||||
}
|
||||
|
||||
void Recharge::exit()
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Recharge);
|
||||
}
|
||||
|
||||
void Recharge::start (const MWWorld::Ptr &item)
|
||||
{
|
||||
std::string path = std::string("icons\\");
|
||||
|
@ -128,7 +133,7 @@ void Recharge::updateView()
|
|||
|
||||
void Recharge::onCancel(MyGUI::Widget *sender)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Recharge);
|
||||
exit();
|
||||
}
|
||||
|
||||
void Recharge::onItemClicked(MyGUI::Widget *sender)
|
||||
|
|
|
@ -15,6 +15,8 @@ public:
|
|||
|
||||
virtual void open();
|
||||
|
||||
virtual void exit();
|
||||
|
||||
void start (const MWWorld::Ptr& gem);
|
||||
|
||||
protected:
|
||||
|
|
|
@ -35,6 +35,11 @@ void Repair::open()
|
|||
center();
|
||||
}
|
||||
|
||||
void Repair::exit()
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Repair);
|
||||
}
|
||||
|
||||
void Repair::startRepairItem(const MWWorld::Ptr &item)
|
||||
{
|
||||
mRepair.setTool(item);
|
||||
|
@ -134,7 +139,7 @@ void Repair::updateRepairView()
|
|||
|
||||
void Repair::onCancel(MyGUI::Widget *sender)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Repair);
|
||||
exit();
|
||||
}
|
||||
|
||||
void Repair::onRepairItem(MyGUI::Widget *sender)
|
||||
|
|
|
@ -15,6 +15,8 @@ public:
|
|||
|
||||
virtual void open();
|
||||
|
||||
virtual void exit();
|
||||
|
||||
void startRepairItem (const MWWorld::Ptr& item);
|
||||
|
||||
protected:
|
||||
|
|
|
@ -67,6 +67,13 @@ namespace MWGui
|
|||
setTakeButtonShow(true);
|
||||
}
|
||||
|
||||
void ScrollWindow::exit()
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound ("scroll", 1.0, 1.0);
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Scroll);
|
||||
}
|
||||
|
||||
void ScrollWindow::setTakeButtonShow(bool show)
|
||||
{
|
||||
mTakeButtonShow = show;
|
||||
|
@ -81,9 +88,7 @@ namespace MWGui
|
|||
|
||||
void ScrollWindow::onCloseButtonClicked (MyGUI::Widget* _sender)
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound ("scroll", 1.0, 1.0);
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Scroll);
|
||||
exit();
|
||||
}
|
||||
|
||||
void ScrollWindow::onTakeButtonClicked (MyGUI::Widget* _sender)
|
||||
|
|
|
@ -14,6 +14,7 @@ namespace MWGui
|
|||
ScrollWindow ();
|
||||
|
||||
void open (MWWorld::Ptr scroll);
|
||||
virtual void exit();
|
||||
void setTakeButtonShow(bool show);
|
||||
void setInventoryAllowed(bool allowed);
|
||||
|
||||
|
|
|
@ -242,7 +242,7 @@ namespace MWGui
|
|||
|
||||
void SettingsWindow::onOkButtonClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Settings);
|
||||
exit();
|
||||
}
|
||||
|
||||
void SettingsWindow::onResolutionSelected(MyGUI::ListBox* _sender, size_t index)
|
||||
|
@ -510,4 +510,9 @@ namespace MWGui
|
|||
{
|
||||
updateControlsBox ();
|
||||
}
|
||||
|
||||
void SettingsWindow::exit()
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Settings);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,8 @@ namespace MWGui
|
|||
|
||||
virtual void open();
|
||||
|
||||
virtual void exit();
|
||||
|
||||
void updateControlsBox();
|
||||
|
||||
protected:
|
||||
|
|
|
@ -33,6 +33,11 @@ namespace MWGui
|
|||
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SpellBuyingWindow::onCancelButtonClicked);
|
||||
}
|
||||
|
||||
void SpellBuyingWindow::exit()
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_SpellBuying);
|
||||
}
|
||||
|
||||
void SpellBuyingWindow::addSpell(const std::string& spellId)
|
||||
{
|
||||
const MWWorld::ESMStore &store =
|
||||
|
@ -132,7 +137,7 @@ namespace MWGui
|
|||
|
||||
void SpellBuyingWindow::onCancelButtonClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_SpellBuying);
|
||||
exit();
|
||||
}
|
||||
|
||||
void SpellBuyingWindow::updateLabels()
|
||||
|
|
|
@ -25,6 +25,8 @@ namespace MWGui
|
|||
|
||||
void startSpellBuying(const MWWorld::Ptr& actor);
|
||||
|
||||
virtual void exit();
|
||||
|
||||
protected:
|
||||
MyGUI::Button* mCancelButton;
|
||||
MyGUI::TextBox* mPlayerGold;
|
||||
|
|
|
@ -136,6 +136,13 @@ namespace MWGui
|
|||
return mPtr.getClass().getServices(mPtr);
|
||||
}
|
||||
|
||||
void TradeWindow::exit()
|
||||
{
|
||||
mTradeModel->abort();
|
||||
MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getTradeModel()->abort();
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Barter);
|
||||
}
|
||||
|
||||
void TradeWindow::onItemSelected (int index)
|
||||
{
|
||||
const ItemStack& item = mSortModel->getItem(index);
|
||||
|
@ -375,9 +382,7 @@ namespace MWGui
|
|||
|
||||
void TradeWindow::onCancelButtonClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
mTradeModel->abort();
|
||||
MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getTradeModel()->abort();
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Barter);
|
||||
exit();
|
||||
}
|
||||
|
||||
void TradeWindow::onMaxSaleButtonClicked(MyGUI::Widget* _sender)
|
||||
|
|
|
@ -35,6 +35,8 @@ namespace MWGui
|
|||
|
||||
int getMerchantServices();
|
||||
|
||||
virtual void exit();
|
||||
|
||||
|
||||
private:
|
||||
ItemView* mItemView;
|
||||
|
|
|
@ -35,6 +35,11 @@ namespace MWGui
|
|||
center();
|
||||
}
|
||||
|
||||
void TrainingWindow::exit()
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Training);
|
||||
}
|
||||
|
||||
void TrainingWindow::startTraining (MWWorld::Ptr actor)
|
||||
{
|
||||
mPtr = actor;
|
||||
|
@ -107,7 +112,7 @@ namespace MWGui
|
|||
|
||||
void TrainingWindow::onCancelButtonClicked (MyGUI::Widget *sender)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Training);
|
||||
exit();
|
||||
}
|
||||
|
||||
void TrainingWindow::onTrainingSelected (MyGUI::Widget *sender)
|
||||
|
|
|
@ -14,6 +14,8 @@ namespace MWGui
|
|||
|
||||
virtual void open();
|
||||
|
||||
virtual void exit();
|
||||
|
||||
void startTraining(MWWorld::Ptr actor);
|
||||
|
||||
void onFrame(float dt);
|
||||
|
|
|
@ -45,6 +45,11 @@ namespace MWGui
|
|||
mSelect->getHeight());
|
||||
}
|
||||
|
||||
void TravelWindow::exit()
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Travel);
|
||||
}
|
||||
|
||||
void TravelWindow::addDestination(const std::string& travelId,ESM::Position pos,bool interior)
|
||||
{
|
||||
int price = 0;
|
||||
|
@ -170,7 +175,7 @@ namespace MWGui
|
|||
|
||||
void TravelWindow::onCancelButtonClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Travel);
|
||||
exit();
|
||||
}
|
||||
|
||||
void TravelWindow::updateLabels()
|
||||
|
|
|
@ -22,6 +22,8 @@ namespace MWGui
|
|||
public:
|
||||
TravelWindow();
|
||||
|
||||
virtual void exit();
|
||||
|
||||
void startTravel(const MWWorld::Ptr& actor);
|
||||
|
||||
protected:
|
||||
|
|
|
@ -69,6 +69,11 @@ namespace MWGui
|
|||
mProgressBar.setVisible (false);
|
||||
}
|
||||
|
||||
void WaitDialog::exit()
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||
}
|
||||
|
||||
void WaitDialog::open()
|
||||
{
|
||||
if (!MWBase::Environment::get().getWindowManager ()->getRestEnabled ())
|
||||
|
@ -160,7 +165,7 @@ namespace MWGui
|
|||
|
||||
void WaitDialog::onCancelButtonClicked(MyGUI::Widget* sender)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode ();
|
||||
exit();
|
||||
}
|
||||
|
||||
void WaitDialog::onHourSliderChangedPosition(MyGUI::ScrollBar* sender, size_t position)
|
||||
|
|
|
@ -28,6 +28,8 @@ namespace MWGui
|
|||
|
||||
virtual void open();
|
||||
|
||||
virtual void exit();
|
||||
|
||||
void onFrame(float dt);
|
||||
|
||||
void bedActivated() { setCanRest(true); }
|
||||
|
|
|
@ -21,8 +21,13 @@ namespace MWGui
|
|||
// Events
|
||||
typedef MyGUI::delegates::CMultiDelegate1<WindowBase*> EventHandle_WindowBase;
|
||||
|
||||
///Unhides the window
|
||||
virtual void open() {}
|
||||
///Hides the window
|
||||
virtual void close () {}
|
||||
///Gracefully exits the window
|
||||
virtual void exit() {}
|
||||
///Sets the visibility of the window
|
||||
virtual void setVisible(bool visible);
|
||||
void center();
|
||||
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
|
||||
#include "../mwsound/soundmanagerimp.hpp"
|
||||
|
||||
#include "console.hpp"
|
||||
#include "journalwindow.hpp"
|
||||
#include "journalviewmodel.hpp"
|
||||
|
@ -666,6 +668,96 @@ namespace MWGui
|
|||
mGarbageDialogs.push_back(dialog);
|
||||
}
|
||||
|
||||
void WindowManager::exitCurrentGuiMode() {
|
||||
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_Levelup:
|
||||
mLevelupDialog->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:
|
||||
MWBase::Environment::get().getSoundManager()->playSound ("book close", 1.0, 1.0);
|
||||
removeGuiMode(GM_Journal); //Simple way to remove it
|
||||
break;
|
||||
default:
|
||||
// Unsupported mode, switch back to game
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void WindowManager::messageBox (const std::string& message, const std::vector<std::string>& buttons, enum MWGui::ShowInDialogueMode showInDialogueMode)
|
||||
{
|
||||
if (buttons.empty()) {
|
||||
|
|
|
@ -132,10 +132,10 @@ namespace MWGui
|
|||
virtual void forceHide(MWGui::GuiWindow wnd);
|
||||
virtual void unsetForceHide(MWGui::GuiWindow wnd);
|
||||
|
||||
// Disallow all inventory mode windows
|
||||
/// Disallow all inventory mode windows
|
||||
virtual void disallowAll();
|
||||
|
||||
// Allow one or more windows
|
||||
/// Allow one or more windows
|
||||
virtual void allow(GuiWindow wnd);
|
||||
|
||||
virtual bool isAllowed(GuiWindow wnd) const;
|
||||
|
@ -225,7 +225,11 @@ namespace MWGui
|
|||
|
||||
virtual void addVisitedLocation(const std::string& name, int x, int y);
|
||||
|
||||
virtual void removeDialog(OEngine::GUI::Layout* dialog); ///< Hides dialog and schedules dialog to be deleted.
|
||||
///Hides dialog and schedules dialog to be deleted.
|
||||
virtual void removeDialog(OEngine::GUI::Layout* dialog);
|
||||
|
||||
///Gracefully attempts to exit the topmost GUI mode
|
||||
virtual void exitCurrentGuiMode();
|
||||
|
||||
virtual void messageBox (const std::string& message, const std::vector<std::string>& buttons = std::vector<std::string>(), enum MWGui::ShowInDialogueMode showInDialogueMode = MWGui::ShowInDialogueMode_IfPossible);
|
||||
virtual void staticMessageBox(const std::string& message);
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
|
||||
#include "../mwdialogue/dialoguemanagerimp.hpp"
|
||||
|
||||
using namespace ICS;
|
||||
|
||||
namespace
|
||||
|
@ -633,19 +635,20 @@ namespace MWInput
|
|||
|
||||
void InputManager::toggleMainMenu()
|
||||
{
|
||||
if (MyGUI::InputManager::getInstance ().isModalAny())
|
||||
// TODO: Find a way to send an exit command to current Modal Widget
|
||||
if (MyGUI::InputManager::getInstance().isModalAny())
|
||||
return;
|
||||
|
||||
if (MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_MainMenu))
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||
MWBase::Environment::get().getSoundManager()->resumeSounds (MWBase::SoundManager::Play_TypeSfx);
|
||||
}
|
||||
else
|
||||
if(!MWBase::Environment::get().getWindowManager()->isGuiMode()) //No open GUIs, open up the MainMenu
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode (MWGui::GM_MainMenu);
|
||||
MWBase::Environment::get().getSoundManager()->pauseSounds (MWBase::SoundManager::Play_TypeSfx);
|
||||
}
|
||||
else //Close current GUI
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->exitCurrentGuiMode();
|
||||
MWBase::Environment::get().getSoundManager()->resumeSounds (MWBase::SoundManager::Play_TypeSfx);
|
||||
}
|
||||
}
|
||||
|
||||
void InputManager::quickLoad() {
|
||||
|
@ -761,8 +764,7 @@ namespace MWInput
|
|||
}
|
||||
else if(MWBase::Environment::get().getWindowManager()->getMode() == MWGui::GM_Journal)
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound ("book close", 1.0, 1.0);
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||
MWBase::Environment::get().getWindowManager()->exitCurrentGuiMode();
|
||||
}
|
||||
// .. but don't touch any other mode.
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue