forked from unoplatform/uno
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Implement
SemanticZoomAutomationPeer
- Loading branch information
1 parent
b8041d9
commit 1714da1
Showing
2 changed files
with
67 additions
and
4 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
63 changes: 63 additions & 0 deletions
63
src/Uno.UI/UI/Xaml/Automation/Peers/SemanticZoomAutomationPeer.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 |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
// MUX Reference SemanticZoomAutomationPeer_Partial.cpp, tag winui3/release/1.4.2 | ||
namespace Microsoft.UI.Xaml.Automation.Peers; | ||
|
||
/// <summary> | ||
/// Exposes SemanticZoom types to Microsoft UI Automation. | ||
/// </summary> | ||
public partial class SemanticZoomAutomationPeer : FrameworkElementAutomationPeer, Provider.IToggleProvider | ||
{ | ||
public SemanticZoomAutomationPeer(Controls.SemanticZoom owner) : base(owner) | ||
{ | ||
|
||
} | ||
|
||
protected override object GetPatternCore(PatternInterface patternInterface) | ||
{ | ||
if (patternInterface == PatternInterface.Toggle) | ||
{ | ||
return this; | ||
} | ||
else | ||
{ | ||
return base.GetPatternCore(patternInterface); | ||
} | ||
} | ||
|
||
protected override string GetClassNameCore() => nameof(Controls.SemanticZoom); | ||
|
||
protected override AutomationControlType GetAutomationControlTypeCore() | ||
=> AutomationControlType.SemanticZoom; | ||
|
||
/// <summary> | ||
/// Cycles through the toggle states of a control. | ||
/// </summary> | ||
public void Toggle() | ||
{ | ||
if (!IsEnabled()) | ||
{ | ||
throw new ElementNotEnabledException(); | ||
} | ||
|
||
(Owner as Controls.SemanticZoom).ToggleActiveView(); | ||
} | ||
|
||
/// <summary> | ||
/// Gets a value that indicates whether the Toggle method can be called and result in a toggled view. | ||
/// </summary> | ||
public ToggleState ToggleState | ||
{ | ||
get | ||
{ | ||
if ((Owner as Controls.SemanticZoom).IsZoomedInViewActive) | ||
{ | ||
return ToggleState.On; | ||
} | ||
else | ||
{ | ||
return ToggleState.Off; | ||
} | ||
} | ||
} | ||
} |