1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-07-04 23:36:00 +02:00

Support for Forward/Backward mouse buttons

This commit is contained in:
Brian Fiete 2020-09-03 08:14:24 -07:00
parent 37f73f3345
commit 0347f997f2
3 changed files with 48 additions and 4 deletions

View file

@ -23,6 +23,7 @@ namespace Beefy.widgets
public Event<MouseLeftWindowHandler> mOnMouseLeftWindow ~ _.Dispose();
public Event<WindowLostFocusHandler> mOnWindowLostFocus ~ _.Dispose();
public Event<MouseEventHandler> mOnMouseDown ~ _.Dispose();
public Event<MouseEventHandler> mOnMouseUp ~ _.Dispose();
public Event<WindowCloseQueryHandler> mOnWindowCloseQuery ~ _.Dispose();
public Event<WindowClosedHandler> mOnWindowClosed ~ _.Dispose();
public Event<WindowMovedHandler> mOnWindowMoved ~ _.Dispose();
@ -653,12 +654,17 @@ namespace Beefy.widgets
anEvent.mSender = this;
anEvent.mX = x;
anEvent.mY = y;
anEvent.mBtn = btn;
anEvent.mBtnCount = btnCount;
mOnMouseDown(anEvent);
sOnMouseDown(anEvent);
if (anEvent.mHandled)
return;
}
if (btn >= 3) // X button - don't pass on to widgets
return;
Widget aWidget = mCaptureWidget ?? mOverWidget;
if (aWidget != null)
{
@ -679,6 +685,26 @@ namespace Beefy.widgets
MouseMove(inX, inY);
mMouseFlags &= (MouseFlag)(~(1 << btn));
float x;
float y;
TranslateMouseCoords(inX, inY, out x, out y);
if (mOnMouseUp.HasListeners)
{
MouseEvent anEvent = scope MouseEvent();
anEvent.mSender = this;
anEvent.mX = x;
anEvent.mY = y;
anEvent.mBtn = btn;
mOnMouseUp(anEvent);
if (anEvent.mHandled)
return;
}
if (btn >= 3) // X button - don't pass on to widgets
return;
Widget aWidget = mCaptureWidget ?? mOverWidget;
if (aWidget != null)
{