本文整理汇总了C++中AccessibleWrap::Parent方法的典型用法代码示例。如果您正苦于以下问题:C++ AccessibleWrap::Parent方法的具体用法?C++ AccessibleWrap::Parent怎么用?C++ AccessibleWrap::Parent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AccessibleWrap
的用法示例。
在下文中一共展示了AccessibleWrap::Parent方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReturnString
static const gchar*
getKeyBindingCB(AtkAction *aAction, gint aActionIndex)
{
AccessibleWrap* acc = GetAccessibleWrap(ATK_OBJECT(aAction));
if (!acc)
return nullptr;
// Return all key bindings including access key and keyboard shortcut.
nsAutoString keyBindingsStr;
// Get access key.
KeyBinding keyBinding = acc->AccessKey();
if (!keyBinding.IsEmpty()) {
keyBinding.AppendToString(keyBindingsStr, KeyBinding::eAtkFormat);
Accessible* parent = acc->Parent();
roles::Role role = parent ? parent->Role() : roles::NOTHING;
if (role == roles::PARENT_MENUITEM || role == roles::MENUITEM ||
role == roles::RADIO_MENU_ITEM || role == roles::CHECK_MENU_ITEM) {
// It is submenu, expose keyboard shortcuts from menu hierarchy like
// "s;<Alt>f:s"
nsAutoString keysInHierarchyStr = keyBindingsStr;
do {
KeyBinding parentKeyBinding = parent->AccessKey();
if (!parentKeyBinding.IsEmpty()) {
nsAutoString str;
parentKeyBinding.ToString(str, KeyBinding::eAtkFormat);
str.Append(':');
keysInHierarchyStr.Insert(str, 0);
}
} while ((parent = parent->Parent()) && parent->Role() != roles::MENUBAR);
keyBindingsStr.Append(';');
keyBindingsStr.Append(keysInHierarchyStr);
}
} else {
// No access key, add ';' to point this.
keyBindingsStr.Append(';');
}
// Get keyboard shortcut.
keyBindingsStr.Append(';');
keyBinding = acc->KeyboardShortcut();
if (!keyBinding.IsEmpty()) {
keyBinding.AppendToString(keyBindingsStr, KeyBinding::eAtkFormat);
}
return AccessibleWrap::ReturnString(keyBindingsStr);
}
示例2: GetAccessibleWrap
gint
getIndexInParentCB(AtkObject *aAtkObj)
{
// We don't use nsIAccessible::GetIndexInParent() because
// for ATK we don't want to include text leaf nodes as children
AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
if (!accWrap) {
return -1;
}
Accessible* parent = accWrap->Parent();
if (!parent)
return -1; // No parent
return parent->GetIndexOfEmbeddedChild(accWrap);
}
示例3: GetAccessibleWrap
gint
getIndexInParentCB(AtkObject* aAtkObj)
{
// We don't use Accessible::IndexInParent() because we don't include text
// leaf nodes as children in ATK.
AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
if (!accWrap) {
return -1;
}
Accessible* parent = accWrap->Parent();
if (!parent)
return -1; // No parent
return parent->GetIndexOfEmbeddedChild(accWrap);
}
示例4: GetHRESULT
STDMETHODIMP
ia2AccessibleComponent::get_locationInParent(long* aX, long* aY)
{
A11Y_TRYBLOCK_BEGIN
*aX = 0;
*aY = 0;
AccessibleWrap* acc = static_cast<AccessibleWrap*>(this);
if (acc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
// If the object is not on any screen the returned position is (0,0).
uint64_t state = acc->State();
if (state & states::INVISIBLE)
return S_OK;
int32_t x = 0, y = 0, width = 0, height = 0;
nsresult rv = acc->GetBounds(&x, &y, &width, &height);
if (NS_FAILED(rv))
return GetHRESULT(rv);
Accessible* parentAcc = acc->Parent();
// The coordinates of the returned position are relative to this object's
// parent or relative to the screen on which this object is rendered if it
// has no parent.
if (!parentAcc) {
*aX = x;
*aY = y;
return S_OK;
}
// The coordinates of the bounding box are given relative to the parent's
// coordinate system.
int32_t parentx = 0, parenty = 0;
rv = acc->GetBounds(&parentx, &parenty, &width, &height);
if (NS_FAILED(rv))
return GetHRESULT(rv);
*aX = x - parentx;
*aY = y - parenty;
return S_OK;
A11Y_TRYBLOCK_END
}
示例5: 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;
}