Use mouse pressed event for pin button instead of mouse click

openmw-35
scrawl 10 years ago
parent c093e284d9
commit 54e79c8c98

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

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

Loading…
Cancel
Save