diff --git a/src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Input/FocusChangedEventArgs.cs b/src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Input/FocusChangedEventArgs.cs index a739888be257..be7326881da0 100644 --- a/src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Input/FocusChangedEventArgs.cs +++ b/src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Input/FocusChangedEventArgs.cs @@ -3,17 +3,17 @@ #pragma warning disable 114 // new keyword hiding namespace Microsoft.UI.Input { -#if __ANDROID__ || __IOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ +#if false [global::Uno.NotImplemented] #endif public partial class FocusChangedEventArgs { -#if __ANDROID__ || __IOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ +#if false internal FocusChangedEventArgs() { } #endif -#if __ANDROID__ || __IOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ +#if false [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "IS_UNIT_TESTS", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public bool Handled { diff --git a/src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Input/FocusNavigationRequest.cs b/src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Input/FocusNavigationRequest.cs index 224dc61b92ab..a54bbceb5227 100644 --- a/src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Input/FocusNavigationRequest.cs +++ b/src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Input/FocusNavigationRequest.cs @@ -3,17 +3,17 @@ #pragma warning disable 114 // new keyword hiding namespace Microsoft.UI.Input { -#if __ANDROID__ || __IOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ +#if false [global::Uno.NotImplemented] #endif public partial class FocusNavigationRequest { -#if __ANDROID__ || __IOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ +#if false internal FocusNavigationRequest() { } #endif -#if __ANDROID__ || __IOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ +#if false [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "IS_UNIT_TESTS", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public global::System.Guid CorrelationId { @@ -23,7 +23,7 @@ internal FocusNavigationRequest() } } #endif -#if __ANDROID__ || __IOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ +#if false [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "IS_UNIT_TESTS", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public global::Windows.Foundation.Rect? HintRect { @@ -33,7 +33,7 @@ internal FocusNavigationRequest() } } #endif -#if __ANDROID__ || __IOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ +#if false [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "IS_UNIT_TESTS", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public global::Microsoft.UI.Input.FocusNavigationReason Reason { @@ -46,21 +46,21 @@ internal FocusNavigationRequest() // Forced skipping of method Microsoft.UI.Input.FocusNavigationRequest.Reason.get // Forced skipping of method Microsoft.UI.Input.FocusNavigationRequest.HintRect.get // Forced skipping of method Microsoft.UI.Input.FocusNavigationRequest.CorrelationId.get -#if __ANDROID__ || __IOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ +#if false [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "IS_UNIT_TESTS", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public static global::Microsoft.UI.Input.FocusNavigationRequest Create(global::Microsoft.UI.Input.FocusNavigationReason reason) { throw new global::System.NotImplementedException("The member FocusNavigationRequest FocusNavigationRequest.Create(FocusNavigationReason reason) is not implemented. For more information, visit https://aka.platform.uno/notimplemented#m=FocusNavigationRequest%20FocusNavigationRequest.Create%28FocusNavigationReason%20reason%29"); } #endif -#if __ANDROID__ || __IOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ +#if false [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "IS_UNIT_TESTS", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public static global::Microsoft.UI.Input.FocusNavigationRequest Create(global::Microsoft.UI.Input.FocusNavigationReason reason, global::Windows.Foundation.Rect hintRect) { throw new global::System.NotImplementedException("The member FocusNavigationRequest FocusNavigationRequest.Create(FocusNavigationReason reason, Rect hintRect) is not implemented. For more information, visit https://aka.platform.uno/notimplemented#m=FocusNavigationRequest%20FocusNavigationRequest.Create%28FocusNavigationReason%20reason%2C%20Rect%20hintRect%29"); } #endif -#if __ANDROID__ || __IOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ +#if false [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "IS_UNIT_TESTS", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public static global::Microsoft.UI.Input.FocusNavigationRequest Create(global::Microsoft.UI.Input.FocusNavigationReason reason, global::Windows.Foundation.Rect hintRect, global::System.Guid correlationId) { diff --git a/src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Input/FocusNavigationRequestEventArgs.cs b/src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Input/FocusNavigationRequestEventArgs.cs index 506dd12f52b1..e2d8a39385ec 100644 --- a/src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Input/FocusNavigationRequestEventArgs.cs +++ b/src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Input/FocusNavigationRequestEventArgs.cs @@ -3,17 +3,17 @@ #pragma warning disable 114 // new keyword hiding namespace Microsoft.UI.Input { -#if __ANDROID__ || __IOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ +#if false [global::Uno.NotImplemented] #endif public partial class FocusNavigationRequestEventArgs { -#if __ANDROID__ || __IOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ +#if false internal FocusNavigationRequestEventArgs() { } #endif -#if __ANDROID__ || __IOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ +#if false [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "IS_UNIT_TESTS", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public global::Microsoft.UI.Input.FocusNavigationResult Result { @@ -27,7 +27,7 @@ internal FocusNavigationRequestEventArgs() } } #endif -#if __ANDROID__ || __IOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ +#if false [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "IS_UNIT_TESTS", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public global::Microsoft.UI.Input.FocusNavigationRequest Request { diff --git a/src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Input/FocusNavigationResult.cs b/src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Input/FocusNavigationResult.cs index 7ddcc8af2c50..4a5c33e550eb 100644 --- a/src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Input/FocusNavigationResult.cs +++ b/src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Input/FocusNavigationResult.cs @@ -3,16 +3,16 @@ #pragma warning disable 114 // new keyword hiding namespace Microsoft.UI.Input { -#if __ANDROID__ || __IOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ +#if false public enum FocusNavigationResult { -#if __ANDROID__ || __IOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ +#if false NotMoved = 0, #endif -#if __ANDROID__ || __IOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ +#if false Moved = 1, #endif -#if __ANDROID__ || __IOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ +#if false NoFocusableElements = 2, #endif } diff --git a/src/Uno.UI/Microsoft/UI/Input/FocusChangedEventArgs.cs b/src/Uno.UI/Microsoft/UI/Input/FocusChangedEventArgs.cs new file mode 100644 index 000000000000..36f79b123e39 --- /dev/null +++ b/src/Uno.UI/Microsoft/UI/Input/FocusChangedEventArgs.cs @@ -0,0 +1,16 @@ +namespace Microsoft.UI.Input; + +/// +/// Contains event data for the InputFocusController.GotFocus and InputFocusController.LostFocus events. +/// +public partial class FocusChangedEventArgs +{ + internal FocusChangedEventArgs() + { + } + + /// + /// Gets or sets whether the InputFocusController.GotFocus and InputFocusController.LostFocus events were handled. + /// + public bool Handled { get; set; } +} diff --git a/src/Uno.UI/Microsoft/UI/Input/FocusNavigationReason.cs b/src/Uno.UI/Microsoft/UI/Input/FocusNavigationReason.cs new file mode 100644 index 000000000000..978eaac3785a --- /dev/null +++ b/src/Uno.UI/Microsoft/UI/Input/FocusNavigationReason.cs @@ -0,0 +1,49 @@ +// +#pragma warning disable 108 // new keyword hiding +namespace Microsoft.UI.Input; + +/// +/// Specifies the possible reasons for a focus navigation event. +/// +public enum FocusNavigationReason +{ + /// + /// Programmatically perform focus navigation. + /// + Programmatic = 0, + + /// + /// Restore focus to a previous state. + /// + Restore = 1, + + /// + /// Navigate to the first element in the focus recipient. + /// + First = 2, + + /// + /// Navigate to the last element in the focus recipient. + /// + Last = 3, + + /// + /// Navigate focus left. + /// + Left = 4, + + /// + /// Navigate focus up. + /// + Up = 5, + + /// + /// Navigate focus right. + /// + Right = 6, + + /// + /// Navigate focus down. + /// + Down = 7, +} diff --git a/src/Uno.UI/Microsoft/UI/Input/FocusNavigationRequest.cs b/src/Uno.UI/Microsoft/UI/Input/FocusNavigationRequest.cs new file mode 100644 index 000000000000..95e4ce123a32 --- /dev/null +++ b/src/Uno.UI/Microsoft/UI/Input/FocusNavigationRequest.cs @@ -0,0 +1,61 @@ +using System; +using Windows.Foundation; + +namespace Microsoft.UI.Input; + +/// +/// Provides details for focus navigation events. +/// +public partial class FocusNavigationRequest +{ + internal FocusNavigationRequest(FocusNavigationReason reason) + { + Reason = reason; + } + + /// + /// Gets the unique ID generated when a focus movement event is initiated. + /// + public Guid CorrelationId { get; init; } + + /// + /// Gets the reason for a focus navigation event. + /// + public FocusNavigationReason Reason { get; } + + /// + /// Gets the bounding rectangle used to identify the focus candidates most likely to receive navigation focus. + /// + public Rect? HintRect { get; init; } + + /// + /// Creates an instance of FocusNavigationRequest using the specified FocusNavigationReason. + /// + /// The reason for a focus navigation event. + /// A FocusNavigationRequest object. + public static FocusNavigationRequest Create(FocusNavigationReason reason) => new(reason); + + /// + /// Creates an instance of FocusNavigationRequest using the specified FocusNavigationReason and hint Rect. + /// + /// The reason for a focus navigation event. + /// The bounding rectangle used to identify the focus candidates most likely to receive navigation focus. + /// A FocusNavigationRequest object. + public static FocusNavigationRequest Create(FocusNavigationReason reason, Rect hintRect) => new(reason) + { + HintRect = hintRect + }; + + /// + /// Creates an instance of FocusNavigationRequest using the specified FocusNavigationReason, hint Rect, and unique identifier. + /// + /// The reason for a focus navigation event. + /// The bounding rectangle used to identify the focus candidates most likely to receive navigation focus. + /// The unique ID generated when a focus movement event is initiated. + /// A FocusNavigationRequest object. + public static FocusNavigationRequest Create(FocusNavigationReason reason, Rect hintRect, Guid correlationId) => new(reason) + { + HintRect = hintRect, + CorrelationId = correlationId + }; +} diff --git a/src/Uno.UI/Microsoft/UI/Input/FocusNavigationRequestEventArgs.cs b/src/Uno.UI/Microsoft/UI/Input/FocusNavigationRequestEventArgs.cs new file mode 100644 index 000000000000..b826641f4d75 --- /dev/null +++ b/src/Uno.UI/Microsoft/UI/Input/FocusNavigationRequestEventArgs.cs @@ -0,0 +1,24 @@ +using System; + +namespace Microsoft.UI.Input; + +/// +/// Contains event data for the InputFocusController.NavigateFocusRequested and InputFocusNavigationHost.DepartFocusRequested events. +/// +public partial class FocusNavigationRequestEventArgs +{ + internal FocusNavigationRequestEventArgs(FocusNavigationRequest request) + { + Request = request ?? throw new ArgumentNullException(nameof(request)); + } + + /// + /// Gets the details for focus navigation event. + /// + public FocusNavigationRequest Request { get; } + + /// + /// Gets or sets the result of a focus navigation event. + /// + public FocusNavigationResult Result { get; set; } +} diff --git a/src/Uno.UI/Microsoft/UI/Input/FocusNavigationResult.cs b/src/Uno.UI/Microsoft/UI/Input/FocusNavigationResult.cs new file mode 100644 index 000000000000..4e3a1413adcb --- /dev/null +++ b/src/Uno.UI/Microsoft/UI/Input/FocusNavigationResult.cs @@ -0,0 +1,22 @@ +namespace Microsoft.UI.Input; + +/// +/// Specifies the possible results of a focus navigation event. +/// +public enum FocusNavigationResult +{ + /// + /// Event was not subscribed or the event ran into an error. This is the default value. + /// + NotMoved = 0, + + /// + /// Focus successfully moved to another component. + /// + Moved = 1, + + /// + /// No focusable element was found. + /// + NoFocusableElements = 2, +}