Change the way pinnable window are made visible

This ensure pinned window are not displayed in main menu, dialogue and
container mode.
This commit is contained in:
Emanuel Guevel 2013-02-16 20:56:17 +01:00
parent 0713afb97d
commit 43d6392921
3 changed files with 14 additions and 12 deletions

View file

@ -11,16 +11,6 @@ WindowPinnableBase::WindowPinnableBase(const std::string& parLayout, MWBase::Win
t->eventWindowButtonPressed += MyGUI::newDelegate(this, &WindowPinnableBase::onWindowButtonPressed); t->eventWindowButtonPressed += MyGUI::newDelegate(this, &WindowPinnableBase::onWindowButtonPressed);
} }
void WindowPinnableBase::setVisible(bool b)
{
// Pinned windows can not be hidden
if (mPinned && !b)
return;
WindowBase::setVisible(b);
mVisible = b;
}
void WindowPinnableBase::onWindowButtonPressed(MyGUI::Window* sender, const std::string& eventName) void WindowPinnableBase::onWindowButtonPressed(MyGUI::Window* sender, const std::string& eventName)
{ {
if ("PinToggle" == eventName) if ("PinToggle" == eventName)

View file

@ -11,7 +11,6 @@ namespace MWGui
{ {
public: public:
WindowPinnableBase(const std::string& parLayout, MWBase::WindowManager& parWindowManager); WindowPinnableBase(const std::string& parLayout, MWBase::WindowManager& parWindowManager);
void setVisible(bool b);
bool pinned() { return mPinned; } bool pinned() { return mPinned; }
private: private:

View file

@ -310,9 +310,16 @@ void WindowManager::updateVisible()
setSpellVisibility((mAllowed & GW_Magic) && !mSpellWindow->pinned()); setSpellVisibility((mAllowed & GW_Magic) && !mSpellWindow->pinned());
setHMSVisibility((mAllowed & GW_Stats) && !mStatsWindow->pinned()); setHMSVisibility((mAllowed & GW_Stats) && !mStatsWindow->pinned());
// If in game mode, don't show anything. // If in game mode, show only the pinned windows
if (gameMode) if (gameMode)
{
mMap->setVisible(mMap->pinned());
mStatsWindow->setVisible(mStatsWindow->pinned());
mInventoryWindow->setVisible(mInventoryWindow->pinned());
mSpellWindow->setVisible(mSpellWindow->pinned());
return; return;
}
GuiMode mode = mGuiModes.back(); GuiMode mode = mGuiModes.back();
@ -327,6 +334,12 @@ void WindowManager::updateVisible()
mSettingsWindow->setVisible(true); mSettingsWindow->setVisible(true);
break; break;
case GM_Console: case GM_Console:
// Show the pinned windows
mMap->setVisible(mMap->pinned());
mStatsWindow->setVisible(mStatsWindow->pinned());
mInventoryWindow->setVisible(mInventoryWindow->pinned());
mSpellWindow->setVisible(mSpellWindow->pinned());
mConsole->enable(); mConsole->enable();
break; break;
case GM_Scroll: case GM_Scroll: