本文整理汇总了C++中Accessible::Name方法的典型用法代码示例。如果您正苦于以下问题:C++ Accessible::Name方法的具体用法?C++ Accessible::Name怎么用?C++ Accessible::Name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Accessible
的用法示例。
在下文中一共展示了Accessible::Name方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AccEvent
bool
EventQueue::PushNameChange(Accessible* aTarget)
{
// Fire name change event on parent given that this event hasn't been
// coalesced, the parent's name was calculated from its subtree, and the
// subtree was changed.
if (aTarget->HasNameDependentParent()) {
// Only continue traversing up the tree if it's possible that the parent
// accessible's name can depend on this accessible's name.
Accessible* parent = aTarget->Parent();
while (parent &&
nsTextEquivUtils::HasNameRule(parent, eNameFromSubtreeIfReqRule)) {
// Test possible name dependent parent.
if (nsTextEquivUtils::HasNameRule(parent, eNameFromSubtreeRule)) {
nsAutoString name;
ENameValueFlag nameFlag = parent->Name(name);
// If name is obtained from subtree, fire name change event.
if (nameFlag == eNameFromSubtree) {
RefPtr<AccEvent> nameChangeEvent =
new AccEvent(nsIAccessibleEvent::EVENT_NAME_CHANGE, parent);
return PushEvent(nameChangeEvent);
}
break;
}
parent = parent->Parent();
}
}
return false;
}
示例2: SelectedOption
void
HTMLComboboxAccessible::Value(nsString& aValue)
{
// Use accessible name of selected option.
Accessible* option = SelectedOption();
if (option)
option->Name(aValue);
}
示例3: ColDescription
void XULTreeGridAccessible::ColDescription(uint32_t aColIdx,
nsString& aDescription) {
aDescription.Truncate();
Accessible* treeColumns = Accessible::GetChildAt(0);
if (treeColumns) {
Accessible* treeColumnItem = treeColumns->GetChildAt(aColIdx);
if (treeColumnItem) treeColumnItem->Name(aDescription);
}
}
示例4: IdToAccessible
bool
DocAccessibleChild::RecvName(const uint64_t& aID, nsString* aName)
{
Accessible* acc = IdToAccessible(aID);
if (!acc)
return true;
acc->Name(*aName);
return true;
}
示例5: RelationByType
ENameValueFlag
XULGroupboxAccessible::NativeName(nsString& aName)
{
// XXX: we use the first related accessible only.
Accessible* label =
RelationByType(RelationType::LABELLED_BY).Next();
if (label)
return label->Name(aName);
return eNameOK;
}
示例6: AccEvent
bool
EventQueue::PushEvent(AccEvent* aEvent)
{
NS_ASSERTION((aEvent->mAccessible && aEvent->mAccessible->IsApplication()) ||
aEvent->GetDocAccessible() == mDocument,
"Queued event belongs to another document!");
if (!mEvents.AppendElement(aEvent))
return false;
// Filter events.
CoalesceEvents();
// Fire name change event on parent given that this event hasn't been
// coalesced, the parent's name was calculated from its subtree, and the
// subtree was changed.
Accessible* target = aEvent->mAccessible;
if (aEvent->mEventRule != AccEvent::eDoNotEmit &&
target->HasNameDependentParent() &&
(aEvent->mEventType == nsIAccessibleEvent::EVENT_NAME_CHANGE ||
aEvent->mEventType == nsIAccessibleEvent::EVENT_TEXT_REMOVED ||
aEvent->mEventType == nsIAccessibleEvent::EVENT_TEXT_INSERTED ||
aEvent->mEventType == nsIAccessibleEvent::EVENT_SHOW ||
aEvent->mEventType == nsIAccessibleEvent::EVENT_HIDE)) {
// Only continue traversing up the tree if it's possible that the parent
// accessible's name can depend on this accessible's name.
Accessible* parent = target->Parent();
while (parent &&
nsTextEquivUtils::HasNameRule(parent, eNameFromSubtreeIfReqRule)) {
// Test possible name dependent parent.
if (nsTextEquivUtils::HasNameRule(parent, eNameFromSubtreeRule)) {
nsAutoString name;
ENameValueFlag nameFlag = parent->Name(name);
// If name is obtained from subtree, fire name change event.
if (nameFlag == eNameFromSubtree) {
RefPtr<AccEvent> nameChangeEvent =
new AccEvent(nsIAccessibleEvent::EVENT_NAME_CHANGE, parent);
PushEvent(nameChangeEvent);
}
break;
}
parent = parent->Parent();
}
}
// Associate text change with hide event if it wasn't stolen from hiding
// siblings during coalescence.
AccMutationEvent* showOrHideEvent = downcast_accEvent(aEvent);
if (showOrHideEvent && !showOrHideEvent->mTextChangeEvent)
CreateTextChangeEventFor(showOrHideEvent);
return true;
}
示例7: FireAtkStateChangeEvent
nsresult
AccessibleWrap::FirePlatformEvent(AccEvent* aEvent)
{
Accessible* accessible = aEvent->GetAccessible();
NS_ENSURE_TRUE(accessible, NS_ERROR_FAILURE);
PRUint32 type = aEvent->GetEventType();
AtkObject* atkObj = AccessibleWrap::GetAtkObject(accessible);
// We don't create ATK objects for nsIAccessible 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:
return FireAtkStateChangeEvent(aEvent, atkObj);
case nsIAccessibleEvent::EVENT_TEXT_REMOVED:
case nsIAccessibleEvent::EVENT_TEXT_INSERTED:
return FireAtkTextChangedEvent(aEvent, atkObj);
case nsIAccessibleEvent::EVENT_FOCUS:
{
MAI_LOG_DEBUG(("\n\nReceived: EVENT_FOCUS\n"));
a11y::RootAccessible* rootAccWrap = accWrap->RootAccessible();
if (rootAccWrap && rootAccWrap->mActivated) {
atk_focus_tracker_notify(atkObj);
// Fire state change event for focus
nsRefPtr<AccEvent> stateChangeEvent =
new AccStateChangeEvent(accessible, states::FOCUSED, true);
return FireAtkStateChangeEvent(stateChangeEvent, atkObj);
}
} break;
case nsIAccessibleEvent::EVENT_NAME_CHANGE:
{
nsAutoString newName;
accessible->Name(newName);
NS_ConvertUTF16toUTF8 utf8Name(newName);
if (!atkObj->name || !utf8Name.Equals(atkObj->name))
atk_object_set_name(atkObj, utf8Name.get());
break;
}
case nsIAccessibleEvent::EVENT_VALUE_CHANGE:
{
MAI_LOG_DEBUG(("\n\nReceived: EVENT_VALUE_CHANGE\n"));
nsCOMPtr<nsIAccessibleValue> value(do_QueryObject(accessible));
if (value) { // Make sure this is a numeric value
// Don't fire for MSAA 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
MAI_LOG_DEBUG(("\n\nReceived: EVENT_SELECTION_CHANGED\n"));
AccSelChangeEvent* selChangeEvent = downcast_accEvent(aEvent);
g_signal_emit_by_name(AccessibleWrap::GetAtkObject(selChangeEvent->Widget()),
"selection_changed");
break;
}
case nsIAccessibleEvent::EVENT_SELECTION_WITHIN:
{
MAI_LOG_DEBUG(("\n\nReceived: EVENT_SELECTION_CHANGED\n"));
g_signal_emit_by_name(atkObj, "selection_changed");
break;
}
case nsIAccessibleEvent::EVENT_TEXT_SELECTION_CHANGED:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TEXT_SELECTION_CHANGED\n"));
g_signal_emit_by_name(atkObj, "text_selection_changed");
break;
case nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED:
{
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TEXT_CARET_MOVED\n"));
AccCaretMoveEvent* caretMoveEvent = downcast_accEvent(aEvent);
NS_ASSERTION(caretMoveEvent, "Event needs event data");
if (!caretMoveEvent)
break;
PRInt32 caretOffset = caretMoveEvent->GetCaretOffset();
//.........这里部分代码省略.........
示例8: 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)
//.........这里部分代码省略.........