Relation
nsXULGroupboxAccessible::RelationByType(PRUint32 aType)
{
    Relation rel = nsAccessibleWrap::RelationByType(aType);
    if (aType != nsIAccessibleRelation::RELATION_LABELLED_BY)
        return rel;

    // The label for xul:groupbox is generated from xul:label that is
    // inside the anonymous content of the xul:caption.
    // The xul:label has an accessible object but the xul:caption does not
    PRInt32 childCount = GetChildCount();
    for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
        nsAccessible *childAcc = GetChildAt(childIdx);
        if (childAcc->Role() == nsIAccessibleRole::ROLE_LABEL) {
            // Ensure that it's our label
            Relation reverseRel =
                childAcc->RelationByType(nsIAccessibleRelation::RELATION_LABEL_FOR);
            nsAccessible* testGroupbox = nsnull;
            while ((testGroupbox = reverseRel.Next()))
                if (testGroupbox == this) {
                    // The <label> points back to this groupbox
                    rel.AppendTarget(childAcc);
                }
        }
    }

    return rel;
}
Relation
XULGroupboxAccessible::RelationByType(RelationType aType)
{
  Relation rel = AccessibleWrap::RelationByType(aType);
  if (aType != RelationType::LABELLED_BY)
    return rel;

  // The label for xul:groupbox is generated from xul:label that is
  // inside the anonymous content of the xul:caption.
  // The xul:label has an accessible object but the xul:caption does not
  uint32_t childCount = ChildCount();
  for (uint32_t childIdx = 0; childIdx < childCount; childIdx++) {
    Accessible* childAcc = GetChildAt(childIdx);
    if (childAcc->Role() == roles::LABEL) {
      // Ensure that it's our label
      Relation reverseRel = childAcc->RelationByType(RelationType::LABEL_FOR);
      Accessible* testGroupbox = nullptr;
      while ((testGroupbox = reverseRel.Next()))
        if (testGroupbox == this) {
          // The <label> points back to this groupbox
          rel.AppendTarget(childAcc);
        }
    }
  }

  return rel;
}
Esempio n. 3
0
void Act_3()
{
	r.text();
	r.setOtv();
	switch (r.getOtv())
	{
	case 1: r.Otvet(2, 0, -2, 0, 0); break;
	case 2: r.Otvet(1, 0, -1, 0, 0); break;
	case 3: r.Otvet(-1, 0, -1, 0, 0); break;
	case 4: r.Otvet(-2, 0, 1, 0, 0); break;
	default:cout << "Введите правильную цифру\n"; break;
	}
	system("cls");
	if (r.Next()) Act_4();
	else r.Lose_Win();
}
static void
AddRelation(Accessible* aAcc, RelationType aType,
            nsTArray<RelationTargets>* aTargets)
{
  Relation rel = aAcc->RelationByType(aType);
  nsTArray<uint64_t> targets;
  while (Accessible* target = rel.Next())
    targets.AppendElement(reinterpret_cast<uintptr_t>(target));

  if (!targets.IsEmpty()) {
    RelationTargets* newRelation =
      aTargets->AppendElement(RelationTargets(static_cast<uint32_t>(aType),
                                              nsTArray<uint64_t>()));
    newRelation->Targets().SwapElements(targets);
  }
}
bool
DocAccessibleChild::RecvRelationByType(const uint64_t& aID,
                                       const uint32_t& aType,
                                       nsTArray<uint64_t>* aTargets)
{
  Accessible* acc = mDoc->GetAccessibleByUniqueID((void*)aID);
  if (!acc)
    return false;

  auto type = static_cast<RelationType>(aType);
  Relation rel = acc->RelationByType(type);
  while (Accessible* target = rel.Next())
    aTargets->AppendElement(reinterpret_cast<uintptr_t>(target));

  return true;
}
Esempio n. 6
0
STDMETHODIMP
ia2Accessible::get_relationTargetsOfType(BSTR aType,
                                         long aMaxTargets,
                                         IUnknown*** aTargets,
                                         long* aNTargets)
{
  if (!aTargets || !aNTargets || aMaxTargets < 0)
    return E_INVALIDARG;
  *aNTargets = 0;

  Maybe<RelationType> relationType;
  for (uint32_t idx = 0; idx < ArrayLength(sRelationTypePairs); idx++) {
    if (wcscmp(aType, sRelationTypePairs[idx].second) == 0) {
      relationType.emplace(sRelationTypePairs[idx].first);
      break;
    }
  }
  if (!relationType)
    return E_INVALIDARG;

  AccessibleWrap* acc = static_cast<AccessibleWrap*>(this);
  if (acc->IsDefunct())
    return CO_E_OBJNOTCONNECTED;

  nsTArray<Accessible*> targets;
  MOZ_ASSERT(!acc->IsProxy());
  Relation rel = acc->RelationByType(*relationType);
  Accessible* target = nullptr;
  while ((target = rel.Next()) &&
         static_cast<long>(targets.Length()) <= aMaxTargets) {
    targets.AppendElement(target);
  }

  *aNTargets = targets.Length();
  *aTargets = static_cast<IUnknown**>(
    ::CoTaskMemAlloc(sizeof(IUnknown*) * *aNTargets));
  if (!*aTargets)
    return E_OUTOFMEMORY;

  for (int32_t i = 0; i < *aNTargets; i++) {
    AccessibleWrap* target= static_cast<AccessibleWrap*>(targets[i]);
    (*aTargets)[i] = static_cast<IAccessible2*>(target);
    (*aTargets)[i]->AddRef();
  }

  return S_OK;
}
Esempio n. 7
0
STDMETHODIMP
ia2Accessible::get_nRelations(long* aNRelations) {
  if (!aNRelations) return E_INVALIDARG;
  *aNRelations = 0;

  AccessibleWrap* acc = static_cast<AccessibleWrap*>(this);
  if (acc->IsDefunct()) return CO_E_OBJNOTCONNECTED;

  MOZ_ASSERT(!acc->IsProxy());

  for (uint32_t idx = 0; idx < ArrayLength(sRelationTypePairs); idx++) {
    if (sRelationTypePairs[idx].second == IA2_RELATION_NULL) continue;

    Relation rel = acc->RelationByType(sRelationTypePairs[idx].first);
    if (rel.Next()) (*aNRelations)++;
  }
  return S_OK;
}