mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-02 21:09:40 +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)
|
||||
mStaticMessageBox = box;
|
||||
|
||||
box->setVisible(mVisible);
|
||||
|
||||
mMessageBoxes.push_back(box);
|
||||
|
||||
if(mMessageBoxes.size() > 3) {
|
||||
|
@ -167,8 +169,12 @@ namespace MWGui
|
|||
return pressed;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MessageBoxManager::setVisible(bool value)
|
||||
{
|
||||
mVisible = value;
|
||||
for (MessageBox* messageBox : mMessageBoxes)
|
||||
messageBox->setVisible(value);
|
||||
}
|
||||
|
||||
MessageBox::MessageBox(MessageBoxManager& parMessageBoxManager, const std::string& message)
|
||||
: Layout("openmw_messagebox.layout")
|
||||
|
@ -201,7 +207,10 @@ namespace MWGui
|
|||
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)
|
||||
: 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 setVisible(bool value);
|
||||
|
||||
private:
|
||||
std::vector<MessageBox*> mMessageBoxes;
|
||||
InteractiveMessageBox* mInterMessageBoxe;
|
||||
MessageBox* mStaticMessageBox;
|
||||
float mMessageBoxSpeed;
|
||||
int mLastButtonPressed;
|
||||
bool mVisible = true;
|
||||
};
|
||||
|
||||
class MessageBox : public Layout
|
||||
|
@ -62,6 +65,7 @@ namespace MWGui
|
|||
void setMessage (const std::string& message);
|
||||
int getHeight ();
|
||||
void update (int height);
|
||||
void setVisible(bool value);
|
||||
|
||||
float mCurrentTime;
|
||||
float mMaxTime;
|
||||
|
|
|
@ -1499,6 +1499,7 @@ namespace MWGui
|
|||
{
|
||||
mHudEnabled = !mHudEnabled;
|
||||
updateVisible();
|
||||
mMessageBoxManager->setVisible(mHudEnabled);
|
||||
return mHudEnabled;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue