2023-05-13 15:17:57 +02:00
|
|
|
using System;
|
|
|
|
|
|
|
|
namespace Quik
|
|
|
|
{
|
|
|
|
public enum MouseButton
|
|
|
|
{
|
|
|
|
Primary = 1 << 0,
|
|
|
|
Secondary = 1 << 1,
|
|
|
|
Tertiary = 1 << 2,
|
|
|
|
Auxilliary1 = 1 << 3,
|
|
|
|
Auxilliary2 = 1 << 4,
|
|
|
|
Auxilliary3 = 1 << 5,
|
|
|
|
Auxilliary4 = 1 << 6,
|
|
|
|
Auxilliary5 = 1 << 8,
|
|
|
|
}
|
|
|
|
|
|
|
|
public struct MouseState
|
|
|
|
{
|
2023-06-29 09:42:02 +02:00
|
|
|
public readonly QVec2 AbsolutePosition;
|
2023-05-13 15:17:57 +02:00
|
|
|
public readonly MouseButton ButtonsDown;
|
|
|
|
|
2023-06-29 09:42:02 +02:00
|
|
|
public MouseState(QVec2 position, MouseButton down)
|
2023-05-13 15:17:57 +02:00
|
|
|
{
|
|
|
|
AbsolutePosition = position;
|
|
|
|
ButtonsDown = down;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public class MouseButtonEventArgs : EventArgs
|
|
|
|
{
|
2023-06-29 09:42:02 +02:00
|
|
|
public QVec2 AbsolutePosition { get; }
|
2023-05-13 15:17:57 +02:00
|
|
|
public MouseButton Buttons { get; }
|
|
|
|
|
2023-06-29 09:42:02 +02:00
|
|
|
public MouseButtonEventArgs(QVec2 position, MouseButton buttons)
|
2023-05-13 15:17:57 +02:00
|
|
|
{
|
|
|
|
AbsolutePosition = position;
|
|
|
|
Buttons = buttons;
|
|
|
|
}
|
|
|
|
|
2023-06-29 09:42:02 +02:00
|
|
|
public QVec2 RelativePosition(QVec2 origin)
|
2023-05-13 15:17:57 +02:00
|
|
|
{
|
|
|
|
return AbsolutePosition - origin;
|
|
|
|
}
|
|
|
|
|
2023-07-28 21:37:13 +02:00
|
|
|
// public QVec2 RelativePosition(Controls.Control control)
|
|
|
|
// {
|
|
|
|
// return AbsolutePosition - control.AbsoluteBounds.Min;
|
|
|
|
// }
|
2023-05-13 15:17:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public class MouseMoveEventArgs : EventArgs
|
|
|
|
{
|
2023-06-29 09:42:02 +02:00
|
|
|
public QVec2 AbsolutePosition { get; }
|
|
|
|
public QVec2 LastPosition { get; }
|
|
|
|
public QVec2 Motion { get; }
|
2023-05-13 15:17:57 +02:00
|
|
|
|
2023-06-29 09:42:02 +02:00
|
|
|
public MouseMoveEventArgs(QVec2 position, QVec2 lastPosition)
|
2023-05-13 15:17:57 +02:00
|
|
|
{
|
|
|
|
AbsolutePosition = position;
|
|
|
|
LastPosition = lastPosition;
|
|
|
|
Motion = position - lastPosition;
|
|
|
|
}
|
|
|
|
|
2023-06-29 09:42:02 +02:00
|
|
|
public QVec2 RelativePosition(QVec2 origin)
|
2023-05-13 15:17:57 +02:00
|
|
|
{
|
|
|
|
return AbsolutePosition - origin;
|
|
|
|
}
|
|
|
|
|
2023-07-28 21:37:13 +02:00
|
|
|
// public QVec2 RelativePosition(Controls.Control control)
|
|
|
|
// {
|
|
|
|
// return AbsolutePosition - control.AbsoluteBounds.Min;
|
|
|
|
// }
|
2023-05-13 15:17:57 +02:00
|
|
|
}
|
|
|
|
}
|