Skip to content

Commit

Permalink
Convert UIA Enum to Cswin32 (#10081)
Browse files Browse the repository at this point in the history
* Convert UIA enum to Cswin32

* Undo changed unrelated to UIA enum removal

* fix tests

* other fixes

* Add UIA_CONTROLTYPE_ID enum of type int

* Add UIA_PATTERN_ID and UIA_PROPERTY_ID int enum

* remove property/pattern id from txt file
  • Loading branch information
lonitra authored Oct 12, 2023
1 parent 4eb5ab7 commit 7c5cde7
Show file tree
Hide file tree
Showing 298 changed files with 2,636 additions and 2,518 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@

using System.ComponentModel;
using System.Drawing.Design;
using Moq;
using System.Windows.Forms.TestUtilities;
using System.Reflection;
using System.Windows.Forms.TestUtilities;
using Moq;
using Windows.Win32.UI.Accessibility;

namespace System.Windows.Forms.Design.Tests;

Expand Down Expand Up @@ -88,8 +89,8 @@ public void AnchorEditor_AnchorUI_ControlType_IsCheckButton(string fieldName)
.GetField(fieldName, BindingFlags.NonPublic | BindingFlags.Instance).GetValue(anchorUI);

object actual = item.AccessibilityObject.TestAccessor().Dynamic
.GetPropertyValue(Interop.UiaCore.UIA.ControlTypePropertyId);
.GetPropertyValue(UIA_PROPERTY_ID.UIA_ControlTypePropertyId);

Assert.Equal(Interop.UiaCore.UIA.CheckBoxControlTypeId, actual);
Assert.Equal(UIA_CONTROLTYPE_ID.UIA_CheckBoxControlTypeId, actual);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System.Drawing.Design;
using System.Reflection;
using Windows.Win32.UI.Accessibility;

namespace System.Windows.Forms.Design.Tests;

Expand All @@ -28,8 +29,8 @@ public void ContentAlignmentEditor_ContentAlignmentEditor_ContentUI_IsRadioButto
.GetField(fieldName, BindingFlags.NonPublic | BindingFlags.Instance).GetValue(contentUI);

object actual = item.AccessibilityObject.TestAccessor().Dynamic
.GetPropertyValue(Interop.UiaCore.UIA.ControlTypePropertyId);
.GetPropertyValue(UIA_PROPERTY_ID.UIA_ControlTypePropertyId);

Assert.Equal(Interop.UiaCore.UIA.RadioButtonControlTypeId, actual);
Assert.Equal(UIA_CONTROLTYPE_ID.UIA_RadioButtonControlTypeId, actual);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Runtime.InteropServices;
using Windows.Win32.UI.Accessibility;

internal static partial class Interop
{
Expand Down Expand Up @@ -32,14 +33,14 @@ public interface IRawElementProviderSimple
/// <param name="patternId">Identifier indicating the interface to return</param>
/// <returns>Returns the interface as an object, if supported; otherwise returns null/</returns>
[return: MarshalAs(UnmanagedType.IUnknown)]
object? GetPatternProvider(UIA patternId);
object? GetPatternProvider(UIA_PATTERN_ID patternId);

/// <summary>
/// Returns the value of the specified <paramref name="propertyId"/> from the element.
/// </summary>
/// <param name="propertyId">Identifier indicating the property to return</param>
/// <returns>Returns the requested value if supported or null if it is not.</returns>
object? GetPropertyValue(UIA propertyId);
object? GetPropertyValue(UIA_PROPERTY_ID propertyId);

// Only native impl roots need to return something for this,
// proxies always return null (cause we already know their HWNDs)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Windows.Win32.UI.Accessibility;

internal static partial class Interop
{
internal static partial class UiaCore
Expand All @@ -20,8 +22,8 @@ private StubFragmentRoot() { }
void IRawElementProviderFragment.SetFocus() { }
IRawElementProviderFragmentRoot? IRawElementProviderFragment.FragmentRoot => default;
ProviderOptions IRawElementProviderSimple.ProviderOptions => default;
object? IRawElementProviderSimple.GetPatternProvider(UIA patternId) => default;
object? IRawElementProviderSimple.GetPropertyValue(UIA propertyId) => default;
object? IRawElementProviderSimple.GetPatternProvider(UIA_PATTERN_ID patternId) => default;
object? IRawElementProviderSimple.GetPropertyValue(UIA_PROPERTY_ID propertyId) => default;
IRawElementProviderSimple? IRawElementProviderSimple.HostRawElementProvider => default;
}
}
Expand Down
298 changes: 0 additions & 298 deletions src/System.Windows.Forms.Primitives/src/Interop/UiaCore/Interop.UIA.cs

This file was deleted.

Loading

0 comments on commit 7c5cde7

Please sign in to comment.