1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 15:35:23 +00:00

Use mouse pressed event for pin button instead of mouse click

This commit is contained in:
scrawl 2015-01-31 16:26:34 +01:00
parent c093e284d9
commit 54e79c8c98
2 changed files with 7 additions and 4 deletions

View File

@ -12,7 +12,7 @@ namespace MWGui
ExposedWindow* window = mMainWidget->castType<ExposedWindow>();
mPinButton = window->getSkinWidget ("Button");
mPinButton->eventMouseButtonClick += MyGUI::newDelegate(this, &WindowPinnableBase::onPinButtonClicked);
mPinButton->eventMouseButtonPressed += MyGUI::newDelegate(this, &WindowPinnableBase::onPinButtonPressed);
MyGUI::Button* button = NULL;
MyGUI::VectorWidgetPtr widgets = window->getSkinWidgetsByName("Action");
@ -26,8 +26,11 @@ namespace MWGui
button->eventMouseButtonDoubleClick += MyGUI::newDelegate(this, &WindowPinnableBase::onDoubleClick);
}
void WindowPinnableBase::onPinButtonClicked(MyGUI::Widget* _sender)
void WindowPinnableBase::onPinButtonPressed(MyGUI::Widget* _sender, int left, int top, MyGUI::MouseButton id)
{
if (id != MyGUI::MouseButton::Left)
return;
mPinned = !mPinned;
if (mPinned)
@ -46,7 +49,7 @@ namespace MWGui
void WindowPinnableBase::setPinned(bool pinned)
{
if (pinned != mPinned)
onPinButtonClicked(mPinButton);
onPinButtonPressed(mPinButton, 0, 0, MyGUI::MouseButton::Left);
}
void WindowPinnableBase::setPinButtonVisible(bool visible)

View File

@ -16,7 +16,7 @@ namespace MWGui
void setPinButtonVisible(bool visible);
private:
void onPinButtonClicked(MyGUI::Widget* _sender);
void onPinButtonPressed(MyGUI::Widget* _sender, int left, int top, MyGUI::MouseButton id);
void onDoubleClick(MyGUI::Widget* _sender);
protected: