當前位置: 首頁>>代碼示例>>C++>>正文


C++ GetAccessibleWrap函數代碼示例

本文整理匯總了C++中GetAccessibleWrap函數的典型用法代碼示例。如果您正苦於以下問題:C++ GetAccessibleWrap函數的具體用法?C++ GetAccessibleWrap怎麽用?C++ GetAccessibleWrap使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了GetAccessibleWrap函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: refChildCB

AtkObject *
refChildCB(AtkObject *aAtkObj, gint aChildIndex)
{
    // aChildIndex should not be less than zero
    if (aChildIndex < 0) {
      return nsnull;
    }

    nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj);
    if (!accWrap || nsAccUtils::MustPrune(accWrap)) {
        return nsnull;
    }

    nsAccessible* accChild = accWrap->GetEmbeddedChildAt(aChildIndex);
    if (!accChild)
        return nsnull;

    AtkObject* childAtkObj = nsAccessibleWrap::GetAtkObject(accChild);

    NS_ASSERTION(childAtkObj, "Fail to get AtkObj");
    if (!childAtkObj)
        return nsnull;
    g_object_ref(childAtkObj);
    
    //this will addref parent
    atk_object_set_parent(childAtkObj, aAtkObj);
    return childAtkObj;
}
開發者ID:jiaofeng,項目名稱:Icefox,代碼行數:28,代碼來源:nsAccessibleWrap.cpp

示例2: getDocumentAttributesCB

AtkAttributeSet *
getDocumentAttributesCB(AtkDocument *aDocument)
{
  nsAccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aDocument));
  if (!accWrap || !accWrap->IsDoc())
    return nsnull;

  // according to atkobject.h, AtkAttributeSet is a GSList
  GSList* attributes = nsnull;
  nsDocAccessible* document = accWrap->AsDoc();
  nsAutoString aURL;
  nsresult rv = document->GetURL(aURL);
  if (NS_SUCCEEDED(rv))
    attributes = prependToList(attributes, kDocUrlName, aURL);

  nsAutoString aW3CDocType;
  rv = document->GetDocType(aW3CDocType);
  if (NS_SUCCEEDED(rv))
    attributes = prependToList(attributes, kDocTypeName, aW3CDocType);

  nsAutoString aMimeType;
  rv = document->GetMimeType(aMimeType);
  if (NS_SUCCEEDED(rv))
    attributes = prependToList(attributes, kMimeTypeName, aMimeType);

  return attributes;
}
開發者ID:jbalogh,項目名稱:mozilla-central,代碼行數:27,代碼來源:nsMaiInterfaceDocument.cpp

示例3: getRoleCB

AtkRole
getRoleCB(AtkObject *aAtkObj)
{
    nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj);
    if (!accWrap) {
        return ATK_ROLE_INVALID;
    }

#ifdef DEBUG_A11Y
    NS_ASSERTION(nsAccUtils::IsTextInterfaceSupportCorrect(accWrap),
                 "Does not support nsIAccessibleText when it should");
#endif

    if (aAtkObj->role == ATK_ROLE_INVALID) {
        PRUint32 accRole, atkRole;
        nsresult rv = accWrap->GetRole(&accRole);
        NS_ENSURE_SUCCESS(rv, ATK_ROLE_INVALID);

        atkRole = atkRoleMap[accRole]; // map to the actual value
        NS_ASSERTION(atkRoleMap[nsIAccessibleRole::ROLE_LAST_ENTRY] ==
                     kROLE_ATK_LAST_ENTRY, "ATK role map skewed");
        aAtkObj->role = static_cast<AtkRole>(atkRole);
    }
    return aAtkObj->role;
}
開發者ID:amyvmiwei,項目名稱:firefox,代碼行數:25,代碼來源:nsAccessibleWrap.cpp

示例4: getCharacterAtOffsetCB

