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);
}
void InventoryWindow::onTitleDoubleClicked()
{
if (!mPinned)
MWBase::Environment::get().getWindowManager()->toggleVisible(GW_Inventory);
}
void InventoryWindow::useItem(const MWWorld::Ptr &ptr)
{
const std::string& script = ptr.getClass().getScript(ptr);

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

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

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

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

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

@ -591,4 +591,10 @@ namespace MWGui
{
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:
virtual void onPinToggled();
virtual void onTitleDoubleClicked();
};
}
#endif

@ -11,6 +11,17 @@ namespace MWGui
mPinButton = window->getSkinWidget ("Button");
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)
@ -25,6 +36,11 @@ namespace MWGui
onPinToggled();
}
void WindowPinnableBase::onDoubleClick(MyGUI::Widget *_sender)
{
onTitleDoubleClicked();
}
void WindowPinnableBase::setPinned(bool pinned)
{
if (pinned != mPinned)

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

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

Loading…
Cancel
Save