-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(windows_ui): add Windows UI Automation APIs (#216)
- Loading branch information
1 parent
1a5479f
commit 89035f8
Showing
35 changed files
with
2,184 additions
and
7 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
37 changes: 37 additions & 0 deletions
37
packages/windows_ui/lib/src/uiautomation/automationconnection.dart
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,37 @@ | ||
// Copyright (c) 2023, Dart | Windows. Please see the AUTHORS file for details. | ||
// All rights reserved. Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
// THIS FILE IS GENERATED AUTOMATICALLY AND SHOULD NOT BE EDITED DIRECTLY. | ||
|
||
// ignore_for_file: constant_identifier_names, non_constant_identifier_names | ||
// ignore_for_file: unnecessary_import, unused_import | ||
|
||
import 'dart:async'; | ||
import 'dart:ffi'; | ||
|
||
import 'package:ffi/ffi.dart'; | ||
import 'package:win32/win32.dart' hide DocumentProperties; | ||
import 'package:windows_foundation/internal.dart'; | ||
import 'package:windows_foundation/windows_foundation.dart'; | ||
|
||
import 'iautomationconnection.dart'; | ||
|
||
/// Provides access to the connection details of a UI Automation connection. | ||
/// | ||
/// {@category class} | ||
class AutomationConnection extends IInspectable | ||
implements IAutomationConnection { | ||
AutomationConnection.fromPtr(super.ptr); | ||
|
||
late final _iAutomationConnection = IAutomationConnection.from(this); | ||
|
||
@override | ||
bool get isRemoteSystem => _iAutomationConnection.isRemoteSystem; | ||
|
||
@override | ||
String get appUserModelId => _iAutomationConnection.appUserModelId; | ||
|
||
@override | ||
String get executableFileName => _iAutomationConnection.executableFileName; | ||
} |
35 changes: 35 additions & 0 deletions
35
packages/windows_ui/lib/src/uiautomation/automationconnectionboundobject.dart
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,35 @@ | ||
// Copyright (c) 2023, Dart | Windows. Please see the AUTHORS file for details. | ||
// All rights reserved. Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
// THIS FILE IS GENERATED AUTOMATICALLY AND SHOULD NOT BE EDITED DIRECTLY. | ||
|
||
// ignore_for_file: constant_identifier_names, non_constant_identifier_names | ||
// ignore_for_file: unnecessary_import, unused_import | ||
|
||
import 'dart:async'; | ||
import 'dart:ffi'; | ||
|
||
import 'package:ffi/ffi.dart'; | ||
import 'package:win32/win32.dart' hide DocumentProperties; | ||
import 'package:windows_foundation/internal.dart'; | ||
import 'package:windows_foundation/windows_foundation.dart'; | ||
|
||
import 'automationconnection.dart'; | ||
import 'iautomationconnectionboundobject.dart'; | ||
|
||
/// Represents an object associated with a specific UI Automation provider | ||
/// connection. | ||
/// | ||
/// {@category class} | ||
class AutomationConnectionBoundObject extends IInspectable | ||
implements IAutomationConnectionBoundObject { | ||
AutomationConnectionBoundObject.fromPtr(super.ptr); | ||
|
||
late final _iAutomationConnectionBoundObject = | ||
IAutomationConnectionBoundObject.from(this); | ||
|
||
@override | ||
AutomationConnection? get connection => | ||
_iAutomationConnectionBoundObject.connection; | ||
} |
37 changes: 37 additions & 0 deletions
37
packages/windows_ui/lib/src/uiautomation/automationelement.dart
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,37 @@ | ||
// Copyright (c) 2023, Dart | Windows. Please see the AUTHORS file for details. | ||
// All rights reserved. Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
// THIS FILE IS GENERATED AUTOMATICALLY AND SHOULD NOT BE EDITED DIRECTLY. | ||
|
||
// ignore_for_file: constant_identifier_names, non_constant_identifier_names | ||
// ignore_for_file: unnecessary_import, unused_import | ||
|
||
import 'dart:async'; | ||
import 'dart:ffi'; | ||
|
||
import 'package:ffi/ffi.dart'; | ||
import 'package:win32/win32.dart' hide DocumentProperties; | ||
import 'package:windows_foundation/internal.dart'; | ||
import 'package:windows_foundation/windows_foundation.dart'; | ||
|
||
import 'iautomationelement.dart'; | ||
|
||
/// Provides access to a UI object that supports the IUIAutomationElement | ||
/// interface. | ||
/// | ||
/// {@category class} | ||
class AutomationElement extends IInspectable implements IAutomationElement { | ||
AutomationElement.fromPtr(super.ptr); | ||
|
||
late final _iAutomationElement = IAutomationElement.from(this); | ||
|
||
@override | ||
bool get isRemoteSystem => _iAutomationElement.isRemoteSystem; | ||
|
||
@override | ||
String get appUserModelId => _iAutomationElement.appUserModelId; | ||
|
||
@override | ||
String get executableFileName => _iAutomationElement.executableFileName; | ||
} |
26 changes: 26 additions & 0 deletions
26
packages/windows_ui/lib/src/uiautomation/automationtextrange.dart
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,26 @@ | ||
// Copyright (c) 2023, Dart | Windows. Please see the AUTHORS file for details. | ||
// All rights reserved. Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
// THIS FILE IS GENERATED AUTOMATICALLY AND SHOULD NOT BE EDITED DIRECTLY. | ||
|
||
// ignore_for_file: constant_identifier_names, non_constant_identifier_names | ||
// ignore_for_file: unnecessary_import, unused_import | ||
|
||
import 'dart:async'; | ||
import 'dart:ffi'; | ||
|
||
import 'package:ffi/ffi.dart'; | ||
import 'package:win32/win32.dart' hide DocumentProperties; | ||
import 'package:windows_foundation/internal.dart'; | ||
import 'package:windows_foundation/windows_foundation.dart'; | ||
|
||
import 'iautomationtextrange.dart'; | ||
|
||
/// Provides access to a span of continuous text in a container that | ||
/// supports the IUIAutomationTextPattern interface. | ||
/// | ||
/// {@category class} | ||
class AutomationTextRange extends IInspectable implements IAutomationTextRange { | ||
AutomationTextRange.fromPtr(super.ptr); | ||
} |
46 changes: 46 additions & 0 deletions
46
packages/windows_ui/lib/src/uiautomation/core/automationannotationtyperegistration.dart
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,46 @@ | ||
// Copyright (c) 2023, Dart | Windows. Please see the AUTHORS file for details. | ||
// All rights reserved. Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
// THIS FILE IS GENERATED AUTOMATICALLY AND SHOULD NOT BE EDITED DIRECTLY. | ||
|
||
import 'dart:ffi'; | ||
|
||
import 'package:ffi/ffi.dart'; | ||
import 'package:windows_foundation/internal.dart'; | ||
import 'package:windows_foundation/windows_foundation.dart'; | ||
|
||
/// Represents an annotation registration. | ||
/// | ||
/// {@category struct} | ||
final class AutomationAnnotationTypeRegistration implements WinRTStruct { | ||
AutomationAnnotationTypeRegistration(this.localId); | ||
|
||
final int localId; | ||
|
||
@override | ||
Pointer<NativeAutomationAnnotationTypeRegistration> toNative( | ||
{Allocator allocator = malloc}) { | ||
final ptr = allocator<NativeAutomationAnnotationTypeRegistration>(); | ||
ptr.ref.localId = localId; | ||
return ptr; | ||
} | ||
|
||
@override | ||
bool operator ==(Object other) { | ||
if (identical(this, other)) return true; | ||
return other is AutomationAnnotationTypeRegistration && | ||
localId == other.localId; | ||
} | ||
|
||
@override | ||
int get hashCode => localId.hashCode; | ||
} | ||
|
||
extension PointerNativeAutomationAnnotationTypeRegistrationConversion | ||
on Pointer<NativeAutomationAnnotationTypeRegistration> { | ||
/// Converts this [NativeAutomationAnnotationTypeRegistration] to a Dart | ||
/// [AutomationAnnotationTypeRegistration]. | ||
AutomationAnnotationTypeRegistration toDart() => | ||
AutomationAnnotationTypeRegistration(ref.localId); | ||
} |
46 changes: 46 additions & 0 deletions
46
packages/windows_ui/lib/src/uiautomation/core/automationremoteoperationoperandid.dart
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,46 @@ | ||
// Copyright (c) 2023, Dart | Windows. Please see the AUTHORS file for details. | ||
// All rights reserved. Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
// THIS FILE IS GENERATED AUTOMATICALLY AND SHOULD NOT BE EDITED DIRECTLY. | ||
|
||
import 'dart:ffi'; | ||
|
||
import 'package:ffi/ffi.dart'; | ||
import 'package:windows_foundation/internal.dart'; | ||
import 'package:windows_foundation/windows_foundation.dart'; | ||
|
||
/// Represents an identifier that refers to an operand register of a | ||
/// CoreAutomationRemoteOperation. | ||
/// | ||
/// {@category struct} | ||
final class AutomationRemoteOperationOperandId implements WinRTStruct { | ||
AutomationRemoteOperationOperandId(this.value); | ||
|
||
final int value; | ||
|
||
@override | ||
Pointer<NativeAutomationRemoteOperationOperandId> toNative( | ||
{Allocator allocator = malloc}) { | ||
final ptr = allocator<NativeAutomationRemoteOperationOperandId>(); | ||
ptr.ref.value = value; | ||
return ptr; | ||
} | ||
|
||
@override | ||
bool operator ==(Object other) { | ||
if (identical(this, other)) return true; | ||
return other is AutomationRemoteOperationOperandId && value == other.value; | ||
} | ||
|
||
@override | ||
int get hashCode => value.hashCode; | ||
} | ||
|
||
extension PointerNativeAutomationRemoteOperationOperandIdConversion | ||
on Pointer<NativeAutomationRemoteOperationOperandId> { | ||
/// Converts this [NativeAutomationRemoteOperationOperandId] to a Dart | ||
/// [AutomationRemoteOperationOperandId]. | ||
AutomationRemoteOperationOperandId toDart() => | ||
AutomationRemoteOperationOperandId(ref.value); | ||
} |
50 changes: 50 additions & 0 deletions
50
packages/windows_ui/lib/src/uiautomation/core/automationremoteoperationresult.dart
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,50 @@ | ||
// Copyright (c) 2023, Dart | Windows. Please see the AUTHORS file for details. | ||
// All rights reserved. Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
// THIS FILE IS GENERATED AUTOMATICALLY AND SHOULD NOT BE EDITED DIRECTLY. | ||
|
||
// ignore_for_file: constant_identifier_names, non_constant_identifier_names | ||
// ignore_for_file: unnecessary_import, unused_import | ||
|
||
import 'dart:async'; | ||
import 'dart:ffi'; | ||
|
||
import 'package:ffi/ffi.dart'; | ||
import 'package:win32/win32.dart' hide DocumentProperties; | ||
import 'package:windows_foundation/internal.dart'; | ||
import 'package:windows_foundation/windows_foundation.dart'; | ||
|
||
import 'automationremoteoperationoperandid.dart'; | ||
import 'automationremoteoperationstatus.dart'; | ||
import 'iautomationremoteoperationresult.dart'; | ||
|
||
/// Provides access to the execution results (status and remote objects) of | ||
/// a CoreAutomationRemoteOperation. | ||
/// | ||
/// {@category class} | ||
class AutomationRemoteOperationResult extends IInspectable | ||
implements IAutomationRemoteOperationResult { | ||
AutomationRemoteOperationResult.fromPtr(super.ptr); | ||
|
||
late final _iAutomationRemoteOperationResult = | ||
IAutomationRemoteOperationResult.from(this); | ||
|
||
@override | ||
AutomationRemoteOperationStatus get status => | ||
_iAutomationRemoteOperationResult.status; | ||
|
||
@override | ||
int get extendedError => _iAutomationRemoteOperationResult.extendedError; | ||
|
||
@override | ||
int get errorLocation => _iAutomationRemoteOperationResult.errorLocation; | ||
|
||
@override | ||
bool hasOperand(AutomationRemoteOperationOperandId operandId) => | ||
_iAutomationRemoteOperationResult.hasOperand(operandId); | ||
|
||
@override | ||
Object? getOperand(AutomationRemoteOperationOperandId operandId) => | ||
_iAutomationRemoteOperationResult.getOperand(operandId); | ||
} |
31 changes: 31 additions & 0 deletions
31
packages/windows_ui/lib/src/uiautomation/core/automationremoteoperationstatus.dart
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,31 @@ | ||
// Copyright (c) 2023, Dart | Windows. Please see the AUTHORS file for details. | ||
// All rights reserved. Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
// THIS FILE IS GENERATED AUTOMATICALLY AND SHOULD NOT BE EDITED DIRECTLY. | ||
|
||
// ignore_for_file: deprecated_member_use_from_same_package | ||
|
||
import 'package:windows_foundation/windows_foundation.dart'; | ||
|
||
/// Specifies the possible execution states of a | ||
/// CoreAutomationRemoteOperation. | ||
/// | ||
/// {@category enum} | ||
enum AutomationRemoteOperationStatus implements WinRTEnum { | ||
success(0), | ||
malformedBytecode(1), | ||
instructionLimitExceeded(2), | ||
unhandledException(3), | ||
executionFailure(4); | ||
|
||
@override | ||
final int value; | ||
|
||
const AutomationRemoteOperationStatus(this.value); | ||
|
||
factory AutomationRemoteOperationStatus.from(int value) => | ||
AutomationRemoteOperationStatus.values.firstWhere((e) => e.value == value, | ||
orElse: () => throw ArgumentError.value( | ||
value, 'value', 'No enum value with that value')); | ||
} |
42 changes: 42 additions & 0 deletions
42
packages/windows_ui/lib/src/uiautomation/core/coreautomationregistrar.dart
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,42 @@ | ||
// Copyright (c) 2023, Dart | Windows. Please see the AUTHORS file for details. | ||
// All rights reserved. Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
// THIS FILE IS GENERATED AUTOMATICALLY AND SHOULD NOT BE EDITED DIRECTLY. | ||
|
||
// ignore_for_file: constant_identifier_names, non_constant_identifier_names | ||
// ignore_for_file: unnecessary_import, unused_import | ||
|
||
import 'dart:async'; | ||
import 'dart:ffi'; | ||
|
||
import 'package:ffi/ffi.dart'; | ||
import 'package:win32/win32.dart' hide DocumentProperties; | ||
import 'package:windows_foundation/internal.dart'; | ||
import 'package:windows_foundation/windows_foundation.dart'; | ||
|
||
import 'automationannotationtyperegistration.dart'; | ||
import 'icoreautomationregistrarstatics.dart'; | ||
|
||
/// Exposes methods for registering new control patterns, properties, | ||
/// events, and annotations. | ||
/// | ||
/// {@category class} | ||
class CoreAutomationRegistrar extends IInspectable { | ||
CoreAutomationRegistrar.fromPtr(super.ptr); | ||
|
||
static const _className = | ||
'Windows.UI.UIAutomation.Core.CoreAutomationRegistrar'; | ||
|
||
static AutomationAnnotationTypeRegistration registerAnnotationType( | ||
Guid guid) => | ||
createActivationFactory(ICoreAutomationRegistrarStatics.fromPtr, | ||
_className, IID_ICoreAutomationRegistrarStatics) | ||
.registerAnnotationType(guid); | ||
|
||
static void unregisterAnnotationType( | ||
AutomationAnnotationTypeRegistration registration) => | ||
createActivationFactory(ICoreAutomationRegistrarStatics.fromPtr, | ||
_className, IID_ICoreAutomationRegistrarStatics) | ||
.unregisterAnnotationType(registration); | ||
} |
Oops, something went wrong.