Commit 21e6fd50 authored by Connor McAdams's avatar Connor McAdams Committed by Alexandre Julliard

uiautomationcore: Implement UiaLookupId for AutomationIdentifierType_ControlType GUIDs.

parent 53fc157f
......@@ -4342,6 +4342,51 @@ static const struct uia_lookup_id uia_pattern_lookup_ids[] = {
{ &CustomNavigation_Pattern_GUID, UIA_CustomNavigationPatternId },
};
static const struct uia_lookup_id uia_control_type_lookup_ids[] = {
{ &Button_Control_GUID, UIA_ButtonControlTypeId },
{ &Calendar_Control_GUID, UIA_CalendarControlTypeId },
{ &CheckBox_Control_GUID, UIA_CheckBoxControlTypeId },
{ &ComboBox_Control_GUID, UIA_ComboBoxControlTypeId },
{ &Edit_Control_GUID, UIA_EditControlTypeId },
{ &Hyperlink_Control_GUID, UIA_HyperlinkControlTypeId },
{ &Image_Control_GUID, UIA_ImageControlTypeId },
{ &ListItem_Control_GUID, UIA_ListItemControlTypeId },
{ &List_Control_GUID, UIA_ListControlTypeId },
{ &Menu_Control_GUID, UIA_MenuControlTypeId },
{ &MenuBar_Control_GUID, UIA_MenuBarControlTypeId },
{ &MenuItem_Control_GUID, UIA_MenuItemControlTypeId },
{ &ProgressBar_Control_GUID, UIA_ProgressBarControlTypeId },
{ &RadioButton_Control_GUID, UIA_RadioButtonControlTypeId },
{ &ScrollBar_Control_GUID, UIA_ScrollBarControlTypeId },
{ &Slider_Control_GUID, UIA_SliderControlTypeId },
{ &Spinner_Control_GUID, UIA_SpinnerControlTypeId },
{ &StatusBar_Control_GUID, UIA_StatusBarControlTypeId },
{ &Tab_Control_GUID, UIA_TabControlTypeId },
{ &TabItem_Control_GUID, UIA_TabItemControlTypeId },
{ &Text_Control_GUID, UIA_TextControlTypeId },
{ &ToolBar_Control_GUID, UIA_ToolBarControlTypeId },
{ &ToolTip_Control_GUID, UIA_ToolTipControlTypeId },
{ &Tree_Control_GUID, UIA_TreeControlTypeId },
{ &TreeItem_Control_GUID, UIA_TreeItemControlTypeId },
{ &Custom_Control_GUID, UIA_CustomControlTypeId },
{ &Group_Control_GUID, UIA_GroupControlTypeId },
{ &Thumb_Control_GUID, UIA_ThumbControlTypeId },
{ &DataGrid_Control_GUID, UIA_DataGridControlTypeId },
{ &DataItem_Control_GUID, UIA_DataItemControlTypeId },
{ &Document_Control_GUID, UIA_DocumentControlTypeId },
{ &SplitButton_Control_GUID, UIA_SplitButtonControlTypeId },
{ &Window_Control_GUID, UIA_WindowControlTypeId },
{ &Pane_Control_GUID, UIA_PaneControlTypeId },
{ &Header_Control_GUID, UIA_HeaderControlTypeId },
{ &HeaderItem_Control_GUID, UIA_HeaderItemControlTypeId },
{ &Table_Control_GUID, UIA_TableControlTypeId },
{ &TitleBar_Control_GUID, UIA_TitleBarControlTypeId },
{ &Separator_Control_GUID, UIA_SeparatorControlTypeId },
/* Implemented on Win8+ */
{ &SemanticZoom_Control_GUID, UIA_SemanticZoomControlTypeId },
{ &AppBar_Control_GUID, UIA_AppBarControlTypeId },
};
static void test_UiaLookupId(void)
{
static const struct {
......@@ -4354,6 +4399,7 @@ static void test_UiaLookupId(void)
{ "property", AutomationIdentifierType_Property, uia_property_lookup_ids, ARRAY_SIZE(uia_property_lookup_ids) },
{ "event", AutomationIdentifierType_Event, uia_event_lookup_ids, ARRAY_SIZE(uia_event_lookup_ids) },
{ "pattern", AutomationIdentifierType_Pattern, uia_pattern_lookup_ids, ARRAY_SIZE(uia_pattern_lookup_ids) },
{ "control_type", AutomationIdentifierType_ControlType, uia_control_type_lookup_ids, ARRAY_SIZE(uia_control_type_lookup_ids) },
};
unsigned int i, y;
......
......@@ -40,6 +40,11 @@ struct uia_pattern_info {
const GUID *pattern_iid;
};
struct uia_control_type_info {
const GUID *guid;
int control_type_id;
};
[
version(1.0),
uuid(8a9ca8eb-856b-43d9-abd7-4a590054064f),
......
......@@ -44,6 +44,13 @@ static int __cdecl uia_pattern_guid_compare(const void *a, const void *b)
return memcmp(guid, pattern->guid, sizeof(*guid));
}
static int __cdecl uia_control_type_guid_compare(const void *a, const void *b)
{
const GUID *guid = a;
const struct uia_control_type_info *control = b;
return memcmp(guid, control->guid, sizeof(*guid));
}
/* Sorted by GUID. */
static const struct uia_prop_info default_uia_properties[] = {
{ &AutomationId_Property_GUID, UIA_AutomationIdPropertyId,
......@@ -514,6 +521,62 @@ const struct uia_pattern_info *uia_pattern_info_from_id(PATTERNID pattern_id)
return &default_uia_patterns[pattern_id_idx[pattern_id - PATTERN_ID_MIN]];
}
/* Sorted by GUID. */
static const struct uia_control_type_info default_uia_control_types[] = {
{ &Table_Control_GUID, UIA_TableControlTypeId },
{ &StatusBar_Control_GUID, UIA_StatusBarControlTypeId },
{ &Group_Control_GUID, UIA_GroupControlTypeId },
{ &SplitButton_Control_GUID, UIA_SplitButtonControlTypeId },
{ &CheckBox_Control_GUID, UIA_CheckBoxControlTypeId },
{ &Hyperlink_Control_GUID, UIA_HyperlinkControlTypeId },
{ &Tab_Control_GUID, UIA_TabControlTypeId },
{ &ScrollBar_Control_GUID, UIA_ScrollBarControlTypeId },
{ &Spinner_Control_GUID, UIA_SpinnerControlTypeId },
{ &Menu_Control_GUID, UIA_MenuControlTypeId },
{ &Window_Control_GUID, UIA_WindowControlTypeId },
{ &DataItem_Control_GUID, UIA_DataItemControlTypeId },
{ &SemanticZoom_Control_GUID, UIA_SemanticZoomControlTypeId },
{ &Slider_Control_GUID, UIA_SliderControlTypeId },
{ &TabItem_Control_GUID, UIA_TabItemControlTypeId },
{ &MenuBar_Control_GUID, UIA_MenuBarControlTypeId },
{ &ToolBar_Control_GUID, UIA_ToolBarControlTypeId },
{ &Pane_Control_GUID, UIA_PaneControlTypeId },
{ &Button_Control_GUID, UIA_ButtonControlTypeId },
{ &ComboBox_Control_GUID, UIA_ComboBoxControlTypeId },
{ &Document_Control_GUID, UIA_DocumentControlTypeId },
{ &Thumb_Control_GUID, UIA_ThumbControlTypeId },
{ &ProgressBar_Control_GUID, UIA_ProgressBarControlTypeId },
{ &Calendar_Control_GUID, UIA_CalendarControlTypeId },
{ &AppBar_Control_GUID, UIA_AppBarControlTypeId },
{ &Tree_Control_GUID, UIA_TreeControlTypeId },
{ &Separator_Control_GUID, UIA_SeparatorControlTypeId },
{ &DataGrid_Control_GUID, UIA_DataGridControlTypeId },
{ &TreeItem_Control_GUID, UIA_TreeItemControlTypeId },
{ &TitleBar_Control_GUID, UIA_TitleBarControlTypeId },
{ &Custom_Control_GUID, UIA_CustomControlTypeId },
{ &Edit_Control_GUID, UIA_EditControlTypeId },
{ &HeaderItem_Control_GUID, UIA_HeaderItemControlTypeId },
{ &Header_Control_GUID, UIA_HeaderControlTypeId },
{ &ToolTip_Control_GUID, UIA_ToolTipControlTypeId },
{ &MenuItem_Control_GUID, UIA_MenuItemControlTypeId },
{ &RadioButton_Control_GUID, UIA_RadioButtonControlTypeId },
{ &Text_Control_GUID, UIA_TextControlTypeId },
{ &List_Control_GUID, UIA_ListControlTypeId },
{ &Image_Control_GUID, UIA_ImageControlTypeId },
{ &ListItem_Control_GUID, UIA_ListItemControlTypeId },
};
static const struct uia_control_type_info *uia_control_type_info_from_guid(const GUID *guid)
{
struct uia_control_type_info *control_type;
if ((control_type = bsearch(guid, default_uia_control_types, ARRAY_SIZE(default_uia_control_types),
sizeof(*control_type), uia_control_type_guid_compare)))
return control_type;
return NULL;
}
/***********************************************************************
* UiaLookupId (uiautomationcore.@)
*/
......@@ -562,6 +625,17 @@ int WINAPI UiaLookupId(enum AutomationIdentifierType type, const GUID *guid)
}
case AutomationIdentifierType_ControlType:
{
const struct uia_control_type_info *control_type = uia_control_type_info_from_guid(guid);
if (control_type)
ret_id = control_type->control_type_id;
else
FIXME("Failed to find control type Id for GUID %s\n", debugstr_guid(guid));
break;
}
case AutomationIdentifierType_TextAttribute:
case AutomationIdentifierType_LandmarkType:
case AutomationIdentifierType_Annotation:
......
......@@ -299,6 +299,51 @@ DEFINE_GUID(DropTarget_Pattern_GUID, 0x0bcbec56,0xbd34,0x4b7b,0x9f,0xd5,0
DEFINE_GUID(TextEdit_Pattern_GUID, 0x69f3ff89,0x5af9,0x4c75,0x93,0x40,0xf2,0xde,0x29,0x2e,0x45,0x91);
DEFINE_GUID(CustomNavigation_Pattern_GUID, 0xafea938a,0x621e,0x4054,0xbb,0x2c,0x2f,0x46,0x11,0x4d,0xac,0x3f);
/*
* AutomationIdentifierType_ControlType GUIDs.
*/
DEFINE_GUID(Button_Control_GUID, 0x5a78e369,0xc6a1,0x4f33,0xa9,0xd7,0x79,0xf2,0x0d,0x0c,0x78,0x8e);
DEFINE_GUID(Calendar_Control_GUID, 0x8913eb88,0x00e5,0x46bc,0x8e,0x4e,0x14,0xa7,0x86,0xe1,0x65,0xa1);
DEFINE_GUID(CheckBox_Control_GUID, 0xfb50f922,0xa3db,0x49c0,0x8b,0xc3,0x06,0xda,0xd5,0x57,0x78,0xe2);
DEFINE_GUID(ComboBox_Control_GUID, 0x54cb426c,0x2f33,0x4fff,0xaa,0xa1,0xae,0xf6,0x0d,0xac,0x5d,0xeb);
DEFINE_GUID(Edit_Control_GUID, 0x6504a5c8,0x2c86,0x4f87,0xae,0x7b,0x1a,0xbd,0xdc,0x81,0x0c,0xf9);
DEFINE_GUID(Hyperlink_Control_GUID, 0x8a56022c,0xb00d,0x4d15,0x8f,0xf0,0x5b,0x6b,0x26,0x6e,0x5e,0x02);
DEFINE_GUID(Image_Control_GUID, 0x2d3736e4,0x6b16,0x4c57,0xa9,0x62,0xf9,0x32,0x60,0xa7,0x52,0x43);
DEFINE_GUID(ListItem_Control_GUID, 0x7b3717f2,0x44d1,0x4a58,0x98,0xa8,0xf1,0x2a,0x9b,0x8f,0x78,0xe2);
DEFINE_GUID(List_Control_GUID, 0x9b149ee1,0x7cca,0x4cfc,0x9a,0xf1,0xca,0xc7,0xbd,0xdd,0x30,0x31);
DEFINE_GUID(Menu_Control_GUID, 0x2e9b1440,0x0ea8,0x41fd,0xb3,0x74,0xc1,0xea,0x6f,0x50,0x3c,0xd1);
DEFINE_GUID(MenuBar_Control_GUID, 0xcc384250,0x0e7b,0x4ae8,0x95,0xae,0xa0,0x8f,0x26,0x1b,0x52,0xee);
DEFINE_GUID(MenuItem_Control_GUID, 0xf45225d3,0xd0a0,0x49d8,0x98,0x34,0x9a,0x00,0x0d,0x2a,0xed,0xdc);
DEFINE_GUID(ProgressBar_Control_GUID, 0x228c9f86,0xc36c,0x47bb,0x9f,0xb6,0xa5,0x83,0x4b,0xfc,0x53,0xa4);
DEFINE_GUID(RadioButton_Control_GUID, 0x3bdb49db,0xfe2c,0x4483,0xb3,0xe1,0xe5,0x7f,0x21,0x94,0x40,0xc6);
DEFINE_GUID(ScrollBar_Control_GUID, 0xdaf34b36,0x5065,0x4946,0xb2,0x2f,0x92,0x59,0x5f,0xc0,0x75,0x1a);
DEFINE_GUID(Slider_Control_GUID, 0xb033c24b,0x3b35,0x4cea,0xb6,0x09,0x76,0x36,0x82,0xfa,0x66,0x0b);
DEFINE_GUID(Spinner_Control_GUID, 0x60cc4b38,0x3cb1,0x4161,0xb4,0x42,0xc6,0xb7,0x26,0xc1,0x78,0x25);
DEFINE_GUID(StatusBar_Control_GUID, 0xd45e7d1b,0x5873,0x475f,0x95,0xa4,0x04,0x33,0xe1,0xf1,0xb0,0x0a);
DEFINE_GUID(Tab_Control_GUID, 0x38cd1f2d,0x337a,0x4bd2,0xa5,0xe3,0xad,0xb4,0x69,0xe3,0x0b,0xd3);
DEFINE_GUID(TabItem_Control_GUID, 0x2c6a634f,0x921b,0x4e6e,0xb2,0x6e,0x08,0xfc,0xb0,0x79,0x8f,0x4c);
DEFINE_GUID(Text_Control_GUID, 0xae9772dc,0xd331,0x4f09,0xbe,0x20,0x7e,0x6d,0xfa,0xf0,0x7b,0x0a);
DEFINE_GUID(ToolBar_Control_GUID, 0x8f06b751,0xe182,0x4e98,0x88,0x93,0x22,0x84,0x54,0x3a,0x7d,0xce);
DEFINE_GUID(ToolTip_Control_GUID, 0x05ddc6d1,0x2137,0x4768,0x98,0xea,0x73,0xf5,0x2f,0x71,0x34,0xf3);
DEFINE_GUID(Tree_Control_GUID, 0x7561349c,0xd241,0x43f4,0x99,0x08,0xb5,0xf0,0x91,0xbe,0xe6,0x11);
DEFINE_GUID(TreeItem_Control_GUID, 0x62c9feb9,0x8ffc,0x4878,0xa3,0xa4,0x96,0xb0,0x30,0x31,0x5c,0x18);
DEFINE_GUID(Custom_Control_GUID, 0xf29ea0c3,0xadb7,0x430a,0xba,0x90,0xe5,0x2c,0x73,0x13,0xe6,0xed);
DEFINE_GUID(Group_Control_GUID, 0xad50aa1c,0xe8c8,0x4774,0xae,0x1b,0xdd,0x86,0xdf,0x0b,0x3b,0xdc);
DEFINE_GUID(Thumb_Control_GUID, 0x701ca877,0xe310,0x4dd6,0xb6,0x44,0x79,0x7e,0x4f,0xae,0xa2,0x13);
DEFINE_GUID(DataGrid_Control_GUID, 0x84b783af,0xd103,0x4b0a,0x84,0x15,0xe7,0x39,0x42,0x41,0x0f,0x4b);
DEFINE_GUID(DataItem_Control_GUID, 0xa0177842,0xd94f,0x42a5,0x81,0x4b,0x60,0x68,0xad,0xdc,0x8d,0xa5);
DEFINE_GUID(Document_Control_GUID, 0x3cd6bb6f,0x6f08,0x4562,0xb2,0x29,0xe4,0xe2,0xfc,0x7a,0x9e,0xb4);
DEFINE_GUID(SplitButton_Control_GUID, 0x7011f01f,0x4ace,0x4901,0xb4,0x61,0x92,0x0a,0x6f,0x1c,0xa6,0x50);
DEFINE_GUID(Window_Control_GUID, 0xe13a7242,0xf462,0x4f4d,0xae,0xc1,0x53,0xb2,0x8d,0x6c,0x32,0x90);
DEFINE_GUID(Pane_Control_GUID, 0x5c2b3f5b,0x9182,0x42a3,0x8d,0xec,0x8c,0x04,0xc1,0xee,0x63,0x4d);
DEFINE_GUID(Header_Control_GUID, 0x5b90cbce,0x78fb,0x4614,0x82,0xb6,0x55,0x4d,0x74,0x71,0x8e,0x67);
DEFINE_GUID(HeaderItem_Control_GUID, 0xe6bc12cb,0x7c8e,0x49cf,0xb1,0x68,0x4a,0x93,0xa3,0x2b,0xeb,0xb0);
DEFINE_GUID(Table_Control_GUID, 0x773bfa0e,0x5bc4,0x4deb,0x92,0x1b,0xde,0x7b,0x32,0x06,0x22,0x9e);
DEFINE_GUID(TitleBar_Control_GUID, 0x98aa55bf,0x3bb0,0x4b65,0x83,0x6e,0x2e,0xa3,0x0d,0xbc,0x17,0x1f);
DEFINE_GUID(Separator_Control_GUID, 0x8767eba3,0x2a63,0x4ab0,0xac,0x8d,0xaa,0x50,0xe2,0x3d,0xe9,0x78);
DEFINE_GUID(SemanticZoom_Control_GUID, 0x5fd34a43,0x061e,0x42c8,0xb5,0x89,0x9d,0xcc,0xf7,0x4b,0xc4,0x3a);
DEFINE_GUID(AppBar_Control_GUID, 0x6114908d,0xcc02,0x4d37,0x87,0x5b,0xb5,0x30,0xc7,0x13,0x95,0x54);
enum AutomationIdentifierType
{
AutomationIdentifierType_Property,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment