本文整理汇总了C++中AccessibleWrap::Role方法的典型用法代码示例。如果您正苦于以下问题:C++ AccessibleWrap::Role方法的具体用法?C++ AccessibleWrap::Role怎么用?C++ AccessibleWrap::Role使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AccessibleWrap
的用法示例。
在下文中一共展示了AccessibleWrap::Role方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetAccessibleWrap
AtkRole
getRoleCB(AtkObject *aAtkObj)
{
AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
if (!accWrap)
return ATK_ROLE_INVALID;
#ifdef DEBUG
NS_ASSERTION(nsAccUtils::IsTextInterfaceSupportCorrect(accWrap),
"Does not support nsIAccessibleText when it should");
#endif
if (aAtkObj->role != ATK_ROLE_INVALID)
return aAtkObj->role;
#define ROLE(geckoRole, stringRole, atkRole, macRole, msaaRole, ia2Role) \
case roles::geckoRole: \
aAtkObj->role = atkRole; \
break;
switch (accWrap->Role()) {
#include "RoleMap.h"
default:
MOZ_NOT_REACHED("Unknown role.");
aAtkObj->role = ATK_ROLE_UNKNOWN;
};
#undef ROLE
return aAtkObj->role;
}
示例2: if
AtkRole
getRoleCB(AtkObject *aAtkObj)
{
if (aAtkObj->role != ATK_ROLE_INVALID)
return aAtkObj->role;
AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
a11y::role role;
if (!accWrap) {
ProxyAccessible* proxy = GetProxy(aAtkObj);
if (!proxy)
return ATK_ROLE_INVALID;
role = proxy->Role();
} else {
#ifdef DEBUG
NS_ASSERTION(nsAccUtils::IsTextInterfaceSupportCorrect(accWrap),
"Does not support Text interface when it should");
#endif
role = accWrap->Role();
}
#define ROLE(geckoRole, stringRole, atkRole, macRole, \
msaaRole, ia2Role, nameRule) \
case roles::geckoRole: \
aAtkObj->role = atkRole; \
break;
switch (role) {
#include "RoleMap.h"
default:
MOZ_CRASH("Unknown role.");
};
#undef ROLE
if (aAtkObj->role == ATK_ROLE_LIST_BOX && !IsAtkVersionAtLeast(2, 1))
aAtkObj->role = ATK_ROLE_LIST;
else if (aAtkObj->role == ATK_ROLE_TABLE_ROW && !IsAtkVersionAtLeast(2, 1))
aAtkObj->role = ATK_ROLE_LIST_ITEM;
else if (aAtkObj->role == ATK_ROLE_MATH && !IsAtkVersionAtLeast(2, 12))
aAtkObj->role = ATK_ROLE_PANEL;
else if (aAtkObj->role == ATK_ROLE_STATIC && !IsAtkVersionAtLeast(2, 16))
aAtkObj->role = ATK_ROLE_TEXT;
else if ((aAtkObj->role == ATK_ROLE_MATH_FRACTION ||
aAtkObj->role == ATK_ROLE_MATH_ROOT) && !IsAtkVersionAtLeast(2, 16))
aAtkObj->role = ATK_ROLE_UNKNOWN;
return aAtkObj->role;
}
示例3: ROLE
STDMETHODIMP
ia2Accessible::role(long* aRole)
{
if (!aRole)
return E_INVALIDARG;
*aRole = 0;
AccessibleWrap* acc = static_cast<AccessibleWrap*>(this);
if (acc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
#define ROLE(_geckoRole, stringRole, atkRole, macRole, \
msaaRole, ia2Role, androidClass, nameRule) \
case roles::_geckoRole: \
*aRole = ia2Role; \
break;
a11y::role geckoRole;
MOZ_ASSERT(!acc->IsProxy());
geckoRole = acc->Role();
switch (geckoRole) {
#include "RoleMap.h"
default:
MOZ_CRASH("Unknown role.");
}
#undef ROLE
// Special case, if there is a ROLE_ROW inside of a ROLE_TREE_TABLE, then call
// the IA2 role a ROLE_OUTLINEITEM.
MOZ_ASSERT(!acc->IsProxy());
if (geckoRole == roles::ROW) {
Accessible* xpParent = acc->Parent();
if (xpParent && xpParent->Role() == roles::TREE_TABLE)
*aRole = ROLE_SYSTEM_OUTLINEITEM;
}
return S_OK;
}