-
Notifications
You must be signed in to change notification settings - Fork 747
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
279c211
commit b2b8de4
Showing
3 changed files
with
97 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 10 additions & 11 deletions
21
src/Uno.UI/UI/Xaml/Automation/ElementNotEnabledException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,18 @@ | ||
using System; | ||
|
||
namespace Microsoft.UI.Xaml.Automation | ||
namespace Microsoft.UI.Xaml.Automation; | ||
|
||
public class ElementNotEnabledException : Exception | ||
{ | ||
public class ElementNotEnabledException : Exception | ||
public ElementNotEnabledException() : base() | ||
{ | ||
public ElementNotEnabledException() : base() | ||
{ | ||
} | ||
} | ||
|
||
public ElementNotEnabledException(string message) : base(message) | ||
{ | ||
} | ||
public ElementNotEnabledException(string message) : base(message) | ||
{ | ||
} | ||
|
||
public ElementNotEnabledException(string message, Exception innerException) : base(message, innerException) | ||
{ | ||
} | ||
public ElementNotEnabledException(string message, Exception innerException) : base(message, innerException) | ||
{ | ||
} | ||
} |
104 changes: 84 additions & 20 deletions
104
src/Uno.UI/UI/Xaml/Automation/Peers/MenuFlyoutItemAutomationPeer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,92 @@ | ||
// <auto-generated> | ||
#pragma warning disable 108 // new keyword hiding | ||
#pragma warning disable 114 // new keyword hiding | ||
namespace Microsoft.UI.Xaml.Automation.Peers | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
// MUX Reference dxaml\xcp\dxaml\lib\MenuFlyoutItemAutomationPeer_Partial.cpp, tag winui3/release/1.5.4, commit 98a60c8 | ||
|
||
using Microsoft.UI.Xaml.Automation.Provider; | ||
using Microsoft.UI.Xaml.Controls; | ||
|
||
namespace Microsoft.UI.Xaml.Automation.Peers; | ||
|
||
/// <summary> | ||
/// Exposes MenuFlyoutItem types to Microsoft UI Automation. | ||
/// </summary> | ||
public partial class MenuFlyoutItemAutomationPeer : FrameworkElementAutomationPeer, IInvokeProvider | ||
{ | ||
#if __ANDROID__ || __IOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ | ||
[global::Uno.NotImplemented] | ||
#endif | ||
public partial class MenuFlyoutItemAutomationPeer : global::Microsoft.UI.Xaml.Automation.Peers.FrameworkElementAutomationPeer, global::Microsoft.UI.Xaml.Automation.Provider.IInvokeProvider | ||
/// <summary> | ||
/// Initializes a new instance of the MenuFlyoutItemAutomationPeer class. | ||
/// </summary> | ||
/// <param name="owner">The owner element to create for.</param> | ||
public MenuFlyoutItemAutomationPeer(MenuFlyoutItem owner) : base(owner) | ||
{ | ||
#if __ANDROID__ || __IOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ | ||
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "IS_UNIT_TESTS", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] | ||
public MenuFlyoutItemAutomationPeer(global::Microsoft.UI.Xaml.Controls.MenuFlyoutItem owner) : base(owner) | ||
} | ||
|
||
protected override object GetPatternCore(PatternInterface patternInterface) | ||
{ | ||
if (patternInterface == PatternInterface.Invoke) | ||
{ | ||
return this; | ||
} | ||
|
||
return base.GetPatternCore(patternInterface); | ||
} | ||
|
||
protected override string GetClassNameCore() => nameof(MenuFlyoutItem); | ||
|
||
protected override AutomationControlType GetAutomationControlTypeCore() => AutomationControlType.MenuItem; | ||
|
||
protected override string GetAcceleratorKeyCore() | ||
{ | ||
var returnValue = base.GetAcceleratorKeyCore(); | ||
if (string.IsNullOrEmpty(returnValue)) | ||
{ | ||
var owner = Owner as MenuFlyoutItem; | ||
if (owner != null) | ||
{ | ||
var keyboardAcceleratorTextOverride = owner.KeyboardAcceleratorTextOverride; | ||
returnValue = GetTrimmedKeyboardAcceleratorTextOverride(keyboardAcceleratorTextOverride); | ||
} | ||
} | ||
return returnValue; | ||
} | ||
|
||
protected override int GetPositionInSetCore() | ||
{ | ||
// First retrieve any valid value being directly set on the container, that value will get precedence. | ||
var returnValue = base.GetPositionInSetCore(); | ||
|
||
// if it still is default value, calculate it ourselves. | ||
if (returnValue == -1) | ||
{ | ||
returnValue = MenuFlyoutPresenter.GetPositionInSetHelper((MenuFlyoutItemBase)Owner); | ||
} | ||
|
||
return returnValue; | ||
} | ||
|
||
protected override int GetSizeOfSetCore() | ||
{ | ||
// First retrieve any valid value being directly set on the container, that value will get precedence. | ||
var returnValue = base.GetSizeOfSetCore(); | ||
|
||
// if it still is default value, calculate it ourselves. | ||
if (returnValue == -1) | ||
{ | ||
global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Microsoft.UI.Xaml.Automation.Peers.MenuFlyoutItemAutomationPeer", "MenuFlyoutItemAutomationPeer.MenuFlyoutItemAutomationPeer(MenuFlyoutItem owner)"); | ||
returnValue = MenuFlyoutPresenter.GetSizeOfSetHelper((MenuFlyoutItemBase)Owner); | ||
} | ||
#endif | ||
// Forced skipping of method Microsoft.UI.Xaml.Automation.Peers.MenuFlyoutItemAutomationPeer.MenuFlyoutItemAutomationPeer(Microsoft.UI.Xaml.Controls.MenuFlyoutItem) | ||
#if __ANDROID__ || __IOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ | ||
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "IS_UNIT_TESTS", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] | ||
public void Invoke() | ||
|
||
return returnValue; | ||
} | ||
|
||
/// <summary> | ||
/// Sends a request to invoke the menu flyout associated with the automation peer. | ||
/// </summary> | ||
public void Invoke() | ||
{ | ||
if (!IsEnabled()) | ||
{ | ||
global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Microsoft.UI.Xaml.Automation.Peers.MenuFlyoutItemAutomationPeer", "void MenuFlyoutItemAutomationPeer.Invoke()"); | ||
throw new ElementNotEnabledException(); | ||
} | ||
#endif | ||
// Processing: Microsoft.UI.Xaml.Automation.Provider.IInvokeProvider | ||
|
||
((MenuFlyoutItem)Owner).Invoke(); | ||
} | ||
} |