本文整理汇总了C++中Accessible::HasNumericValue方法的典型用法代码示例。如果您正苦于以下问题:C++ Accessible::HasNumericValue方法的具体用法?C++ Accessible::HasNumericValue怎么用?C++ Accessible::HasNumericValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Accessible
的用法示例。
在下文中一共展示了Accessible::HasNumericValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FireAtkTextChangedEvent
nsresult
AccessibleWrap::HandleAccEvent(AccEvent* aEvent)
{
nsresult rv = Accessible::HandleAccEvent(aEvent);
NS_ENSURE_SUCCESS(rv, rv);
Accessible* accessible = aEvent->GetAccessible();
NS_ENSURE_TRUE(accessible, NS_ERROR_FAILURE);
// The accessible can become defunct if we have an xpcom event listener
// which decides it would be fun to change the DOM and flush layout.
if (accessible->IsDefunct())
return NS_OK;
uint32_t type = aEvent->GetEventType();
AtkObject* atkObj = AccessibleWrap::GetAtkObject(accessible);
// We don't create ATK objects for plain text leaves, just return NS_OK in
// such case.
if (!atkObj) {
NS_ASSERTION(type == nsIAccessibleEvent::EVENT_SHOW ||
type == nsIAccessibleEvent::EVENT_HIDE,
"Event other than SHOW and HIDE fired for plain text leaves");
return NS_OK;
}
AccessibleWrap* accWrap = GetAccessibleWrap(atkObj);
if (!accWrap) {
return NS_OK; // Node is shut down
}
switch (type) {
case nsIAccessibleEvent::EVENT_STATE_CHANGE:
{
AccStateChangeEvent* event = downcast_accEvent(aEvent);
MAI_ATK_OBJECT(atkObj)->FireStateChangeEvent(event->GetState(),
event->IsStateEnabled());
break;
}
case nsIAccessibleEvent::EVENT_TEXT_REMOVED:
case nsIAccessibleEvent::EVENT_TEXT_INSERTED:
return FireAtkTextChangedEvent(aEvent, atkObj);
case nsIAccessibleEvent::EVENT_FOCUS:
{
a11y::RootAccessible* rootAccWrap = accWrap->RootAccessible();
if (rootAccWrap && rootAccWrap->mActivated) {
atk_focus_tracker_notify(atkObj);
// Fire state change event for focus
atk_object_notify_state_change(atkObj, ATK_STATE_FOCUSED, true);
return NS_OK;
}
} break;
case nsIAccessibleEvent::EVENT_NAME_CHANGE:
{
nsAutoString newName;
accessible->Name(newName);
MaybeFireNameChange(atkObj, newName);
break;
}
case nsIAccessibleEvent::EVENT_VALUE_CHANGE:
if (accessible->HasNumericValue()) {
// Make sure this is a numeric value. Don't fire for string value changes
// (e.g. text editing) ATK values are always numeric.
g_object_notify((GObject*)atkObj, "accessible-value");
}
break;
case nsIAccessibleEvent::EVENT_SELECTION:
case nsIAccessibleEvent::EVENT_SELECTION_ADD:
case nsIAccessibleEvent::EVENT_SELECTION_REMOVE:
{
// XXX: dupe events may be fired
AccSelChangeEvent* selChangeEvent = downcast_accEvent(aEvent);
g_signal_emit_by_name(AccessibleWrap::GetAtkObject(selChangeEvent->Widget()),
"selection_changed");
break;
}
case nsIAccessibleEvent::EVENT_SELECTION_WITHIN:
{
g_signal_emit_by_name(atkObj, "selection_changed");
break;
}
case nsIAccessibleEvent::EVENT_TEXT_SELECTION_CHANGED:
g_signal_emit_by_name(atkObj, "text_selection_changed");
break;
case nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED:
{
AccCaretMoveEvent* caretMoveEvent = downcast_accEvent(aEvent);
NS_ASSERTION(caretMoveEvent, "Event needs event data");
if (!caretMoveEvent)
//.........这里部分代码省略.........
示例2: ProcessDOMEvent
//.........这里部分代码省略.........
nsINode* targetNode = accessible->GetNode();
if (treeItemAcc && eventType.EqualsLiteral("select")) {
// XXX: We shouldn't be based on DOM select event which doesn't provide us
// any context info. We should integrate into nsTreeSelection instead.
// If multiselect tree, we should fire selectionadd or selection removed
if (FocusMgr()->HasDOMFocus(targetNode)) {
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSel =
targetNode->AsElement()->AsXULMultiSelectControl();
nsAutoString selType;
multiSel->GetSelType(selType);
if (selType.IsEmpty() || !selType.EqualsLiteral("single")) {
// XXX: We need to fire EVENT_SELECTION_ADD and EVENT_SELECTION_REMOVE
// for each tree item. Perhaps each tree item will need to cache its
// selection state and fire an event after a DOM "select" event when
// that state changes. XULTreeAccessible::UpdateTreeSelection();
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_SELECTION_WITHIN,
accessible);
return;
}
RefPtr<AccSelChangeEvent> selChangeEvent = new AccSelChangeEvent(
treeAcc, treeItemAcc, AccSelChangeEvent::eSelectionAdd);
nsEventShell::FireEvent(selChangeEvent);
return;
}
} else
#endif
if (eventType.EqualsLiteral("AlertActive")) {
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_ALERT, accessible);
} else if (eventType.EqualsLiteral("popupshown")) {
HandlePopupShownEvent(accessible);
} else if (eventType.EqualsLiteral("DOMMenuInactive")) {
if (accessible->Role() == roles::MENUPOPUP) {
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_END,
accessible);
}
} else if (eventType.EqualsLiteral("DOMMenuItemActive")) {
FocusMgr()->ActiveItemChanged(accessible);
#ifdef A11Y_LOG
if (logging::IsEnabled(logging::eFocus))
logging::ActiveItemChangeCausedBy("DOMMenuItemActive", accessible);
#endif
} else if (eventType.EqualsLiteral("DOMMenuItemInactive")) {
// Process DOMMenuItemInactive event for autocomplete only because this is
// unique widget that may acquire focus from autocomplete popup while popup
// stays open and has no active item. In case of XUL tree autocomplete
// popup this event is fired for tree accessible.
Accessible* widget =
accessible->IsWidget() ? accessible : accessible->ContainerWidget();
if (widget && widget->IsAutoCompletePopup()) {
FocusMgr()->ActiveItemChanged(nullptr);
#ifdef A11Y_LOG
if (logging::IsEnabled(logging::eFocus))
logging::ActiveItemChangeCausedBy("DOMMenuItemInactive", accessible);
#endif
}
} else if (eventType.EqualsLiteral(
"DOMMenuBarActive")) { // Always from user input
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_MENU_START, accessible,
eFromUserInput);
// Notify of active item change when menubar gets active and if it has
// current item. This is a case of mouseover (set current menuitem) and
// mouse click (activate the menubar). If menubar doesn't have current item
// (can be a case of menubar activation from keyboard) then ignore this
// notification because later we'll receive DOMMenuItemActive event after
// current menuitem is set.
Accessible* activeItem = accessible->CurrentItem();
if (activeItem) {
FocusMgr()->ActiveItemChanged(activeItem);
#ifdef A11Y_LOG
if (logging::IsEnabled(logging::eFocus))
logging::ActiveItemChangeCausedBy("DOMMenuBarActive", accessible);
#endif
}
} else if (eventType.EqualsLiteral(
"DOMMenuBarInactive")) { // Always from user input
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_MENU_END, accessible,
eFromUserInput);
FocusMgr()->ActiveItemChanged(nullptr);
#ifdef A11Y_LOG
if (logging::IsEnabled(logging::eFocus))
logging::ActiveItemChangeCausedBy("DOMMenuBarInactive", accessible);
#endif
} else if (accessible->NeedsDOMUIEvent() &&
eventType.EqualsLiteral("ValueChange")) {
uint32_t event = accessible->HasNumericValue()
? nsIAccessibleEvent::EVENT_VALUE_CHANGE
: nsIAccessibleEvent::EVENT_TEXT_VALUE_CHANGE;
targetDocument->FireDelayedEvent(event, accessible);
}
#ifdef DEBUG_DRAGDROPSTART
else if (eventType.EqualsLiteral("mouseover")) {
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_DRAGDROP_START,
accessible);
}
#endif
}