Implement hiding inventory windows by double click on caption (Fixes #1690)

deque
scrawl 11 years ago
parent 2e7b5fde7c
commit 44b517f66d

@ -373,6 +373,12 @@ namespace MWGui
MWBase::Environment::get().getWindowManager()->setWeaponVisibility(!mPinned); MWBase::Environment::get().getWindowManager()->setWeaponVisibility(!mPinned);
} }
void InventoryWindow::onTitleDoubleClicked()
{
if (!mPinned)
MWBase::Environment::get().getWindowManager()->toggleVisible(GW_Inventory);
}
void InventoryWindow::useItem(const MWWorld::Ptr &ptr) void InventoryWindow::useItem(const MWWorld::Ptr &ptr)
{ {
const std::string& script = ptr.getClass().getScript(ptr); const std::string& script = ptr.getClass().getScript(ptr);

@ -98,6 +98,7 @@ namespace MWGui
void onFilterChanged(MyGUI::Widget* _sender); void onFilterChanged(MyGUI::Widget* _sender);
void onAvatarClicked(MyGUI::Widget* _sender); void onAvatarClicked(MyGUI::Widget* _sender);
void onPinToggled(); void onPinToggled();
void onTitleDoubleClicked();
void updateEncumbranceBar(); void updateEncumbranceBar();
void notifyContentChanged(); void notifyContentChanged();

@ -536,6 +536,12 @@ namespace MWGui
MWBase::Environment::get().getWindowManager()->setMinimapVisibility(!mPinned); MWBase::Environment::get().getWindowManager()->setMinimapVisibility(!mPinned);
} }
void MapWindow::onTitleDoubleClicked()
{
if (!mPinned)
MWBase::Environment::get().getWindowManager()->toggleVisible(GW_Map);
}
void MapWindow::open() void MapWindow::open()
{ {
// force markers to foreground // force markers to foreground

@ -150,6 +150,7 @@ namespace MWGui
protected: protected:
virtual void onPinToggled(); virtual void onPinToggled();
virtual void onTitleDoubleClicked();
virtual void notifyPlayerUpdate(); virtual void notifyPlayerUpdate();
virtual void notifyMapChanged(); virtual void notifyMapChanged();

@ -66,6 +66,12 @@ namespace MWGui
MWBase::Environment::get().getWindowManager()->setSpellVisibility(!mPinned); MWBase::Environment::get().getWindowManager()->setSpellVisibility(!mPinned);
} }
void SpellWindow::onTitleDoubleClicked()
{
if (!mPinned)
MWBase::Environment::get().getWindowManager()->toggleVisible(GW_Magic);
}
void SpellWindow::open() void SpellWindow::open()
{ {
updateSpells(); updateSpells();

@ -42,6 +42,7 @@ namespace MWGui
void onDeleteSpellAccept(); void onDeleteSpellAccept();
virtual void onPinToggled(); virtual void onPinToggled();
virtual void onTitleDoubleClicked();
virtual void open(); virtual void open();
SpellIcons* mSpellIcons; SpellIcons* mSpellIcons;

@ -591,4 +591,10 @@ namespace MWGui
{ {
MWBase::Environment::get().getWindowManager()->setHMSVisibility(!mPinned); MWBase::Environment::get().getWindowManager()->setHMSVisibility(!mPinned);
} }
void StatsWindow::onTitleDoubleClicked()
{
if (!mPinned)
MWBase::Environment::get().getWindowManager()->toggleVisible(GW_Stats);
}
} }

@ -74,6 +74,7 @@ namespace MWGui
protected: protected:
virtual void onPinToggled(); virtual void onPinToggled();
virtual void onTitleDoubleClicked();
}; };
} }
#endif #endif

@ -11,6 +11,17 @@ namespace MWGui
mPinButton = window->getSkinWidget ("Button"); mPinButton = window->getSkinWidget ("Button");
mPinButton->eventMouseButtonClick += MyGUI::newDelegate(this, &WindowPinnableBase::onPinButtonClicked); mPinButton->eventMouseButtonClick += MyGUI::newDelegate(this, &WindowPinnableBase::onPinButtonClicked);
MyGUI::Button* button = NULL;
MyGUI::VectorWidgetPtr widgets = window->getSkinWidgetsByName("Action");
for (MyGUI::VectorWidgetPtr::iterator it = widgets.begin(); it != widgets.end(); ++it)
{
if ((*it)->isUserString("HideWindowOnDoubleClick"))
button = (*it)->castType<MyGUI::Button>();
}
if (button)
button->eventMouseButtonDoubleClick += MyGUI::newDelegate(this, &WindowPinnableBase::onDoubleClick);
} }
void WindowPinnableBase::onPinButtonClicked(MyGUI::Widget* _sender) void WindowPinnableBase::onPinButtonClicked(MyGUI::Widget* _sender)
@ -25,6 +36,11 @@ namespace MWGui
onPinToggled(); onPinToggled();
} }
void WindowPinnableBase::onDoubleClick(MyGUI::Widget *_sender)
{
onTitleDoubleClicked();
}
void WindowPinnableBase::setPinned(bool pinned) void WindowPinnableBase::setPinned(bool pinned)
{ {
if (pinned != mPinned) if (pinned != mPinned)

@ -17,9 +17,11 @@ namespace MWGui
private: private:
void onPinButtonClicked(MyGUI::Widget* _sender); void onPinButtonClicked(MyGUI::Widget* _sender);
void onDoubleClick(MyGUI::Widget* _sender);
protected: protected:
virtual void onPinToggled() = 0; virtual void onPinToggled() = 0;
virtual void onTitleDoubleClicked() = 0;
MyGUI::Widget* mPinButton; MyGUI::Widget* mPinButton;
bool mPinned; bool mPinned;

@ -829,6 +829,7 @@
window by dragging the caption. --> window by dragging the caption. -->
<Child type="Button" offset="4 4 248 20" align="HStretch Top" name="Action"> <Child type="Button" offset="4 4 248 20" align="HStretch Top" name="Action">
<Property key="Scale" value="1 1 0 0"/> <Property key="Scale" value="1 1 0 0"/>
<Property key="HideWindowOnDoubleClick" value="1"/>
</Child> </Child>
<Child type="Button" skin="PinUp" offset="232 4 19 19" align="Right Top" name="Button"/> <Child type="Button" skin="PinUp" offset="232 4 19 19" align="Right Top" name="Button"/>

Loading…
Cancel
Save