forked from mirror/openmw-tes3mp
Saner inventory window pinning/hiding
Hide inventory window pin button in container, companion and barter mode. Restore the pinned inventory window position when exiting these modes. Allow toggling windows visibility in inventory mode only.
This commit is contained in:
parent
076e7d8e16
commit
b2e5e8dd0d
4 changed files with 15 additions and 2 deletions
|
@ -94,16 +94,20 @@ namespace MWGui
|
||||||
mGuiMode = mode;
|
mGuiMode = mode;
|
||||||
switch(mode) {
|
switch(mode) {
|
||||||
case GM_Container:
|
case GM_Container:
|
||||||
|
setPinButtonVisible(false);
|
||||||
mMainWidget->setCoord(mPositionContainer);
|
mMainWidget->setCoord(mPositionContainer);
|
||||||
break;
|
break;
|
||||||
case GM_Companion:
|
case GM_Companion:
|
||||||
|
setPinButtonVisible(false);
|
||||||
mMainWidget->setCoord(mPositionCompanion);
|
mMainWidget->setCoord(mPositionCompanion);
|
||||||
break;
|
break;
|
||||||
case GM_Barter:
|
case GM_Barter:
|
||||||
|
setPinButtonVisible(false);
|
||||||
mMainWidget->setCoord(mPositionBarter);
|
mMainWidget->setCoord(mPositionBarter);
|
||||||
break;
|
break;
|
||||||
case GM_Inventory:
|
case GM_Inventory:
|
||||||
default:
|
default:
|
||||||
|
setPinButtonVisible(true);
|
||||||
mMainWidget->setCoord(mPositionInventory);
|
mMainWidget->setCoord(mPositionInventory);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -373,6 +373,7 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
mMap->setVisible(mMap->pinned());
|
mMap->setVisible(mMap->pinned());
|
||||||
mStatsWindow->setVisible(mStatsWindow->pinned());
|
mStatsWindow->setVisible(mStatsWindow->pinned());
|
||||||
|
mInventoryWindow->setGuiMode(GM_None);
|
||||||
mInventoryWindow->setVisible(mInventoryWindow->pinned());
|
mInventoryWindow->setVisible(mInventoryWindow->pinned());
|
||||||
mSpellWindow->setVisible(mSpellWindow->pinned());
|
mSpellWindow->setVisible(mSpellWindow->pinned());
|
||||||
|
|
||||||
|
@ -1117,6 +1118,9 @@ namespace MWGui
|
||||||
|
|
||||||
void WindowManager::toggleVisible (GuiWindow wnd)
|
void WindowManager::toggleVisible (GuiWindow wnd)
|
||||||
{
|
{
|
||||||
|
if (getMode() != GM_Inventory)
|
||||||
|
return;
|
||||||
|
|
||||||
mShown = (mShown & wnd) ? (GuiWindow) (mShown & ~wnd) : (GuiWindow) (mShown | wnd);
|
mShown = (mShown & wnd) ? (GuiWindow) (mShown & ~wnd) : (GuiWindow) (mShown | wnd);
|
||||||
updateVisible();
|
updateVisible();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
WindowPinnableBase::WindowPinnableBase(const std::string& parLayout)
|
WindowPinnableBase::WindowPinnableBase(const std::string& parLayout)
|
||||||
: WindowBase(parLayout), mPinned(false), mVisible(false)
|
: WindowBase(parLayout), mPinned(false)
|
||||||
{
|
{
|
||||||
ExposedWindow* window = static_cast<ExposedWindow*>(mMainWidget);
|
ExposedWindow* window = static_cast<ExposedWindow*>(mMainWidget);
|
||||||
mPinButton = window->getSkinWidget ("Button");
|
mPinButton = window->getSkinWidget ("Button");
|
||||||
|
@ -24,4 +24,9 @@ namespace MWGui
|
||||||
|
|
||||||
onPinToggled();
|
onPinToggled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WindowPinnableBase::setPinButtonVisible(bool visible)
|
||||||
|
{
|
||||||
|
mPinButton->setVisible(visible);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ namespace MWGui
|
||||||
public:
|
public:
|
||||||
WindowPinnableBase(const std::string& parLayout);
|
WindowPinnableBase(const std::string& parLayout);
|
||||||
bool pinned() { return mPinned; }
|
bool pinned() { return mPinned; }
|
||||||
|
void setPinButtonVisible(bool visible);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void onPinButtonClicked(MyGUI::Widget* _sender);
|
void onPinButtonClicked(MyGUI::Widget* _sender);
|
||||||
|
@ -21,7 +22,6 @@ namespace MWGui
|
||||||
|
|
||||||
MyGUI::Widget* mPinButton;
|
MyGUI::Widget* mPinButton;
|
||||||
bool mPinned;
|
bool mPinned;
|
||||||
bool mVisible;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue