Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
using System.Diagnostics;
using MS.Internal.Automation;


namespace MS.Internal.Automation
{
// Disable warning for obsolete types. These are scheduled to be removed in M8.2 so
Expand Down Expand Up @@ -209,18 +210,34 @@ internal static object ConvertToElementArray(object value)
return els;
}

private enum HeadingLevel
private static object ConvertToAutomationHeadingLevel(object value)
{
None = 80050,
Level1,
Level2,
Level3,
Level4,
Level5,
Level6,
Level7,
Level8,
Level9,
var headingLevel = (HeadingLevel)value;
switch(headingLevel)
{
case HeadingLevel.None:
return AutomationHeadingLevel.None;
case HeadingLevel.Level1:
return AutomationHeadingLevel.Level1;
case HeadingLevel.Level2:
return AutomationHeadingLevel.Level2;
case HeadingLevel.Level3:
return AutomationHeadingLevel.Level3;
case HeadingLevel.Level4:
return AutomationHeadingLevel.Level4;
case HeadingLevel.Level5:
return AutomationHeadingLevel.Level5;
case HeadingLevel.Level6:
return AutomationHeadingLevel.Level6;
case HeadingLevel.Level7:
return AutomationHeadingLevel.Level7;
case HeadingLevel.Level8:
return AutomationHeadingLevel.Level8;
case HeadingLevel.Level9:
return AutomationHeadingLevel.Level9;
default:
return AutomationHeadingLevel.None;
}
}

// Delegate versions of the above...
Expand All @@ -238,6 +255,7 @@ private enum HeadingLevel
private static AutomationPropertyConverter convertToElementArray = new AutomationPropertyConverter(ConvertToElementArray);
private static AutomationPropertyConverter convertToControlType = new AutomationPropertyConverter(ConvertToControlType);
private static AutomationPropertyConverter convertToCultureInfo = new AutomationPropertyConverter(ConvertToCultureInfo);
private static AutomationPropertyConverter convertToAutomationHeadingLevel = new AutomationPropertyConverter(ConvertToAutomationHeadingLevel);

#endregion Private Methods

Expand Down Expand Up @@ -288,7 +306,7 @@ private enum HeadingLevel
new AutomationPropertyInfo( null, AutomationElement.ItemStatusProperty, typeof(string), "" ),
new AutomationPropertyInfo( null, AutomationElement.SizeOfSetProperty, typeof(int), -1 ),
new AutomationPropertyInfo( null, AutomationElement.PositionInSetProperty, typeof(int), -1 ),
new AutomationPropertyInfo( null, AutomationElement.HeadingLevelProperty, typeof(HeadingLevel), HeadingLevel.None ),
new AutomationPropertyInfo( convertToAutomationHeadingLevel, AutomationElement.HeadingLevelProperty, typeof(AutomationHeadingLevel),AutomationHeadingLevel.None ),
new AutomationPropertyInfo( convertToBool, AutomationElement.IsDialogProperty, typeof(bool), false ),

// Pattern Available properties
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@

// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

//
//
//
// Description: Enumeration for possible values of AutomationProperties.HeadingLevel
//

namespace System.Windows.Automation
{
/// <summary>
/// Describes the heading level of a control
/// </summary>
internal enum HeadingLevel
{
/// <summary>
/// The element does not have a heading level
/// </summary>
None = 80050,

/// <summary>
/// The element has a heading level of 1
/// </summary>
Level1,

/// <summary>
/// The element has a heading level of 2
/// </summary>
Level2,

/// <summary>
/// The element has a heading level of 3
/// </summary>
Level3,

/// <summary>
/// The element has a heading level of 4
/// </summary>
Level4,

/// <summary>
/// The element has a heading level of 5
/// </summary>
Level5,

/// <summary>
/// The element has a heading level of 6
/// </summary>
Level6,

/// <summary>
/// The element has a heading level of 7
/// </summary>
Level7,

/// <summary>
/// The element has a heading level of 8
/// </summary>
Level8,

/// <summary>
/// The element has a heading level of 9
/// </summary>
Level9,
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,46 @@ void Init(AutomationProperty property, object val, PropertyConditionFlags flags
{
val = ((CultureInfo)val).LCID;
}
else if (val is AutomationHeadingLevel)
{
AutomationHeadingLevel automationHeadingLevel = (AutomationHeadingLevel)(val);
switch(automationHeadingLevel)
{
case AutomationHeadingLevel.None:
val = HeadingLevel.None;
break;
case AutomationHeadingLevel.Level1:
val = HeadingLevel.Level1;
break;
case AutomationHeadingLevel.Level2:
val = HeadingLevel.Level2;
break;
case AutomationHeadingLevel.Level3:
val = HeadingLevel.Level3;
break;
case AutomationHeadingLevel.Level4:
val = HeadingLevel.Level4;
break;
case AutomationHeadingLevel.Level5:
val = HeadingLevel.Level5;
break;
case AutomationHeadingLevel.Level6:
val = HeadingLevel.Level6;
break;
case AutomationHeadingLevel.Level7:
val = HeadingLevel.Level7;
break;
case AutomationHeadingLevel.Level8:
val = HeadingLevel.Level8;
break;
case AutomationHeadingLevel.Level9:
val = HeadingLevel.Level9;
break;
default:
val = HeadingLevel.None;
break;
}
}

_property = property;
_val = val;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
<Compile Include="System\Windows\Automation\ExpandCollapsePattern.cs" />
<Compile Include="System\Windows\Automation\GridItemPattern.cs" />
<Compile Include="System\Windows\Automation\GridPattern.cs" />
<Compile Include="System\Windows\Automation\HeadingLevel.cs" />
<Compile Include="System\Windows\Automation\InvokePattern.cs" />
<Compile Include="System\Windows\Automation\ItemContainerPattern.cs" />
<Compile Include="System\Windows\Automation\MultipleViewPattern.cs" />
Expand All @@ -95,6 +96,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(WpfSourceDir)WindowsBase\WindowsBase.csproj" />
<ProjectReference Include="$(WpfSourceDir)PresentationCore\PresentationCore.csproj" />
<ProjectReference Include="$(WpfSourceDir)UIAutomation\UIAutomationTypes\UIAutomationTypes.csproj" />
<ProjectReference Include="$(WpfSourceDir)UIAutomation\UIAutomationProvider\UIAutomationProvider.csproj" />
<ProjectReference Include="$(WpfSourceDir)UIAutomation\UIAutomationClient\ref\UIAutomationClient-ref.csproj">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,19 @@ public partial struct GridPatternInformation
public int RowCount { get { throw null; } }
}
}
internal enum HeadingLevel
{
None = 80050,
Level1,
Level2,
Level3,
Level4,
Level5,
Level6,
Level7,
Level8,
Level9,
}
public partial class InvokePattern : System.Windows.Automation.BasePattern
{
internal InvokePattern() { }
Expand Down