|
|
@ -19,45 +19,75 @@ namespace Avalonia.Input |
|
|
public static readonly AttachedProperty<bool> IsHoldWithMouseEnabledProperty = |
|
|
public static readonly AttachedProperty<bool> IsHoldWithMouseEnabledProperty = |
|
|
AvaloniaProperty.RegisterAttached<StyledElement, bool>("IsHoldWithMouseEnabled", typeof(InputElement), false); |
|
|
AvaloniaProperty.RegisterAttached<StyledElement, bool>("IsHoldWithMouseEnabled", typeof(InputElement), false); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Defines the <see cref="Pinch"/> event.
|
|
|
|
|
|
/// </summary>
|
|
|
public static readonly RoutedEvent<PinchEventArgs> PinchEvent = |
|
|
public static readonly RoutedEvent<PinchEventArgs> PinchEvent = |
|
|
RoutedEvent.Register<PinchEventArgs>( |
|
|
RoutedEvent.Register<InputElement, PinchEventArgs>( |
|
|
"Pinch", RoutingStrategies.Bubble, typeof(InputElement)); |
|
|
nameof(Pinch), RoutingStrategies.Bubble); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Defines the <see cref="PinchEnded"/> event.
|
|
|
|
|
|
/// </summary>
|
|
|
public static readonly RoutedEvent<PinchEndedEventArgs> PinchEndedEvent = |
|
|
public static readonly RoutedEvent<PinchEndedEventArgs> PinchEndedEvent = |
|
|
RoutedEvent.Register<PinchEndedEventArgs>( |
|
|
RoutedEvent.Register<InputElement, PinchEndedEventArgs>( |
|
|
"PinchEnded", RoutingStrategies.Bubble, typeof(InputElement)); |
|
|
nameof(PinchEnded), RoutingStrategies.Bubble); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Defines the <see cref="PullGesture"/> event.
|
|
|
|
|
|
/// </summary>
|
|
|
public static readonly RoutedEvent<PullGestureEventArgs> PullGestureEvent = |
|
|
public static readonly RoutedEvent<PullGestureEventArgs> PullGestureEvent = |
|
|
RoutedEvent.Register<PullGestureEventArgs>( |
|
|
RoutedEvent.Register<InputElement, PullGestureEventArgs>( |
|
|
"PullGesture", RoutingStrategies.Bubble, typeof(InputElement)); |
|
|
nameof(PullGesture), RoutingStrategies.Bubble); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Defines the <see cref="PullGestureEnded"/> event.
|
|
|
|
|
|
/// </summary>
|
|
|
public static readonly RoutedEvent<PullGestureEndedEventArgs> PullGestureEndedEvent = |
|
|
public static readonly RoutedEvent<PullGestureEndedEventArgs> PullGestureEndedEvent = |
|
|
RoutedEvent.Register<PullGestureEndedEventArgs>( |
|
|
RoutedEvent.Register<InputElement, PullGestureEndedEventArgs>( |
|
|
"PullGestureEnded", RoutingStrategies.Bubble, typeof(InputElement)); |
|
|
nameof(PullGestureEnded), RoutingStrategies.Bubble); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Defines the <see cref="ScrollGesture"/> event.
|
|
|
|
|
|
/// </summary>
|
|
|
public static readonly RoutedEvent<ScrollGestureEventArgs> ScrollGestureEvent = |
|
|
public static readonly RoutedEvent<ScrollGestureEventArgs> ScrollGestureEvent = |
|
|
RoutedEvent.Register<ScrollGestureEventArgs>( |
|
|
RoutedEvent.Register<InputElement, ScrollGestureEventArgs>( |
|
|
"ScrollGesture", RoutingStrategies.Bubble, typeof(InputElement)); |
|
|
nameof(ScrollGesture), RoutingStrategies.Bubble); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Defines the <see cref="ScrollGestureInertiaStarting"/> event.
|
|
|
|
|
|
/// </summary>
|
|
|
public static readonly RoutedEvent<ScrollGestureInertiaStartingEventArgs> ScrollGestureInertiaStartingEvent = |
|
|
public static readonly RoutedEvent<ScrollGestureInertiaStartingEventArgs> ScrollGestureInertiaStartingEvent = |
|
|
RoutedEvent.Register<ScrollGestureInertiaStartingEventArgs>( |
|
|
RoutedEvent.Register<InputElement, ScrollGestureInertiaStartingEventArgs>( |
|
|
"ScrollGestureInertiaStarting", RoutingStrategies.Bubble, typeof(InputElement)); |
|
|
nameof(ScrollGestureInertiaStarting), RoutingStrategies.Bubble); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Defines the <see cref="ScrollGestureEnded"/> event.
|
|
|
|
|
|
/// </summary>
|
|
|
public static readonly RoutedEvent<ScrollGestureEndedEventArgs> ScrollGestureEndedEvent = |
|
|
public static readonly RoutedEvent<ScrollGestureEndedEventArgs> ScrollGestureEndedEvent = |
|
|
RoutedEvent.Register<ScrollGestureEndedEventArgs>( |
|
|
RoutedEvent.Register<InputElement, ScrollGestureEndedEventArgs>( |
|
|
"ScrollGestureEnded", RoutingStrategies.Bubble, typeof(InputElement)); |
|
|
nameof(ScrollGestureEnded), RoutingStrategies.Bubble); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Defines the <see cref="PointerTouchPadGestureMagnify"/> event.
|
|
|
|
|
|
/// </summary>
|
|
|
public static readonly RoutedEvent<PointerDeltaEventArgs> PointerTouchPadGestureMagnifyEvent = |
|
|
public static readonly RoutedEvent<PointerDeltaEventArgs> PointerTouchPadGestureMagnifyEvent = |
|
|
RoutedEvent.Register<PointerDeltaEventArgs>( |
|
|
RoutedEvent.Register<InputElement, PointerDeltaEventArgs>( |
|
|
"PointerTouchPadGestureMagnify", RoutingStrategies.Bubble, typeof(InputElement)); |
|
|
nameof(PointerTouchPadGestureMagnify), RoutingStrategies.Bubble); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Defines the <see cref="PointerTouchPadGestureRotate"/> event.
|
|
|
|
|
|
/// </summary>
|
|
|
public static readonly RoutedEvent<PointerDeltaEventArgs> PointerTouchPadGestureRotateEvent = |
|
|
public static readonly RoutedEvent<PointerDeltaEventArgs> PointerTouchPadGestureRotateEvent = |
|
|
RoutedEvent.Register<PointerDeltaEventArgs>( |
|
|
RoutedEvent.Register<InputElement, PointerDeltaEventArgs>( |
|
|
"PointerTouchPadGestureRotate", RoutingStrategies.Bubble, typeof(InputElement)); |
|
|
nameof(PointerTouchPadGestureRotate), RoutingStrategies.Bubble); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Defines the <see cref="PointerTouchPadGestureSwipe"/> event.
|
|
|
|
|
|
/// </summary>
|
|
|
public static readonly RoutedEvent<PointerDeltaEventArgs> PointerTouchPadGestureSwipeEvent = |
|
|
public static readonly RoutedEvent<PointerDeltaEventArgs> PointerTouchPadGestureSwipeEvent = |
|
|
RoutedEvent.Register<PointerDeltaEventArgs>( |
|
|
RoutedEvent.Register<InputElement, PointerDeltaEventArgs>( |
|
|
"PointerTouchPadGestureSwipe", RoutingStrategies.Bubble, typeof(InputElement)); |
|
|
nameof(PointerTouchPadGestureSwipe), RoutingStrategies.Bubble); |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Defines the <see cref="Tapped"/> event.
|
|
|
/// Defines the <see cref="Tapped"/> event.
|
|
|
@ -95,6 +125,7 @@ namespace Avalonia.Input |
|
|
{ |
|
|
{ |
|
|
return element.GetValue(IsHoldingEnabledProperty); |
|
|
return element.GetValue(IsHoldingEnabledProperty); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public static void SetIsHoldingEnabled(StyledElement element, bool value) |
|
|
public static void SetIsHoldingEnabled(StyledElement element, bool value) |
|
|
{ |
|
|
{ |
|
|
element.SetValue(IsHoldingEnabledProperty, value); |
|
|
element.SetValue(IsHoldingEnabledProperty, value); |
|
|
@ -104,70 +135,101 @@ namespace Avalonia.Input |
|
|
{ |
|
|
{ |
|
|
return element.GetValue(IsHoldWithMouseEnabledProperty); |
|
|
return element.GetValue(IsHoldWithMouseEnabledProperty); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public static void SetIsHoldWithMouseEnabled(StyledElement element, bool value) |
|
|
public static void SetIsHoldWithMouseEnabled(StyledElement element, bool value) |
|
|
{ |
|
|
{ |
|
|
element.SetValue(IsHoldWithMouseEnabledProperty, value); |
|
|
element.SetValue(IsHoldWithMouseEnabledProperty, value); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public static void AddPinchHandler(Interactive element, EventHandler<PinchEventArgs> handler) => |
|
|
/// <summary>
|
|
|
element.AddHandler(PinchEvent, handler); |
|
|
/// Occurs when a pinch gesture occurs on the control.
|
|
|
|
|
|
/// </summary>
|
|
|
public static void AddPinchEndedHandler(Interactive element, EventHandler<PinchEndedEventArgs> handler) => |
|
|
public event EventHandler<PinchEventArgs>? Pinch |
|
|
element.AddHandler(PinchEndedEvent, handler); |
|
|
{ |
|
|
|
|
|
add { AddHandler(PinchEvent, value); } |
|
|
public static void AddPullGestureHandler(Interactive element, EventHandler<PullGestureEventArgs> handler) => |
|
|
remove { RemoveHandler(PinchEvent, value); } |
|
|
element.AddHandler(PullGestureEvent, handler); |
|
|
} |
|
|
|
|
|
|
|
|
public static void AddPullGestureEndedHandler(Interactive element, EventHandler<PullGestureEndedEventArgs> handler) => |
|
|
|
|
|
element.AddHandler(PullGestureEndedEvent, handler); |
|
|
|
|
|
|
|
|
|
|
|
public static void RemovePinchHandler(Interactive element, EventHandler<PinchEventArgs> handler) => |
|
|
|
|
|
element.RemoveHandler(PinchEvent, handler); |
|
|
|
|
|
|
|
|
|
|
|
public static void RemovePinchEndedHandler(Interactive element, EventHandler<PinchEndedEventArgs> handler) => |
|
|
|
|
|
element.RemoveHandler(PinchEndedEvent, handler); |
|
|
|
|
|
|
|
|
|
|
|
public static void RemovePullGestureHandler(Interactive element, EventHandler<PullGestureEventArgs> handler) => |
|
|
|
|
|
element.RemoveHandler(PullGestureEvent, handler); |
|
|
|
|
|
|
|
|
|
|
|
public static void RemovePullGestureEndedHandler(Interactive element, EventHandler<PullGestureEndedEventArgs> handler) => |
|
|
|
|
|
element.RemoveHandler(PullGestureEndedEvent, handler); |
|
|
|
|
|
|
|
|
|
|
|
public static void AddPointerTouchPadGestureMagnifyHandler(Interactive element, EventHandler<PointerDeltaEventArgs> handler) => |
|
|
|
|
|
element.AddHandler(PointerTouchPadGestureMagnifyEvent, handler); |
|
|
|
|
|
|
|
|
|
|
|
public static void AddPointerTouchPadGestureRotateHandler(Interactive element, EventHandler<PointerDeltaEventArgs> handler) => |
|
|
|
|
|
element.AddHandler(PointerTouchPadGestureRotateEvent, handler); |
|
|
|
|
|
|
|
|
|
|
|
public static void AddPointerTouchPadGestureSwipeHandler(Interactive element, EventHandler<PointerDeltaEventArgs> handler) => |
|
|
|
|
|
element.AddHandler(PointerTouchPadGestureSwipeEvent, handler); |
|
|
|
|
|
|
|
|
|
|
|
public static void AddScrollGestureHandler(Interactive element, EventHandler<ScrollGestureEventArgs> handler) => |
|
|
/// <summary>
|
|
|
element.AddHandler(ScrollGestureEvent, handler); |
|
|
/// Occurs when a pinch gesture ends on the control.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public event EventHandler<PinchEndedEventArgs>? PinchEnded |
|
|
|
|
|
{ |
|
|
|
|
|
add { AddHandler(PinchEndedEvent, value); } |
|
|
|
|
|
remove { RemoveHandler(PinchEndedEvent, value); } |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public static void AddScrollGestureEndedHandler(Interactive element, EventHandler<ScrollGestureEndedEventArgs> handler) => |
|
|
/// <summary>
|
|
|
element.AddHandler(ScrollGestureEndedEvent, handler); |
|
|
/// Occurs when a pull gesture occurs on the control.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public event EventHandler<PullGestureEventArgs>? PullGesture |
|
|
|
|
|
{ |
|
|
|
|
|
add { AddHandler(PullGestureEvent, value); } |
|
|
|
|
|
remove { RemoveHandler(PullGestureEvent, value); } |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public static void AddScrollGestureInertiaStartingHandler(Interactive element, EventHandler<ScrollGestureInertiaStartingEventArgs> handler) => |
|
|
/// <summary>
|
|
|
element.AddHandler(ScrollGestureInertiaStartingEvent, handler); |
|
|
/// Occurs when a pull gesture ends on the control.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public event EventHandler<PullGestureEndedEventArgs>? PullGestureEnded |
|
|
|
|
|
{ |
|
|
|
|
|
add { AddHandler(PullGestureEndedEvent, value); } |
|
|
|
|
|
remove { RemoveHandler(PullGestureEndedEvent, value); } |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public static void RemovePointerTouchPadGestureMagnifyHandler(Interactive element, EventHandler<PointerDeltaEventArgs> handler) => |
|
|
/// <summary>
|
|
|
element.RemoveHandler(PointerTouchPadGestureMagnifyEvent, handler); |
|
|
/// Occurs when a scroll gesture occurs on the control.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public event EventHandler<ScrollGestureEventArgs>? ScrollGesture |
|
|
|
|
|
{ |
|
|
|
|
|
add { AddHandler(ScrollGestureEvent, value); } |
|
|
|
|
|
remove { RemoveHandler(ScrollGestureEvent, value); } |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public static void RemovePointerTouchPadGestureRotateHandler(Interactive element, EventHandler<PointerDeltaEventArgs> handler) => |
|
|
/// <summary>
|
|
|
element.RemoveHandler(PointerTouchPadGestureRotateEvent, handler); |
|
|
/// Occurs when a scroll gesture inertia starts on the control.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public event EventHandler<ScrollGestureInertiaStartingEventArgs>? ScrollGestureInertiaStarting |
|
|
|
|
|
{ |
|
|
|
|
|
add { AddHandler(ScrollGestureInertiaStartingEvent, value); } |
|
|
|
|
|
remove { RemoveHandler(ScrollGestureInertiaStartingEvent, value); } |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public static void RemovePointerTouchPadGestureSwipeHandler(Interactive element, EventHandler<PointerDeltaEventArgs> handler) => |
|
|
/// <summary>
|
|
|
element.RemoveHandler(PointerTouchPadGestureSwipeEvent, handler); |
|
|
/// Occurs when a scroll gesture ends on the control.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public event EventHandler<ScrollGestureEndedEventArgs>? ScrollGestureEnded |
|
|
|
|
|
{ |
|
|
|
|
|
add { AddHandler(ScrollGestureEndedEvent, value); } |
|
|
|
|
|
remove { RemoveHandler(ScrollGestureEndedEvent, value); } |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public static void RemoveScrollGestureHandler(Interactive element, EventHandler<ScrollGestureEventArgs> handler) => |
|
|
/// <summary>
|
|
|
element.RemoveHandler(ScrollGestureEvent, handler); |
|
|
/// Occurs when a touchpad magnify gesture occurs on the control.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public event EventHandler<PointerDeltaEventArgs>? PointerTouchPadGestureMagnify |
|
|
|
|
|
{ |
|
|
|
|
|
add { AddHandler(PointerTouchPadGestureMagnifyEvent, value); } |
|
|
|
|
|
remove { RemoveHandler(PointerTouchPadGestureMagnifyEvent, value); } |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public static void RemoveScrollGestureEndedHandler(Interactive element, EventHandler<ScrollGestureEndedEventArgs> handler) => |
|
|
/// <summary>
|
|
|
element.RemoveHandler(ScrollGestureEndedEvent, handler); |
|
|
/// Occurs when a touchpad rotate gesture occurs on the control.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public event EventHandler<PointerDeltaEventArgs>? PointerTouchPadGestureRotate |
|
|
|
|
|
{ |
|
|
|
|
|
add { AddHandler(PointerTouchPadGestureRotateEvent, value); } |
|
|
|
|
|
remove { RemoveHandler(PointerTouchPadGestureRotateEvent, value); } |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public static void RemoveScrollGestureInertiaStartingHandler(Interactive element, EventHandler<ScrollGestureInertiaStartingEventArgs> handler) => |
|
|
/// <summary>
|
|
|
element.RemoveHandler(ScrollGestureInertiaStartingEvent, handler); |
|
|
/// Occurs when a touchpad swipe gesture occurs on the control.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public event EventHandler<PointerDeltaEventArgs>? PointerTouchPadGestureSwipe |
|
|
|
|
|
{ |
|
|
|
|
|
add { AddHandler(PointerTouchPadGestureSwipeEvent, value); } |
|
|
|
|
|
remove { RemoveHandler(PointerTouchPadGestureSwipeEvent, value); } |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Occurs when a tap gesture occurs on the control.
|
|
|
/// Occurs when a tap gesture occurs on the control.
|
|
|
|