gunichar
getCharacterAtOffsetCB(AtkText *aText, gint aOffset)
{
    nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
    if (!accWrap)
        return 0;

    nsCOMPtr<nsIAccessibleText> accText;
    accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
                            getter_AddRefs(accText));
    NS_ENSURE_TRUE(accText, 0);

    /* PRUnichar is unsigned short in Mozilla */
    /* gnuichar is guint32 in glib */
    PRUnichar uniChar;
    nsresult rv =
        accText->GetCharacterAtOffset(aOffset, &uniChar);

    // convert char to "*" when it's "password text" 
    PRUint32 atkRole = atkRoleMap[accWrap->NativeRole()];
    if (atkRole == ATK_ROLE_PASSWORD_TEXT)
        uniChar = '*';

    return (NS_FAILED(rv)) ? 0 : static_cast<gunichar>(uniChar);
}
開發者ID:AntonSilviu,項目名稱:v8monkey,代碼行數:25,代碼來源:nsMaiInterfaceText.cpp

示例5: getSelectedRowsCB

static gint
getSelectedRowsCB(AtkTable *aTable, gint **aSelected)
{
    nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
    if (!accWrap)
        return 0;

    nsCOMPtr<nsIAccessibleTable> accTable;
    accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
                            getter_AddRefs(accTable));
    NS_ENSURE_TRUE(accTable, 0);

    PRUint32 size = 0;
    PRInt32 *rows = NULL;
    nsresult rv = accTable->GetSelectedRowIndices(&size, &rows);
    if (NS_FAILED(rv) || (size == 0) || !rows) {
        *aSelected = nsnull;
        return 0;
    }

    gint *atkRows = g_new(gint, size);
    if (!atkRows) {
        NS_WARNING("OUT OF MEMORY");
        return nsnull;
    }

    //copy
    for (PRUint32 index = 0; index < size; ++index)
        atkRows[index] = static_cast<gint>(rows[index]);
    nsMemory::Free(rows);

    *aSelected = atkRows;
    return size;
}
開發者ID:pupadam,項目名稱:mozilla-central,代碼行數:34,代碼來源:nsMaiInterfaceTable.cpp

示例6: getAttributesCB

AtkAttributeSet *
getAttributesCB(AtkObject *aAtkObj)
{
    nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj);

    return accWrap ? GetAttributeSet(accWrap) : nsnull;
}
開發者ID:amyvmiwei,項目名稱:firefox,代碼行數:7,代碼來源:nsAccessibleWrap.cpp

示例7: refAccessibleAtPointCB

static AtkObject*
refAccessibleAtPointCB(AtkComponent* aComponent, gint aAccX, gint aAccY,
                       AtkCoordType aCoordType)
{
  return refAccessibleAtPointHelper(GetAccessibleWrap(ATK_OBJECT(aComponent)),
                                    aAccX, aAccY, aCoordType);
}
開發者ID:PinZhang,項目名稱:mozilla-central,代碼行數:7,代碼來源:nsMaiInterfaceComponent.cpp

示例8: insertTextCB

void
insertTextCB(AtkEditableText *aText,
             const gchar *aString, gint aLength, gint *aPosition)
{
    nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
    if (!accWrap)
        return;

    nsCOMPtr<nsIAccessibleEditableText> accText;
    accWrap->QueryInterface(NS_GET_IID(nsIAccessibleEditableText),
                            getter_AddRefs(accText));
    if (!accText)
        return;

    NS_ConvertUTF8toUTF16 strContent(aString);

    // interface changed in nsIAccessibleEditableText.idl ???
    //
    // PRInt32 pos = *aPosition;
    // nsresult rv = accText->InsertText(strContent, aLength, &pos);
    // *aPosition = pos;

    accText->InsertText(strContent, *aPosition);

    MAI_LOG_DEBUG(("EditableText: insert aString=%s, aLength=%d, aPosition=%d",
                   aString, aLength, *aPosition));
}
開發者ID:Akin-Net,項目名稱:mozilla-central,代碼行數:27,代碼來源:nsMaiInterfaceEditableText.cpp

示例9: getExtentsCB

static void
getExtentsCB(AtkComponent* aComponent, gint* aX, gint* aY,
             gint* aWidth, gint* aHeight, AtkCoordType aCoordType)
{
  getExtentsHelper(GetAccessibleWrap(ATK_OBJECT(aComponent)),
                   aX, aY, aWidth, aHeight, aCoordType);
}
開發者ID:PinZhang,項目名稱:mozilla-central,代碼行數:7,代碼來源:nsMaiInterfaceComponent.cpp

