wrc: Convert standard control classes names into ids also for UTF-8 resource files.

This commit is contained in:
Mikołaj Zalewski 2008-03-01 23:13:39 +01:00 committed by Alexandre Julliard
parent 088a33729a
commit fee6076a2b
1 changed files with 49 additions and 20 deletions

View File

@ -2079,34 +2079,63 @@ byebye:
return ctrl; return ctrl;
} }
static int get_class_idW(const WCHAR *cc)
{
static const WCHAR szBUTTON[] = {'B','U','T','T','O','N',0};
static const WCHAR szCOMBOBOX[] = {'C','O','M','B','O','B','O','X',0};
static const WCHAR szLISTBOX[] = {'L','I','S','T','B','O','X',0};
static const WCHAR szEDIT[] = {'E','D','I','T',0};
static const WCHAR szSTATIC[] = {'S','T','A','T','I','C',0};
static const WCHAR szSCROLLBAR[] = {'S','C','R','O','L','L','B','A','R',0};
if(!strcmpiW(szBUTTON, cc))
return CT_BUTTON;
if(!strcmpiW(szCOMBOBOX, cc))
return CT_COMBOBOX;
if(!strcmpiW(szLISTBOX, cc))
return CT_LISTBOX;
if(!strcmpiW(szEDIT, cc))
return CT_EDIT;
if(!strcmpiW(szSTATIC, cc))
return CT_STATIC;
if(!strcmpiW(szSCROLLBAR, cc))
return CT_SCROLLBAR;
return -1;
}
static int get_class_idA(const char *cc)
{
if(!strcasecmp("BUTTON", cc))
return CT_BUTTON;
if(!strcasecmp("COMBOBOX", cc))
return CT_COMBOBOX;
if(!strcasecmp("LISTBOX", cc))
return CT_LISTBOX;
if(!strcasecmp("EDIT", cc))
return CT_EDIT;
if(!strcasecmp("STATIC", cc))
return CT_STATIC;
if(!strcasecmp("SCROLLBAR", cc))
return CT_SCROLLBAR;
return -1;
}
static name_id_t *convert_ctlclass(name_id_t *cls) static name_id_t *convert_ctlclass(name_id_t *cls)
{ {
char *cc = NULL;
int iclass; int iclass;
if(cls->type == name_ord) if(cls->type == name_ord)
return cls; return cls;
assert(cls->type == name_str); assert(cls->type == name_str);
if(cls->type == str_unicode) if(cls->name.s_name->type == str_unicode)
{ iclass = get_class_idW(cls->name.s_name->str.wstr);
yyerror("Don't yet support unicode class comparison"); else
} iclass = get_class_idA(cls->name.s_name->str.cstr);
else
cc = cls->name.s_name->str.cstr;
if(!strcasecmp("BUTTON", cc)) if (iclass == -1)
iclass = CT_BUTTON;
else if(!strcasecmp("COMBOBOX", cc))
iclass = CT_COMBOBOX;
else if(!strcasecmp("LISTBOX", cc))
iclass = CT_LISTBOX;
else if(!strcasecmp("EDIT", cc))
iclass = CT_EDIT;
else if(!strcasecmp("STATIC", cc))
iclass = CT_STATIC;
else if(!strcasecmp("SCROLLBAR", cc))
iclass = CT_SCROLLBAR;
else
return cls; /* No default, return user controlclass */ return cls; /* No default, return user controlclass */
free(cls->name.s_name->str.cstr); free(cls->name.s_name->str.cstr);