@@ -15,7 +15,6 @@ use accesskit::{
15
15
Toggled ,
16
16
} ;
17
17
use accesskit_consumer:: { FilterResult , Node , TreeState } ;
18
- use paste:: paste;
19
18
use std:: sync:: { atomic:: Ordering , Arc , Weak } ;
20
19
use windows:: {
21
20
core:: * ,
@@ -811,11 +810,11 @@ impl IRawElementProviderFragmentRoot_Impl for PlatformNode_Impl {
811
810
}
812
811
813
812
macro_rules! properties {
814
- ( $( ( $base_id : ident, $m: ident) ) ,+) => {
813
+ ( $( ( $id : ident, $m: ident) ) ,+) => {
815
814
impl NodeWrapper <' _> {
816
815
fn get_property_value( & self , property_id: UIA_PROPERTY_ID ) -> Variant {
817
816
match property_id {
818
- $( paste! { [ < UIA_ $base_id PropertyId > ] } => {
817
+ $( $id => {
819
818
self . $m( ) . into( )
820
819
} ) *
821
820
_ => Variant :: empty( )
@@ -834,7 +833,7 @@ macro_rules! properties {
834
833
self . enqueue_property_change(
835
834
queue,
836
835
element,
837
- paste! { [ < UIA_ $base_id PropertyId > ] } ,
836
+ $id ,
838
837
old_value. into( ) ,
839
838
new_value. into( ) ,
840
839
) ;
@@ -846,8 +845,8 @@ macro_rules! properties {
846
845
}
847
846
848
847
macro_rules! patterns {
849
- ( $( ( $base_pattern_id : ident, $is_supported: ident, (
850
- $( ( $base_property_id : ident, $getter: ident, $com_type: ident) ) ,*
848
+ ( $( ( $pattern_id : ident , $provider_interface : ident , $provider_interface_impl : ident, $is_supported: ident, (
849
+ $( ( $property_id : ident , $com_getter : ident, $getter: ident, $com_type: ident) ) ,*
851
850
) , (
852
851
$( $extra_trait_method: item) ,*
853
852
) ) ) ,+) => {
@@ -856,11 +855,10 @@ macro_rules! patterns {
856
855
self . resolve( |node| {
857
856
let wrapper = NodeWrapper ( & node) ;
858
857
match pattern_id {
859
- $( paste! { [ < UIA_ $base_pattern_id PatternId > ] } => {
858
+ $( $pattern_id => {
860
859
if wrapper. $is_supported( ) {
861
860
// SAFETY: We know we're running inside a full COM implementation.
862
- let intermediate: paste! { [ < I $base_pattern_id Provider >] } =
863
- unsafe { self . cast( ) } ?;
861
+ let intermediate: $provider_interface = unsafe { self . cast( ) } ?;
864
862
return intermediate. cast( ) ;
865
863
}
866
864
} ) *
@@ -885,7 +883,7 @@ macro_rules! patterns {
885
883
self . enqueue_property_change(
886
884
queue,
887
885
element,
888
- paste! { [ < UIA_ $base_pattern_id $base_property_id PropertyId > ] } ,
886
+ $property_id ,
889
887
old_value. into( ) ,
890
888
new_value. into( ) ,
891
889
) ;
@@ -894,58 +892,56 @@ macro_rules! patterns {
894
892
} ) *
895
893
}
896
894
}
897
- paste! {
898
- $( #[ allow( non_snake_case) ]
899
- impl [ < I $base_pattern_id Provider_Impl >] for PlatformNode_Impl {
900
- $( fn $base_property_id( & self ) -> Result <$com_type> {
901
- self . resolve( |node| {
902
- let wrapper = NodeWrapper ( & node) ;
903
- Ok ( wrapper. $getter( ) . into( ) )
904
- } )
905
- } ) *
906
- $( $extra_trait_method) *
895
+ $( #[ allow( non_snake_case) ]
896
+ impl $provider_interface_impl for PlatformNode_Impl {
897
+ $( fn $com_getter( & self ) -> Result <$com_type> {
898
+ self . resolve( |node| {
899
+ let wrapper = NodeWrapper ( & node) ;
900
+ Ok ( wrapper. $getter( ) . into( ) )
901
+ } )
907
902
} ) *
908
- }
903
+ $( $extra_trait_method) *
904
+ } ) *
909
905
} ;
910
906
}
911
907
912
908
properties ! {
913
- ( ControlType , control_type) ,
914
- ( LocalizedControlType , localized_control_type) ,
915
- ( Name , name) ,
916
- ( FullDescription , description) ,
917
- ( HelpText , placeholder) ,
918
- ( IsContentElement , is_content_element) ,
919
- ( IsControlElement , is_content_element) ,
920
- ( IsEnabled , is_enabled) ,
921
- ( IsKeyboardFocusable , is_focusable) ,
922
- ( HasKeyboardFocus , is_focused) ,
923
- ( LiveSetting , live_setting) ,
924
- ( AutomationId , automation_id) ,
925
- ( ClassName , class_name) ,
926
- ( Orientation , orientation) ,
927
- ( IsRequiredForForm , is_required) ,
928
- ( IsPassword , is_password) ,
929
- ( PositionInSet , position_in_set) ,
930
- ( SizeOfSet , size_of_set)
909
+ ( UIA_ControlTypePropertyId , control_type) ,
910
+ ( UIA_LocalizedControlTypePropertyId , localized_control_type) ,
911
+ ( UIA_NamePropertyId , name) ,
912
+ ( UIA_FullDescriptionPropertyId , description) ,
913
+ ( UIA_HelpTextPropertyId , placeholder) ,
914
+ ( UIA_IsContentElementPropertyId , is_content_element) ,
915
+ ( UIA_IsControlElementPropertyId , is_content_element) ,
916
+ ( UIA_IsEnabledPropertyId , is_enabled) ,
917
+ ( UIA_IsKeyboardFocusablePropertyId , is_focusable) ,
918
+ ( UIA_HasKeyboardFocusPropertyId , is_focused) ,
919
+ ( UIA_LiveSettingPropertyId , live_setting) ,
920
+ ( UIA_AutomationIdPropertyId , automation_id) ,
921
+ ( UIA_ClassNamePropertyId , class_name) ,
922
+ ( UIA_OrientationPropertyId , orientation) ,
923
+ ( UIA_IsRequiredForFormPropertyId , is_required) ,
924
+ ( UIA_IsPasswordPropertyId , is_password) ,
925
+ ( UIA_PositionInSetPropertyId , position_in_set) ,
926
+ ( UIA_SizeOfSetPropertyId , size_of_set)
931
927
}
932
928
933
929
patterns ! {
934
- ( Toggle , is_toggle_pattern_supported, (
935
- ( ToggleState , toggle_state, ToggleState )
930
+ ( UIA_TogglePatternId , IToggleProvider , IToggleProvider_Impl , is_toggle_pattern_supported, (
931
+ ( UIA_ToggleToggleStatePropertyId , ToggleState , toggle_state, ToggleState )
936
932
) , (
937
933
fn Toggle ( & self ) -> Result <( ) > {
938
934
self . click( )
939
935
}
940
936
) ) ,
941
- ( Invoke , is_invoke_pattern_supported, ( ) , (
937
+ ( UIA_InvokePatternId , IInvokeProvider , IInvokeProvider_Impl , is_invoke_pattern_supported, ( ) , (
942
938
fn Invoke ( & self ) -> Result <( ) > {
943
939
self . click( )
944
940
}
945
941
) ) ,
946
- ( Value , is_value_pattern_supported, (
947
- ( Value , value, BSTR ) ,
948
- ( IsReadOnly , is_read_only, BOOL )
942
+ ( UIA_ValuePatternId , IValueProvider , IValueProvider_Impl , is_value_pattern_supported, (
943
+ ( UIA_ValueValuePropertyId , Value , value, BSTR ) ,
944
+ ( UIA_ValueIsReadOnlyPropertyId , IsReadOnly , is_read_only, BOOL )
949
945
) , (
950
946
fn SetValue ( & self , value: & PCWSTR ) -> Result <( ) > {
951
947
self . do_action( || {
@@ -954,21 +950,21 @@ patterns! {
954
950
} )
955
951
}
956
952
) ) ,
957
- ( RangeValue , is_range_value_pattern_supported, (
958
- ( Value , numeric_value, f64 ) ,
959
- ( IsReadOnly , is_read_only, BOOL ) ,
960
- ( Minimum , min_numeric_value, f64 ) ,
961
- ( Maximum , max_numeric_value, f64 ) ,
962
- ( SmallChange , numeric_value_step, f64 ) ,
963
- ( LargeChange , numeric_value_jump, f64 )
953
+ ( UIA_RangeValuePatternId , IRangeValueProvider , IRangeValueProvider_Impl , is_range_value_pattern_supported, (
954
+ ( UIA_RangeValueValuePropertyId , Value , numeric_value, f64 ) ,
955
+ ( UIA_RangeValueIsReadOnlyPropertyId , IsReadOnly , is_read_only, BOOL ) ,
956
+ ( UIA_RangeValueMinimumPropertyId , Minimum , min_numeric_value, f64 ) ,
957
+ ( UIA_RangeValueMaximumPropertyId , Maximum , max_numeric_value, f64 ) ,
958
+ ( UIA_RangeValueSmallChangePropertyId , SmallChange , numeric_value_step, f64 ) ,
959
+ ( UIA_RangeValueLargeChangePropertyId , LargeChange , numeric_value_jump, f64 )
964
960
) , (
965
961
fn SetValue ( & self , value: f64 ) -> Result <( ) > {
966
962
self . do_action( || {
967
963
( Action :: SetValue , Some ( ActionData :: NumericValue ( value) ) )
968
964
} )
969
965
}
970
966
) ) ,
971
- ( SelectionItem , is_selection_item_pattern_supported, ( ) , (
967
+ ( UIA_SelectionItemPatternId , ISelectionItemProvider , ISelectionItemProvider_Impl , is_selection_item_pattern_supported, ( ) , (
972
968
fn IsSelected ( & self ) -> Result <BOOL > {
973
969
self . resolve( |node| {
974
970
let wrapper = NodeWrapper ( & node) ;
@@ -998,9 +994,9 @@ patterns! {
998
994
} )
999
995
}
1000
996
) ) ,
1001
- ( Selection , is_selection_pattern_supported, (
1002
- ( CanSelectMultiple , is_multiselectable, BOOL ) ,
1003
- ( IsSelectionRequired , is_required, BOOL )
997
+ ( UIA_SelectionPatternId , ISelectionProvider , ISelectionProvider_Impl , is_selection_pattern_supported, (
998
+ ( UIA_SelectionCanSelectMultiplePropertyId , CanSelectMultiple , is_multiselectable, BOOL ) ,
999
+ ( UIA_SelectionIsSelectionRequiredPropertyId , IsSelectionRequired , is_required, BOOL )
1004
1000
) , (
1005
1001
fn GetSelection ( & self ) -> Result <* mut SAFEARRAY > {
1006
1002
self . resolve( |node| {
@@ -1015,7 +1011,7 @@ patterns! {
1015
1011
} )
1016
1012
}
1017
1013
) ) ,
1018
- ( Text , is_text_pattern_supported, ( ) , (
1014
+ ( UIA_TextPatternId , ITextProvider , ITextProvider_Impl , is_text_pattern_supported, ( ) , (
1019
1015
fn GetSelection ( & self ) -> Result <* mut SAFEARRAY > {
1020
1016
self . resolve_for_text_pattern( |node| {
1021
1017
if let Some ( range) = node. text_selection( ) {
0 commit comments