示例10: getDocumentAttributeValueCB

const gchar *
getDocumentAttributeValueCB(AtkDocument *aDocument,
                            const gchar *aAttrName)
{
    nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aDocument));
    if (!accWrap)
        return nsnull;

    nsCOMPtr<nsIAccessibleDocument> accDocument;
    accWrap->QueryInterface(NS_GET_IID(nsIAccessibleDocument),
                            getter_AddRefs(accDocument));
    NS_ENSURE_TRUE(accDocument, nsnull);

    nsresult rv;
    nsAutoString attrValue;
    if (!g_ascii_strcasecmp(aAttrName, kDocTypeName)) {
        rv = accDocument->GetDocType(attrValue);
        NS_ENSURE_SUCCESS(rv, nsnull);
    }
    else if (!g_ascii_strcasecmp(aAttrName, kDocUrlName)) {
        rv = accDocument->GetURL(attrValue);
        NS_ENSURE_SUCCESS(rv, nsnull);
    }
    else if (!g_ascii_strcasecmp(aAttrName, kMimeTypeName)) {
        rv = accDocument->GetMimeType(attrValue);
        NS_ENSURE_SUCCESS(rv, nsnull);
    }
    else {
        return nsnull;
    }
    return nsAccessibleWrap::ReturnString(attrValue);
}
開發者ID:Akin-Net,項目名稱:mozilla-central,代碼行數:32,代碼來源:nsMaiInterfaceDocument.cpp

示例11: getDocumentAttributesCB

AtkAttributeSet *
getDocumentAttributesCB(AtkDocument *aDocument)
{
    nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aDocument));
    if (!accWrap)
        return nsnull;

    nsCOMPtr<nsIAccessibleDocument> accDocument;
    accWrap->QueryInterface(NS_GET_IID(nsIAccessibleDocument),
                            getter_AddRefs(accDocument));
    NS_ENSURE_TRUE(accDocument, nsnull);

    // according to atkobject.h, AtkAttributeSet is a GSList
    GSList *attributes = nsnull;

    nsAutoString aURL;
    nsresult rv = accDocument->GetURL(aURL);
    if (NS_SUCCEEDED(rv)) {
        attributes = prependToList(attributes, kDocUrlName, aURL);
    }
    nsAutoString aW3CDocType;
    rv = accDocument->GetDocType(aW3CDocType);
    if (NS_SUCCEEDED(rv)) {
        attributes = prependToList(attributes, kDocTypeName, aW3CDocType);
    }
    nsAutoString aMimeType;
    rv = accDocument->GetMimeType(aMimeType);
    if (NS_SUCCEEDED(rv)) {
        attributes = prependToList(attributes, kMimeTypeName, aMimeType);
    }
    
    return attributes;
}
開發者ID:Akin-Net,項目名稱:mozilla-central,代碼行數:33,代碼來源:nsMaiInterfaceDocument.cpp

示例12: getRunAttributesCB

AtkAttributeSet *
getRunAttributesCB(AtkText *aText, gint aOffset,
                   gint *aStartOffset,
                   gint *aEndOffset)
{
    *aStartOffset = -1;
    *aEndOffset = -1;

    nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
    if (!accWrap)
        return nsnull;

    nsCOMPtr<nsIAccessibleText> accText;
    accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
                            getter_AddRefs(accText));
    NS_ENSURE_TRUE(accText, nsnull);

    nsCOMPtr<nsIPersistentProperties> attributes;
    PRInt32 startOffset = 0, endOffset = 0;
    nsresult rv = accText->GetTextAttributes(false, aOffset,
                                             &startOffset, &endOffset,
                                             getter_AddRefs(attributes));
    NS_ENSURE_SUCCESS(rv, nsnull);

    *aStartOffset = startOffset;
    *aEndOffset = endOffset;

    return ConvertToAtkAttributeSet(attributes);
}
開發者ID:AntonSilviu,項目名稱:v8monkey,代碼行數:29,代碼來源:nsMaiInterfaceText.cpp

示例13: getTextBeforeOffsetCB

