Permit to force hiding GUI windows

This commit is contained in:
Emanuel Guevel 2013-08-05 23:15:26 +02:00
parent df9d681a63
commit d054366460
3 changed files with 22 additions and 2 deletions

View file

@ -105,6 +105,9 @@ namespace MWBase
virtual void toggleVisible (MWGui::GuiWindow wnd) = 0; virtual void toggleVisible (MWGui::GuiWindow wnd) = 0;
virtual void forceHide(MWGui::GuiWindow wnd) = 0;
virtual void unsetForceHide(MWGui::GuiWindow wnd) = 0;
/// Disallow all inventory mode windows /// Disallow all inventory mode windows
virtual void disallowAll() = 0; virtual void disallowAll() = 0;

View file

@ -105,6 +105,7 @@ namespace MWGui
, mGui(NULL) , mGui(NULL)
, mGarbageDialogs() , mGarbageDialogs()
, mShown(GW_ALL) , mShown(GW_ALL)
, mForceHidden(GW_None)
, mAllowed(GW_ALL) , mAllowed(GW_ALL)
, mRestAllowed(true) , mRestAllowed(true)
, mShowFPSLevel(fpsLevel) , mShowFPSLevel(fpsLevel)
@ -435,7 +436,7 @@ namespace MWGui
// This is controlled both by what windows the // This is controlled both by what windows the
// user has opened/closed (the 'shown' variable) and by what // user has opened/closed (the 'shown' variable) and by what
// windows we are allowed to show (the 'allowed' var.) // windows we are allowed to show (the 'allowed' var.)
int eff = mShown & mAllowed; int eff = mShown & mAllowed & ~mForceHidden;
// Show the windows we want // Show the windows we want
mMap ->setVisible(eff & GW_Map); mMap ->setVisible(eff & GW_Map);
@ -1117,7 +1118,19 @@ namespace MWGui
void WindowManager::toggleVisible (GuiWindow wnd) void WindowManager::toggleVisible (GuiWindow wnd)
{ {
mShown = (mShown & wnd) ? (GuiWindow) (mShown & ~wnd) : (GuiWindow) (mShown | wnd); mShown = (GuiWindow)(mShown ^ wnd);
updateVisible();
}
void WindowManager::forceHide(GuiWindow wnd)
{
mForceHidden = (GuiWindow)(mForceHidden | wnd);
updateVisible();
}
void WindowManager::unsetForceHide(GuiWindow wnd)
{
mForceHidden = (GuiWindow)(mForceHidden & ~wnd);
updateVisible(); updateVisible();
} }

View file

@ -115,6 +115,9 @@ namespace MWGui
virtual void toggleVisible(GuiWindow wnd); virtual void toggleVisible(GuiWindow wnd);
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(); virtual void disallowAll();
@ -334,6 +337,7 @@ namespace MWGui
void cleanupGarbage(); void cleanupGarbage();
GuiWindow mShown; // Currently shown windows in inventory mode GuiWindow mShown; // Currently shown windows in inventory mode
GuiWindow mForceHidden; // Hidden windows (overrides mShown)
/* Currently ALLOWED windows in inventory mode. This is used at /* Currently ALLOWED windows in inventory mode. This is used at
the start of the game, when windows are enabled one by one the start of the game, when windows are enabled one by one