本文整理汇总了C++中Accessible::NativeRole方法的典型用法代码示例。如果您正苦于以下问题:C++ Accessible::NativeRole方法的具体用法?C++ Accessible::NativeRole怎么用?C++ Accessible::NativeRole使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Accessible
的用法示例。
在下文中一共展示了Accessible::NativeRole方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: KeyBinding
KeyBinding
XULMenuitemAccessible::AccessKey() const
{
// Return menu accesskey: N or Alt+F.
static int32_t gMenuAccesskeyModifier = -1; // magic value of -1 indicates unitialized state
// We do not use nsCoreUtils::GetAccesskeyFor() because accesskeys for
// menu are't registered by EventStateManager.
nsAutoString accesskey;
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::accesskey,
accesskey);
if (accesskey.IsEmpty())
return KeyBinding();
uint32_t modifierKey = 0;
Accessible* parentAcc = Parent();
if (parentAcc) {
if (parentAcc->NativeRole() == roles::MENUBAR) {
// If top level menu item, add Alt+ or whatever modifier text to string
// No need to cache pref service, this happens rarely
if (gMenuAccesskeyModifier == -1) {
// Need to initialize cached global accesskey pref
gMenuAccesskeyModifier = Preferences::GetInt("ui.key.menuAccessKey", 0);
}
switch (gMenuAccesskeyModifier) {
case dom::KeyboardEvent_Binding::DOM_VK_CONTROL:
modifierKey = KeyBinding::kControl;
break;
case dom::KeyboardEvent_Binding::DOM_VK_ALT:
modifierKey = KeyBinding::kAlt;
break;
case dom::KeyboardEvent_Binding::DOM_VK_META:
modifierKey = KeyBinding::kMeta;
break;
case dom::KeyboardEvent_Binding::DOM_VK_WIN:
modifierKey = KeyBinding::kOS;
break;
}
}
}
return KeyBinding(accesskey[0], modifierKey);
}