gchar *
getTextBeforeOffsetCB(AtkText *aText, gint aOffset,
                      AtkTextBoundary aBoundaryType,
                      gint *aStartOffset, gint *aEndOffset)
{
    nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
    if (!accWrap)
        return nsnull;

    nsCOMPtr<nsIAccessibleText> accText;
    accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
                            getter_AddRefs(accText));
    NS_ENSURE_TRUE(accText, nsnull);

    nsAutoString autoStr;
    PRInt32 startOffset = 0, endOffset = 0;
    nsresult rv =
        accText->GetTextBeforeOffset(aOffset, aBoundaryType,
                                     &startOffset, &endOffset, autoStr);
    *aStartOffset = startOffset;
    *aEndOffset = endOffset;

    NS_ENSURE_SUCCESS(rv, nsnull);

    ConvertTexttoAsterisks(accWrap, autoStr);
    NS_ConvertUTF16toUTF8 cautoStr(autoStr);
    return (cautoStr.get()) ? g_strdup(cautoStr.get()) : nsnull;
}
開發者ID:AntonSilviu,項目名稱:v8monkey,代碼行數:28,代碼來源:nsMaiInterfaceText.cpp

示例14: refRelationSetCB

AtkRelationSet *
refRelationSetCB(AtkObject *aAtkObj)
{
    AtkRelationSet *relation_set = nsnull;
    relation_set = ATK_OBJECT_CLASS(parent_class)->ref_relation_set(aAtkObj);

    nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj);
    if (!accWrap) {
        return relation_set;
    }

    AtkRelation* relation;

    PRUint32 relationType[] = {nsIAccessibleRelation::RELATION_LABELLED_BY,
                               nsIAccessibleRelation::RELATION_LABEL_FOR,
                               nsIAccessibleRelation::RELATION_NODE_CHILD_OF,
                               nsIAccessibleRelation::RELATION_CONTROLLED_BY,
                               nsIAccessibleRelation::RELATION_CONTROLLER_FOR,
                               nsIAccessibleRelation::RELATION_EMBEDS,
                               nsIAccessibleRelation::RELATION_FLOWS_TO,
                               nsIAccessibleRelation::RELATION_FLOWS_FROM,
                               nsIAccessibleRelation::RELATION_DESCRIBED_BY,
                               nsIAccessibleRelation::RELATION_DESCRIPTION_FOR,
                              };

    for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(relationType); i++) {
        relation = atk_relation_set_get_relation_by_type(relation_set, static_cast<AtkRelationType>(relationType[i]));
        if (relation) {
            atk_relation_set_remove(relation_set, relation);
        }

        nsCOMPtr<nsIAccessibleRelation> geckoRelation;
        nsresult rv = accWrap->GetRelationByType(relationType[i],
                      getter_AddRefs(geckoRelation));
        if (NS_SUCCEEDED(rv) && geckoRelation) {
            PRUint32 targetsCount = 0;
            geckoRelation->GetTargetsCount(&targetsCount);
            if (targetsCount) {
                AtkObject** accessible_array = new AtkObject*[targetsCount];
                for (PRUint32 index = 0; index < targetsCount; index++) {
                    nsCOMPtr<nsIAccessible> geckoTarget;
                    geckoRelation->GetTarget(index, getter_AddRefs(geckoTarget));
                    accessible_array[index] =
                        nsAccessibleWrap::GetAtkObject(geckoTarget);
                }

                relation = atk_relation_new(accessible_array, targetsCount,
                                            static_cast<AtkRelationType>(relationType[i]));
                atk_relation_set_add(relation_set, relation);
                g_object_unref(relation);

                delete [] accessible_array;
            }
        }
    }

    return relation_set;
}
開發者ID:amyvmiwei,項目名稱:firefox,代碼行數:58,代碼來源:nsAccessibleWrap.cpp

示例15: addSelectionCB

static gboolean
addSelectionCB(AtkSelection *aSelection, gint i)
{
  AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection));
  if (!accWrap || !accWrap->IsSelect())
    return FALSE;

  return accWrap->AddItemToSelection(i);
}
開發者ID:AshishNamdev,項目名稱:mozilla-central,代碼行數:9,代碼來源:nsMaiInterfaceSelection.cpp


注:本文中的GetAccessibleWrap函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。