Navigation Menu

Skip to content

Commit

Permalink
Added missing automation properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Roemer committed Jan 16, 2018
1 parent 314d465 commit f2b444e
Show file tree
Hide file tree
Showing 7 changed files with 178 additions and 14 deletions.
Expand Up @@ -10,19 +10,25 @@ public class AutomationElementPropertyValues
{
private AutomationProperty<string> _acceleratorKey;
private AutomationProperty<string> _accessKey;
private AutomationProperty<int[]> _annotationObjects;
private AutomationProperty<int[]> _annotationTypes;
private AutomationProperty<string> _ariaProperties;
private AutomationProperty<string> _ariaRole;
private AutomationProperty<string> _automationId;
private AutomationProperty<Rectangle> _boundingRectangle;
private AutomationProperty<Point> _centerPoint;
private AutomationProperty<string> _className;
private AutomationProperty<Point> _clickablePoint;
private AutomationProperty<AutomationElement[]> _controllerFor;
private AutomationProperty<ControlType> _controlType;
private AutomationProperty<CultureInfo> _culture;
private AutomationProperty<AutomationElement[]> _describedBy;
private AutomationProperty<int> _fillColor;
private AutomationProperty<int> _fillType;
private AutomationProperty<AutomationElement[]> _flowsFrom;
private AutomationProperty<AutomationElement[]> _flowsTo;
private AutomationProperty<string> _frameworkId;
private AutomationProperty<string> _fullDescription;
private AutomationProperty<bool> _hasKeyboardFocus;
private AutomationProperty<string> _helpText;
private AutomationProperty<bool> _isContentElement;
Expand All @@ -37,15 +43,25 @@ public class AutomationElementPropertyValues
private AutomationProperty<string> _itemStatus;
private AutomationProperty<string> _itemType;
private AutomationProperty<AutomationElement> _labeledBy;
private AutomationProperty<int> _landmarkType;
private AutomationProperty<int> _level;
private AutomationProperty<LiveSetting> _liveSetting;
private AutomationProperty<string> _localizedControlType;
private AutomationProperty<string> _localizedLandmarkType;
private AutomationProperty<string> _name;
private AutomationProperty<IntPtr> _nativeWindowHandle;
private AutomationProperty<bool> _optimizeForVisualContent;
private AutomationProperty<OrientationType> _orientation;
private AutomationProperty<int[]> _outlineColor;
private AutomationProperty<int[]> _outlineThickness;
private AutomationProperty<int> _positionInSet;
private AutomationProperty<int> _processId;
private AutomationProperty<string> _providerDescription;
private AutomationProperty<int> _rotation;
private AutomationProperty<int[]> _runtimeId;
private AutomationProperty<int[]> _size;
private AutomationProperty<int> _sizeOfSet;
private AutomationProperty<VisualEffects> _visualEffects;

public AutomationElementPropertyValues(BasicAutomationElementBase basicAutomationElement)
{
Expand All @@ -68,6 +84,10 @@ public AutomationElementPropertyValues(BasicAutomationElementBase basicAutomatio
/// </summary>
public AutomationProperty<string> AccessKey => GetOrCreate(ref _accessKey, Properties.AccessKey);

public AutomationProperty<int[]> AnnotationObjects => GetOrCreate(ref _annotationObjects, Properties.AnnotationObjects);

public AutomationProperty<int[]> AnnotationTypes => GetOrCreate(ref _annotationTypes, Properties.AnnotationObjects);

/// <summary>
/// Gets a formatted string containing the Accessible Rich Internet Application (ARIA) property information for the element.
/// </summary>
Expand All @@ -88,6 +108,8 @@ public AutomationElementPropertyValues(BasicAutomationElementBase basicAutomatio
/// </summary>
public AutomationProperty<Rectangle> BoundingRectangle => GetOrCreate(ref _boundingRectangle, Properties.BoundingRectangle);

public AutomationProperty<Point> CenterPoint => GetOrCreate(ref _centerPoint, Properties.AnnotationObjects);

/// <summary>
/// Gets a string containing the class name of the element as assigned by the control developer.
/// </summary>
Expand Down Expand Up @@ -118,6 +140,10 @@ public AutomationElementPropertyValues(BasicAutomationElementBase basicAutomatio
/// </summary>
public AutomationProperty<AutomationElement[]> DescribedBy => GetOrCreate(ref _describedBy, Properties.DescribedBy);

public AutomationProperty<int> FillColor => GetOrCreate(ref _fillColor, Properties.AnnotationObjects);

public AutomationProperty<int> FillType => GetOrCreate(ref _fillType, Properties.AnnotationObjects);

/// <summary>
/// Gets an array of elements that suggests the reading order before the current element.
/// </summary>
Expand All @@ -133,6 +159,8 @@ public AutomationElementPropertyValues(BasicAutomationElementBase basicAutomatio
/// </summary>
public AutomationProperty<string> FrameworkId => GetOrCreate(ref _frameworkId, Properties.FrameworkId);

public AutomationProperty<string> FullDescription => GetOrCreate(ref _fullDescription, Properties.AnnotationObjects);

/// <summary>
/// Gets a value that indicates whether the element has keyboard focus.
/// </summary>
Expand Down Expand Up @@ -205,6 +233,10 @@ public AutomationElementPropertyValues(BasicAutomationElementBase basicAutomatio
/// </summary>
public AutomationProperty<AutomationElement> LabeledBy => GetOrCreate(ref _labeledBy, Properties.LabeledBy);

public AutomationProperty<int> LandmarkType => GetOrCreate(ref _landmarkType, Properties.AnnotationObjects);

public AutomationProperty<int> Level => GetOrCreate(ref _level, Properties.AnnotationObjects);

/// <summary>
/// Gets a value which indicates the "politeness" level that a client should use to notify the user of changes to the live region.
/// </summary>
Expand All @@ -215,6 +247,8 @@ public AutomationElementPropertyValues(BasicAutomationElementBase basicAutomatio
/// </summary>
public AutomationProperty<string> LocalizedControlType => GetOrCreate(ref _localizedControlType, Properties.LocalizedControlType);

public AutomationProperty<string> LocalizedLandmarkType => GetOrCreate(ref _localizedLandmarkType, Properties.AnnotationObjects);

/// <summary>
/// Gets the name of the element.
/// </summary>
Expand All @@ -237,6 +271,12 @@ public AutomationElementPropertyValues(BasicAutomationElementBase basicAutomatio
/// </summary>
public AutomationProperty<OrientationType> Orientation => GetOrCreate(ref _orientation, Properties.Orientation);

public AutomationProperty<int[]> OutlineColor => GetOrCreate(ref _outlineColor, Properties.AnnotationObjects);

public AutomationProperty<int[]> OutlineThickness => GetOrCreate(ref _outlineThickness, Properties.AnnotationObjects);

public AutomationProperty<int> PositionInSet => GetOrCreate(ref _positionInSet, Properties.AnnotationObjects);

/// <summary>
/// Gets the process identifier (ID) of this element.
/// </summary>
Expand All @@ -247,11 +287,20 @@ public AutomationElementPropertyValues(BasicAutomationElementBase basicAutomatio
/// </summary>
public AutomationProperty<string> ProviderDescription => GetOrCreate(ref _providerDescription, Properties.ProviderDescription);

public AutomationProperty<int> Rotation => GetOrCreate(ref _rotation, Properties.AnnotationObjects);

/// <summary>
/// Gets the unique identifier assigned to the user interface (UI) item.
/// </summary>
public AutomationProperty<int[]> RuntimeId => GetOrCreate(ref _runtimeId, Properties.RuntimeId);

public AutomationProperty<int[]> Size => GetOrCreate(ref _size, Properties.AnnotationObjects);

public AutomationProperty<int> SizeOfSet => GetOrCreate(ref _sizeOfSet, Properties.AnnotationObjects);

public AutomationProperty<VisualEffects> VisualEffects => GetOrCreate(ref _visualEffects, Properties.AnnotationObjects);


private AutomationProperty<T> GetOrCreate<T>(ref AutomationProperty<T> val, PropertyId propertyId)
{
return val ?? (val = new AutomationProperty<T>(propertyId, BasicAutomationElement));
Expand Down
Expand Up @@ -6,19 +6,25 @@ public interface IAutomationElementProperties
{
PropertyId AcceleratorKey { get; }
PropertyId AccessKey { get; }
PropertyId AnnotationObjects { get; }
PropertyId AnnotationTypes { get; }
PropertyId AriaProperties { get; }
PropertyId AriaRole { get; }
PropertyId AutomationId { get; }
PropertyId BoundingRectangle { get; }
PropertyId CenterPoint { get; }
PropertyId ClassName { get; }
PropertyId ClickablePoint { get; }
PropertyId ControllerFor { get; }
PropertyId ControlType { get; }
PropertyId Culture { get; }
PropertyId DescribedBy { get; }
PropertyId FillColor { get; }
PropertyId FillType { get; }
PropertyId FlowsFrom { get; }
PropertyId FlowsTo { get; }
PropertyId FrameworkId { get; }
PropertyId FullDescription { get; }
PropertyId HasKeyboardFocus { get; }
PropertyId HelpText { get; }
PropertyId IsContentElement { get; }
Expand All @@ -33,14 +39,24 @@ public interface IAutomationElementProperties
PropertyId ItemStatus { get; }
PropertyId ItemType { get; }
PropertyId LabeledBy { get; }
PropertyId LandmarkType { get; }
PropertyId Level { get; }
PropertyId LiveSetting { get; }
PropertyId LocalizedControlType { get; }
PropertyId LocalizedLandmarkType { get; }
PropertyId Name { get; }
PropertyId NativeWindowHandle { get; }
PropertyId OptimizeForVisualContent { get; }
PropertyId Orientation { get; }
PropertyId OutlineColor { get; }
PropertyId OutlineThickness { get; }
PropertyId PositionInSet { get; }
PropertyId ProcessId { get; }
PropertyId ProviderDescription { get; }
PropertyId Rotation { get; }
PropertyId RuntimeId { get; }
PropertyId Size { get; }
PropertyId SizeOfSet { get; }
PropertyId VisualEffects { get; }
}
}
41 changes: 41 additions & 0 deletions src/FlaUI.Core/Definitions/VisualEffects.cs
@@ -0,0 +1,41 @@
using System;

namespace FlaUI.Core.Definitions
{
/// <summary>
/// Contains values for the VisualEffects attribute.
/// </summary>
[Flags]
public enum VisualEffects
{
/// <summary>
/// No visual effects.
/// </summary>
None = 0,

/// <summary>
/// Shadow effect.
/// </summary>
Shadow = 1 << 0,

/// <summary>
/// Reflection effect.
/// </summary>
Reflection = 1 << 1,

/// <summary>
/// Glow effect.
/// </summary>
Glow = 1 << 2,

/// <summary>
/// Soft edges effect.
/// </summary>
SoftEdges = 1 << 3,

/// <summary>
/// Bevel effect.
/// </summary>
Bevel = 1 << 4
}
}
38 changes: 24 additions & 14 deletions src/FlaUI.UIA2/Identifiers/AutomationObjectIds.cs
Expand Up @@ -5,7 +5,7 @@

namespace FlaUI.UIA2.Identifiers
{
public static class AutomationObjectIds
public static partial class AutomationObjectIds
{
#region Property Identifiers
// Base element properties
Expand Down Expand Up @@ -55,16 +55,6 @@ public static class AutomationObjectIds
public static readonly PropertyId IsTransformPatternAvailableProperty = PropertyId.Register(AutomationType.UIA2, UIA.AutomationElement.IsTransformPatternAvailableProperty.Id, "IsTransformPatternAvailable");
public static readonly PropertyId IsValuePatternAvailableProperty = PropertyId.Register(AutomationType.UIA2, UIA.AutomationElement.IsValuePatternAvailableProperty.Id, "IsValuePatternAvailable");
public static readonly PropertyId IsWindowPatternAvailableProperty = PropertyId.Register(AutomationType.UIA2, UIA.AutomationElement.IsWindowPatternAvailableProperty.Id, "IsWindowPatternAvailable");
// Additions from .NET 4.0
#if !NET35
public static readonly PropertyId IsItemContainerPatternAvailableProperty = PropertyId.Register(AutomationType.UIA2, UIA.AutomationElement.IsItemContainerPatternAvailableProperty.Id, "IsItemContainerPatternAvailable");
public static readonly PropertyId IsVirtualizedItemPatternAvailableProperty = PropertyId.Register(AutomationType.UIA2, UIA.AutomationElement.IsVirtualizedItemPatternAvailableProperty.Id, "IsVirtualizedItemPatternAvailable");
public static readonly PropertyId IsSynchronizedInputPatternAvailableProperty = PropertyId.Register(AutomationType.UIA2, UIA.AutomationElement.IsSynchronizedInputPatternAvailableProperty.Id, "IsSynchronizedInputPatternAvailable");
#endif
// Additions from .NET 4.7.1
#if NET471
public static readonly PropertyId LiveSettingProperty = PropertyId.Register(AutomationType.UIA2, UIA.AutomationElementIdentifiers.LiveSettingProperty.Id, "LiveSetting");
#endif
#endregion Property Identifiers

#region Event identifiers
Expand All @@ -77,10 +67,30 @@ public static class AutomationObjectIds
public static readonly EventId StructureChangedEvent = EventId.Register(AutomationType.UIA2, UIA.AutomationElement.StructureChangedEvent.Id, "StructureChanged");
public static readonly EventId ToolTipClosedEvent = EventId.Register(AutomationType.UIA2, UIA.AutomationElement.ToolTipClosedEvent.Id, "ToolTipClosed");
public static readonly EventId ToolTipOpenedEvent = EventId.Register(AutomationType.UIA2, UIA.AutomationElement.ToolTipOpenedEvent.Id, "ToolTipOpened");
// Additions from .NET 4.7.1
#endregion Event identifiers
}

#if !NET35
/// <summary>
/// Additions from .NET 4.0.
/// </summary>
public static partial class AutomationObjectIds
{
// Additions from .NET 4.0
public static readonly PropertyId IsItemContainerPatternAvailableProperty = PropertyId.Register(AutomationType.UIA2, UIA.AutomationElement.IsItemContainerPatternAvailableProperty.Id, "IsItemContainerPatternAvailable");
public static readonly PropertyId IsVirtualizedItemPatternAvailableProperty = PropertyId.Register(AutomationType.UIA2, UIA.AutomationElement.IsVirtualizedItemPatternAvailableProperty.Id, "IsVirtualizedItemPatternAvailable");
public static readonly PropertyId IsSynchronizedInputPatternAvailableProperty = PropertyId.Register(AutomationType.UIA2, UIA.AutomationElement.IsSynchronizedInputPatternAvailableProperty.Id, "IsSynchronizedInputPatternAvailable");
}
#endif

#if NET471
/// <summary>
/// Additions from .NET 4.7.1.
/// </summary>
public static partial class AutomationObjectIds
{
public static readonly PropertyId LiveSettingProperty = PropertyId.Register(AutomationType.UIA2, UIA.AutomationElementIdentifiers.LiveSettingProperty.Id, "LiveSetting");
public static readonly EventId LiveRegionChangedEvent = EventId.Register(AutomationType.UIA2, UIA.AutomationElementIdentifiers.LiveRegionChangedEvent.Id, "LiveRegionChanged");
#endif
#endregion Event identifiers
}
#endif
}
16 changes: 16 additions & 0 deletions src/FlaUI.UIA2/UIA2AutomationElementProperties.cs
Expand Up @@ -8,19 +8,25 @@ public partial class UIA2AutomationElementProperties : IAutomationElementPropert
{
public PropertyId AcceleratorKey => AutomationObjectIds.AcceleratorKeyProperty;
public PropertyId AccessKey => AutomationObjectIds.AccessKeyProperty;
public PropertyId AnnotationObjects => PropertyId.NotSupportedByFramework;
public PropertyId AnnotationTypes => PropertyId.NotSupportedByFramework;
public PropertyId AriaProperties => PropertyId.NotSupportedByFramework;
public PropertyId AriaRole => PropertyId.NotSupportedByFramework;
public PropertyId AutomationId => AutomationObjectIds.AutomationIdProperty;
public PropertyId BoundingRectangle => AutomationObjectIds.BoundingRectangleProperty;
public PropertyId CenterPoint => PropertyId.NotSupportedByFramework;
public PropertyId ClassName => AutomationObjectIds.ClassNameProperty;
public PropertyId ClickablePoint => AutomationObjectIds.ClickablePointProperty;
public PropertyId ControllerFor => PropertyId.NotSupportedByFramework;
public PropertyId ControlType => AutomationObjectIds.ControlTypeProperty;
public PropertyId Culture => AutomationObjectIds.CultureProperty;
public PropertyId DescribedBy => PropertyId.NotSupportedByFramework;
public PropertyId FillColor => PropertyId.NotSupportedByFramework;
public PropertyId FillType => PropertyId.NotSupportedByFramework;
public PropertyId FlowsFrom => PropertyId.NotSupportedByFramework;
public PropertyId FlowsTo => PropertyId.NotSupportedByFramework;
public PropertyId FrameworkId => AutomationObjectIds.FrameworkIdProperty;
public PropertyId FullDescription => PropertyId.NotSupportedByFramework;
public PropertyId HasKeyboardFocus => AutomationObjectIds.HasKeyboardFocusProperty;
public PropertyId HelpText => AutomationObjectIds.HelpTextProperty;
public PropertyId IsContentElement => AutomationObjectIds.IsContentElementProperty;
Expand All @@ -35,14 +41,24 @@ public partial class UIA2AutomationElementProperties : IAutomationElementPropert
public PropertyId ItemStatus => AutomationObjectIds.ItemStatusProperty;
public PropertyId ItemType => AutomationObjectIds.ItemTypeProperty;
public PropertyId LabeledBy => AutomationObjectIds.AcceleratorKeyProperty;
public PropertyId LandmarkType => PropertyId.NotSupportedByFramework;
public PropertyId Level => PropertyId.NotSupportedByFramework;
public PropertyId LocalizedControlType => AutomationObjectIds.LocalizedControlTypeProperty;
public PropertyId LocalizedLandmarkType => PropertyId.NotSupportedByFramework;
public PropertyId Name => AutomationObjectIds.NameProperty;
public PropertyId NativeWindowHandle => AutomationObjectIds.NativeWindowHandleProperty;
public PropertyId OptimizeForVisualContent => PropertyId.NotSupportedByFramework;
public PropertyId Orientation => AutomationObjectIds.OrientationProperty;
public PropertyId OutlineColor => PropertyId.NotSupportedByFramework;
public PropertyId OutlineThickness => PropertyId.NotSupportedByFramework;
public PropertyId PositionInSet => PropertyId.NotSupportedByFramework;
public PropertyId ProcessId => AutomationObjectIds.ProcessIdProperty;
public PropertyId ProviderDescription => PropertyId.NotSupportedByFramework;
public PropertyId Rotation => PropertyId.NotSupportedByFramework;
public PropertyId RuntimeId => AutomationObjectIds.RuntimeIdProperty;
public PropertyId Size => PropertyId.NotSupportedByFramework;
public PropertyId SizeOfSet => PropertyId.NotSupportedByFramework;
public PropertyId VisualEffects => PropertyId.NotSupportedByFramework;
}

/// <summary>
Expand Down

0 comments on commit f2b444e

Please sign in to comment.