using System; using Avalonia.Automation.Peers; using Avalonia.Controls; namespace Avalonia.Automation { /// /// Declares how a control should included in different views of the automation tree. /// public enum AccessibilityView { /// /// The control's view is defined by its automation peer. /// Default, /// /// The control is included in the Raw view of the automation tree. /// Raw, /// /// The control is included in the Control view of the automation tree. /// Control, /// /// The control is included in the Content view of the automation tree. /// Content, } public static class AutomationProperties { internal const int AutomationPositionInSetDefault = -1; internal const int AutomationSizeOfSetDefault = -1; /// /// Defines the AutomationProperties.AcceleratorKey attached property. /// /// /// This property affects the default value for . /// public static readonly AttachedProperty AcceleratorKeyProperty = AvaloniaProperty.RegisterAttached( "AcceleratorKey", typeof(AutomationProperties)); /// /// Defines the AutomationProperties.AccessibilityView attached property. /// /// /// The value of this property affects the default value of the /// and /// properties. /// public static readonly AttachedProperty AccessibilityViewProperty = AvaloniaProperty.RegisterAttached( "AccessibilityView", typeof(AutomationProperties)); /// /// Defines the AutomationProperties.AccessKey attached property /// /// /// This property affects the default value for . /// public static readonly AttachedProperty AccessKeyProperty = AvaloniaProperty.RegisterAttached( "AccessKey", typeof(AutomationProperties)); /// /// Defines the AutomationProperties.AutomationId attached property. /// /// /// This property affects the default value for . /// public static readonly AttachedProperty AutomationIdProperty = AvaloniaProperty.RegisterAttached( "AutomationId", typeof(AutomationProperties)); /// /// Defines the AutomationProperties.ControlTypeOverride attached property. /// /// /// This property affects the default value for /// . /// public static readonly AttachedProperty ControlTypeOverrideProperty = AvaloniaProperty.RegisterAttached( "ControlTypeOverride", typeof(AutomationProperties)); /// /// Defines the AutomationProperties.HelpText attached property. /// /// /// This property affects the default value for . /// public static readonly AttachedProperty HelpTextProperty = AvaloniaProperty.RegisterAttached( "HelpText", typeof(AutomationProperties)); /// /// Defines the AutomationProperties.LandmarkType attached property. /// /// /// This property affects the default value for /// public static readonly AttachedProperty LandmarkTypeProperty = AvaloniaProperty.RegisterAttached( "LandmarkType", typeof(AutomationProperties)); /// /// Defines the AutomationProperties.HeadingLevel attached property. /// /// /// This property affects the default value for . /// public static readonly AttachedProperty HeadingLevelProperty = AvaloniaProperty.RegisterAttached( "HeadingLevel", typeof(AutomationProperties)); /// /// Defines the AutomationProperties.IsColumnHeader attached property. /// /// /// This property currently has no effect. /// public static readonly AttachedProperty IsColumnHeaderProperty = AvaloniaProperty.RegisterAttached( "IsColumnHeader", typeof(AutomationProperties), false); /// /// Defines the AutomationProperties.IsRequiredForForm attached property. /// /// /// This property currently has no effect. /// public static readonly AttachedProperty IsRequiredForFormProperty = AvaloniaProperty.RegisterAttached( "IsRequiredForForm", typeof(AutomationProperties), false); /// /// Defines the AutomationProperties.IsRowHeader attached property. /// /// /// This property currently has no effect. /// public static readonly AttachedProperty IsRowHeaderProperty = AvaloniaProperty.RegisterAttached( "IsRowHeader", typeof(AutomationProperties), false); /// /// Defines the AutomationProperties.IsOffscreenBehavior attached property. /// /// /// This property affects the default value for . /// public static readonly AttachedProperty IsOffscreenBehaviorProperty = AvaloniaProperty.RegisterAttached( "IsOffscreenBehavior", typeof(AutomationProperties), IsOffscreenBehavior.Default); /// /// Defines the AutomationProperties.ItemStatus attached property. /// /// /// This property currently has no effect. /// public static readonly AttachedProperty ItemStatusProperty = AvaloniaProperty.RegisterAttached( "ItemStatus", typeof(AutomationProperties)); /// /// Defines the AutomationProperties.ItemType attached property. /// /// /// This property currently has no effect. /// public static readonly AttachedProperty ItemTypeProperty = AvaloniaProperty.RegisterAttached( "ItemType", typeof(AutomationProperties)); /// /// Defines the AutomationProperties.LabeledBy attached property. /// /// /// This property affects the default value for . /// public static readonly AttachedProperty LabeledByProperty = AvaloniaProperty.RegisterAttached( "LabeledBy", typeof(AutomationProperties)); /// /// Defines the AutomationProperties.LiveSetting attached property. /// /// /// This property affects the default value for and controls whether live region changed events are emitted. /// public static readonly AttachedProperty LiveSettingProperty = AvaloniaProperty.RegisterAttached( "LiveSetting", typeof(AutomationProperties), AutomationLiveSetting.Off); /// /// Defines the AutomationProperties.Name attached attached property. /// /// /// This property affects the default value for . /// public static readonly AttachedProperty NameProperty = AvaloniaProperty.RegisterAttached( "Name", typeof(AutomationProperties)); /// /// Defines the AutomationProperties.PositionInSet attached property. /// /// /// NOTE: This property currently has no effect. /// /// The PositionInSet property describes the ordinal location of the element within a set /// of elements which are considered to be siblings. PositionInSet works in coordination /// with the SizeOfSet property to describe the ordinal location in the set. /// public static readonly AttachedProperty PositionInSetProperty = AvaloniaProperty.RegisterAttached( "PositionInSet", typeof(AutomationProperties), AutomationPositionInSetDefault); /// /// Defines the AutomationProperties.SizeOfSet attached property. /// /// /// NOTE: This property currently has no effect. /// /// The SizeOfSet property describes the count of automation elements in a group or set /// that are considered to be siblings. SizeOfSet works in coordination with the PositionInSet /// property to describe the count of items in the set. /// public static readonly AttachedProperty SizeOfSetProperty = AvaloniaProperty.RegisterAttached( "SizeOfSet", typeof(AutomationProperties), AutomationSizeOfSetDefault); /// /// Helper for setting the value of the on a StyledElement. /// public static void SetAcceleratorKey(StyledElement element, string value) { _ = element ?? throw new ArgumentNullException(nameof(element)); element.SetValue(AcceleratorKeyProperty, value); } /// /// Helper for reading the value of the on a StyledElement. /// public static string? GetAcceleratorKey(StyledElement element) { _ = element ?? throw new ArgumentNullException(nameof(element)); return element.GetValue(AcceleratorKeyProperty); } /// /// Helper for setting the value of the on a StyledElement. /// public static void SetAccessibilityView(StyledElement element, AccessibilityView value) { _ = element ?? throw new ArgumentNullException(nameof(element)); element.SetValue(AccessibilityViewProperty, value); } /// /// Helper for reading the value of the on a StyledElement. /// public static AccessibilityView GetAccessibilityView(StyledElement element) { _ = element ?? throw new ArgumentNullException(nameof(element)); return element.GetValue(AccessibilityViewProperty); } /// /// Helper for setting the value of the on a StyledElement. /// public static void SetAccessKey(StyledElement element, string value) { _ = element ?? throw new ArgumentNullException(nameof(element)); element.SetValue(AccessKeyProperty, value); } /// /// Helper for reading the value of the on a StyledElement. /// public static string? GetAccessKey(StyledElement element) { _ = element ?? throw new ArgumentNullException(nameof(element)); return element.GetValue(AccessKeyProperty); } /// /// Helper for setting the value of the on a StyledElement. /// public static void SetAutomationId(StyledElement element, string? value) { _ = element ?? throw new ArgumentNullException(nameof(element)); element.SetValue(AutomationIdProperty, value); } /// /// Helper for reading the value of the on a StyledElement. /// public static string? GetAutomationId(StyledElement element) { _ = element ?? throw new ArgumentNullException(nameof(element)); return element.GetValue(AutomationIdProperty); } /// /// Helper for setting the value of the on a StyledElement. /// public static void SetControlTypeOverride(StyledElement element, AutomationControlType? value) { _ = element ?? throw new ArgumentNullException(nameof(element)); element.SetValue(ControlTypeOverrideProperty, value); } /// /// Helper for reading the value of the on a StyledElement. /// public static AutomationControlType? GetControlTypeOverride(StyledElement element) { _ = element ?? throw new ArgumentNullException(nameof(element)); return element.GetValue(ControlTypeOverrideProperty); } /// /// Helper for setting the value of the on a StyledElement. /// public static void SetHelpText(StyledElement element, string? value) { _ = element ?? throw new ArgumentNullException(nameof(element)); element.SetValue(HelpTextProperty, value); } /// /// Helper for reading the value of the on a StyledElement. /// public static string? GetHelpText(StyledElement element) { _ = element ?? throw new ArgumentNullException(nameof(element)); return element.GetValue(HelpTextProperty); } /// /// Helper for setting the value of the on a StyledElement. /// public static void SetLandmarkType(StyledElement element, AutomationLandmarkType? value) { _ = element ?? throw new ArgumentNullException(nameof(element)); element.SetValue(LandmarkTypeProperty, value); } /// /// Helper for reading the value of the on a StyledElement. /// public static AutomationLandmarkType? GetLandmarkType(StyledElement element) { _ = element ?? throw new ArgumentNullException(nameof(element)); return element.GetValue(LandmarkTypeProperty); } /// /// Helper for setting the value of the on a StyledElement. /// public static void SetHeadingLevel(StyledElement element, int value) { _ = element ?? throw new ArgumentNullException(nameof(element)); element.SetValue(HeadingLevelProperty, value); } /// /// Helper for reading the value of the on a StyledElement. /// public static int GetHeadingLevel(StyledElement element) { _ = element ?? throw new ArgumentNullException(nameof(element)); return element.GetValue(HeadingLevelProperty); } /// /// Helper for setting the value of the on a StyledElement. /// public static void SetIsColumnHeader(StyledElement element, bool value) { _ = element ?? throw new ArgumentNullException(nameof(element)); element.SetValue(IsColumnHeaderProperty, value); } /// /// Helper for reading the value of the on a StyledElement. /// public static bool GetIsColumnHeader(StyledElement element) { _ = element ?? throw new ArgumentNullException(nameof(element)); return element.GetValue(IsColumnHeaderProperty); } /// /// Helper for setting the value of the on a StyledElement. /// public static void SetIsRequiredForForm(StyledElement element, bool value) { _ = element ?? throw new ArgumentNullException(nameof(element)); element.SetValue(IsRequiredForFormProperty, value); } /// /// Helper for reading the value of the on a StyledElement. /// public static bool GetIsRequiredForForm(StyledElement element) { _ = element ?? throw new ArgumentNullException(nameof(element)); return element.GetValue(IsRequiredForFormProperty); } /// /// Helper for reading the value of the on a StyledElement. /// public static bool GetIsRowHeader(StyledElement element) { _ = element ?? throw new ArgumentNullException(nameof(element)); return element.GetValue(IsRowHeaderProperty); } /// /// Helper for setting the value of the on a StyledElement. /// public static void SetIsRowHeader(StyledElement element, bool value) { _ = element ?? throw new ArgumentNullException(nameof(element)); element.SetValue(IsRowHeaderProperty, value); } /// /// Helper for setting the value of the on a StyledElement. /// public static void SetIsOffscreenBehavior(StyledElement element, IsOffscreenBehavior value) { _ = element ?? throw new ArgumentNullException(nameof(element)); element.SetValue(IsOffscreenBehaviorProperty, value); } /// /// Helper for reading the value of the on a StyledElement. /// public static IsOffscreenBehavior GetIsOffscreenBehavior(StyledElement element) { _ = element ?? throw new ArgumentNullException(nameof(element)); return element.GetValue(IsOffscreenBehaviorProperty); } /// /// Helper for setting the value of the on a StyledElement. /// public static void SetItemStatus(StyledElement element, string? value) { _ = element ?? throw new ArgumentNullException(nameof(element)); element.SetValue(ItemStatusProperty, value); } /// /// Helper for reading the value of the on a StyledElement. /// public static string? GetItemStatus(StyledElement element) { _ = element ?? throw new ArgumentNullException(nameof(element)); return element.GetValue(ItemStatusProperty); } /// /// Helper for setting the value of the on a StyledElement. /// public static void SetItemType(StyledElement element, string? value) { _ = element ?? throw new ArgumentNullException(nameof(element)); element.SetValue(ItemTypeProperty, value); } /// /// Helper for reading the value of the on a StyledElement. /// public static string? GetItemType(StyledElement element) { _ = element ?? throw new ArgumentNullException(nameof(element)); return element.GetValue(ItemTypeProperty); } /// /// Helper for setting the value of the on a StyledElement. /// public static void SetLabeledBy(StyledElement element, Control value) { _ = element ?? throw new ArgumentNullException(nameof(element)); element.SetValue(LabeledByProperty, value); } /// /// Helper for reading the value of the on a StyledElement. /// public static Control GetLabeledBy(StyledElement element) { _ = element ?? throw new ArgumentNullException(nameof(element)); return element.GetValue(LabeledByProperty); } /// /// Helper for setting the value of the on a StyledElement. /// public static void SetLiveSetting(StyledElement element, AutomationLiveSetting value) { _ = element ?? throw new ArgumentNullException(nameof(element)); element.SetValue(LiveSettingProperty, value); } /// /// Helper for reading the value of the on a StyledElement. /// public static AutomationLiveSetting GetLiveSetting(StyledElement element) { _ = element ?? throw new ArgumentNullException(nameof(element)); return element.GetValue(LiveSettingProperty); } /// /// Helper for setting the value of the on a StyledElement. /// public static void SetName(StyledElement element, string? value) { _ = element ?? throw new ArgumentNullException(nameof(element)); element.SetValue(NameProperty, value); } /// /// Helper for reading the value of the on a StyledElement. /// public static string? GetName(StyledElement element) { _ = element ?? throw new ArgumentNullException(nameof(element)); return element.GetValue(NameProperty); } /// /// Helper for setting the value of the on a StyledElement. /// public static void SetPositionInSet(StyledElement element, int value) { _ = element ?? throw new ArgumentNullException(nameof(element)); element.SetValue(PositionInSetProperty, value); } /// /// Helper for reading the value of the on a StyledElement. /// public static int GetPositionInSet(StyledElement element) { _ = element ?? throw new ArgumentNullException(nameof(element)); return element.GetValue(PositionInSetProperty); } /// /// Helper for setting the value of the on a StyledElement. /// public static void SetSizeOfSet(StyledElement element, int value) { _ = element ?? throw new ArgumentNullException(nameof(element)); element.SetValue(SizeOfSetProperty, value); } /// /// Helper for reading the value of the on a StyledElement. /// public static int GetSizeOfSet(StyledElement element) { _ = element ?? throw new ArgumentNullException(nameof(element)); return element.GetValue(SizeOfSetProperty); } } }