mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-27 05:10:26 +00:00
Hide message boxes when HUD is hidden
This commit is contained in:
parent
4259f7f230
commit
d8cd5b361a
3 changed files with 17 additions and 3 deletions
|
@ -101,6 +101,8 @@ namespace MWGui
|
||||||
if(stat)
|
if(stat)
|
||||||
mStaticMessageBox = box;
|
mStaticMessageBox = box;
|
||||||
|
|
||||||
|
box->setVisible(mVisible);
|
||||||
|
|
||||||
mMessageBoxes.push_back(box);
|
mMessageBoxes.push_back(box);
|
||||||
|
|
||||||
if(mMessageBoxes.size() > 3) {
|
if(mMessageBoxes.size() > 3) {
|
||||||
|
@ -167,8 +169,12 @@ namespace MWGui
|
||||||
return pressed;
|
return pressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MessageBoxManager::setVisible(bool value)
|
||||||
|
{
|
||||||
|
mVisible = value;
|
||||||
|
for (MessageBox* messageBox : mMessageBoxes)
|
||||||
|
messageBox->setVisible(value);
|
||||||
|
}
|
||||||
|
|
||||||
MessageBox::MessageBox(MessageBoxManager& parMessageBoxManager, const std::string& message)
|
MessageBox::MessageBox(MessageBoxManager& parMessageBoxManager, const std::string& message)
|
||||||
: Layout("openmw_messagebox.layout")
|
: Layout("openmw_messagebox.layout")
|
||||||
|
@ -201,7 +207,10 @@ namespace MWGui
|
||||||
return mMainWidget->getHeight()+mNextBoxPadding;
|
return mMainWidget->getHeight()+mNextBoxPadding;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MessageBox::setVisible(bool value)
|
||||||
|
{
|
||||||
|
mMainWidget->setVisible(value);
|
||||||
|
}
|
||||||
|
|
||||||
InteractiveMessageBox::InteractiveMessageBox(MessageBoxManager& parMessageBoxManager, const std::string& message, const std::vector<std::string>& buttons)
|
InteractiveMessageBox::InteractiveMessageBox(MessageBoxManager& parMessageBoxManager, const std::string& message, const std::vector<std::string>& buttons)
|
||||||
: WindowModal(MWBase::Environment::get().getWindowManager()->isGuiMode() ? "openmw_interactive_messagebox_notransp.layout" : "openmw_interactive_messagebox.layout")
|
: WindowModal(MWBase::Environment::get().getWindowManager()->isGuiMode() ? "openmw_interactive_messagebox_notransp.layout" : "openmw_interactive_messagebox.layout")
|
||||||
|
|
|
@ -47,12 +47,15 @@ namespace MWGui
|
||||||
|
|
||||||
void onButtonPressed(int button) { eventButtonPressed(button); eventButtonPressed.clear(); }
|
void onButtonPressed(int button) { eventButtonPressed(button); eventButtonPressed.clear(); }
|
||||||
|
|
||||||
|
void setVisible(bool value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<MessageBox*> mMessageBoxes;
|
std::vector<MessageBox*> mMessageBoxes;
|
||||||
InteractiveMessageBox* mInterMessageBoxe;
|
InteractiveMessageBox* mInterMessageBoxe;
|
||||||
MessageBox* mStaticMessageBox;
|
MessageBox* mStaticMessageBox;
|
||||||
float mMessageBoxSpeed;
|
float mMessageBoxSpeed;
|
||||||
int mLastButtonPressed;
|
int mLastButtonPressed;
|
||||||
|
bool mVisible = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MessageBox : public Layout
|
class MessageBox : public Layout
|
||||||
|
@ -62,6 +65,7 @@ namespace MWGui
|
||||||
void setMessage (const std::string& message);
|
void setMessage (const std::string& message);
|
||||||
int getHeight ();
|
int getHeight ();
|
||||||
void update (int height);
|
void update (int height);
|
||||||
|
void setVisible(bool value);
|
||||||
|
|
||||||
float mCurrentTime;
|
float mCurrentTime;
|
||||||
float mMaxTime;
|
float mMaxTime;
|
||||||
|
|
|
@ -1499,6 +1499,7 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
mHudEnabled = !mHudEnabled;
|
mHudEnabled = !mHudEnabled;
|
||||||
updateVisible();
|
updateVisible();
|
||||||
|
mMessageBoxManager->setVisible(mHudEnabled);
|
||||||
return mHudEnabled;
|
return mHudEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue