本文整理汇总了C++中AccessibleWrap::QueryInterface方法的典型用法代码示例。如果您正苦于以下问题:C++ AccessibleWrap::QueryInterface方法的具体用法?C++ AccessibleWrap::QueryInterface怎么用?C++ AccessibleWrap::QueryInterface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AccessibleWrap
的用法示例。
在下文中一共展示了AccessibleWrap::QueryInterface方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddRef
STDMETHODIMP
sdnAccessible::QueryInterface(REFIID aREFIID, void** aInstancePtr)
{
if (!aInstancePtr)
return E_FAIL;
*aInstancePtr = nullptr;
if (aREFIID == IID_ISimpleDOMNode) {
*aInstancePtr = static_cast<ISimpleDOMNode*>(this);
AddRef();
return S_OK;
}
AccessibleWrap* accessible = static_cast<AccessibleWrap*>(GetAccessible());
if (accessible)
return accessible->QueryInterface(aREFIID, aInstancePtr);
// IUnknown* is the canonical one if and only if this accessible doesn't have
// an accessible.
if (aREFIID == IID_IUnknown) {
*aInstancePtr = static_cast<ISimpleDOMNode*>(this);
AddRef();
return S_OK;
}
return E_NOINTERFACE;
}
示例2: VariantInit
STDMETHODIMP
ia2AccessibleHyperlink::get_anchor(long aIndex, VARIANT* aAnchor)
{
A11Y_TRYBLOCK_BEGIN
VariantInit(aAnchor);
Accessible* thisObj = static_cast<AccessibleWrap*>(this);
if (thisObj->IsDefunct())
return CO_E_OBJNOTCONNECTED;
if (aIndex < 0 || aIndex >= static_cast<long>(thisObj->AnchorCount()))
return E_INVALIDARG;
if (!thisObj->IsLink())
return S_FALSE;
AccessibleWrap* anchor =
static_cast<AccessibleWrap*>(thisObj->AnchorAt(aIndex));
if (!anchor)
return S_FALSE;
void* instancePtr = nullptr;
HRESULT result = anchor->QueryInterface(IID_IUnknown, &instancePtr);
if (FAILED(result))
return result;
IUnknown* unknownPtr = static_cast<IUnknown*>(instancePtr);
aAnchor->ppunkVal = &unknownPtr;
aAnchor->vt = VT_UNKNOWN;
return S_OK;
A11Y_TRYBLOCK_END
}
示例3: AddRef
STDMETHODIMP
sdnAccessible::QueryInterface(REFIID aREFIID, void** aInstancePtr)
{
if (!aInstancePtr)
return E_FAIL;
*aInstancePtr = nullptr;
if (aREFIID == IID_IClientSecurity) {
// Some code might QI(IID_IClientSecurity) to detect whether or not we are
// a proxy. Right now that can potentially happen off the main thread, so we
// look for this condition immediately so that we don't trigger other code
// that might not be thread-safe.
return E_NOINTERFACE;
}
if (aREFIID == IID_ISimpleDOMNode) {
*aInstancePtr = static_cast<ISimpleDOMNode*>(this);
AddRef();
return S_OK;
}
AccessibleWrap* accessible = GetAccessible();
if (accessible)
return accessible->QueryInterface(aREFIID, aInstancePtr);
// IUnknown* is the canonical one if and only if this accessible doesn't have
// an accessible.
if (aREFIID == IID_IUnknown) {
*aInstancePtr = static_cast<ISimpleDOMNode*>(this);
AddRef();
return S_OK;
}
return E_NOINTERFACE;
}
示例4: GetAccessibleWrap
static gint
getSelectedRowsCB(AtkTable *aTable, gint **aSelected)
{
AccessibleWrap* 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 0;
}
//copy
for (PRUint32 index = 0; index < size; ++index)
atkRows[index] = static_cast<gint>(rows[index]);
nsMemory::Free(rows);
*aSelected = atkRows;
return size;
}
示例5: NS_FAILED
static gboolean
isCellSelectedCB(AtkTable *aTable, gint aRow, gint aColumn)
{
AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
if (!accWrap)
return FALSE;
nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
getter_AddRefs(accTable));
NS_ENSURE_TRUE(accTable, FALSE);
bool outValue;
nsresult rv = accTable->IsCellSelected(aRow, aColumn, &outValue);
return NS_FAILED(rv) ? FALSE : static_cast<gboolean>(outValue);
}
示例6: ReturnString
static const gchar*
getRowDescriptionCB(AtkTable *aTable, gint aRow)
{
AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
if (!accWrap)
return nsnull;
nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
getter_AddRefs(accTable));
NS_ENSURE_TRUE(accTable, nsnull);
nsAutoString autoStr;
nsresult rv = accTable->GetRowDescription(aRow, autoStr);
NS_ENSURE_SUCCESS(rv, nsnull);
return AccessibleWrap::ReturnString(autoStr);
}
示例7: GetAtkObject
static AtkObject*
getRowHeaderCB(AtkTable *aTable, gint aRow)
{
AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
if (!accWrap)
return nsnull;
nsCOMPtr<nsIAccessibleTable> accTable;
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
getter_AddRefs(accTable));
NS_ENSURE_TRUE(accTable, nsnull);
nsCOMPtr<nsIAccessible> accCell;
accTable->GetCellAt(aRow, 0, getter_AddRefs(accCell));
if (!accCell)
return nsnull;
// If the cell at the first column is row header then assume it is row
// header for all columns,
if (nsAccUtils::Role(accCell) == nsIAccessibleRole::ROLE_ROWHEADER)
return AccessibleWrap::GetAtkObject(accCell);
// otherwise get row header for the data cell at the first column.
nsCOMPtr<nsIAccessibleTableCell> accTableCell =
do_QueryInterface(accCell);
if (accTableCell) {
nsCOMPtr<nsIArray> headerCells;
accTableCell->GetRowHeaderCells(getter_AddRefs(headerCells));
if (headerCells) {
nsresult rv;
nsCOMPtr<nsIAccessible> accHeaderCell =
do_QueryElementAt(headerCells, 0, &rv);
NS_ENSURE_SUCCESS(rv, nsnull);
return AccessibleWrap::GetAtkObject(accHeaderCell);
}
}
return nsnull;
}