From 5eade7c8313f4ac69067988940373fdb216a319d Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Tue, 17 Feb 2015 11:27:01 -0500 Subject: [PATCH] Implemented get_accSelection(). --- wintable/accessibility.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/wintable/accessibility.h b/wintable/accessibility.h index f486413..461c25f 100644 --- a/wintable/accessibility.h +++ b/wintable/accessibility.h @@ -494,13 +494,25 @@ selectedCell: return S_OK; } +// note: https://msdn.microsoft.com/en-us/library/ms971325 is geared toward cell-based selection +// we have row-based selection, so only Tables implement this method, and they return a row static HRESULT STDMETHODCALLTYPE tableAccget_accSelection(IAccessible *this, VARIANT *pvarChildren) { - if (TA->t == NULL || TA->std == NULL) { - // TODO set values on error + if (pvarChildren == NULL) + return E_POINTER; + // TOOD set pvarChildren to VT_EMPTY? + if (TA->t == NULL || TA->std == NULL) return RPC_E_DISCONNECTED; + if (TA->what.role != ROLE_SYSTEM_TABLE) + // TODO [EDGE CASE] implement this for row anyway? how? + return DISP_E_MEMBERNOTFOUND; + if (TA->t->selectedRow == -1) { + pvarChildren->vt = VT_EMPTY; + return S_OK; } - return IAccessible_get_accSelection(TA->std, pvarChildren); + pvarChildren->vt = VT_DISPATCH; + pvarChildren->pdispVal = (IDispatch *) newTableAcc(TA->t, ROLE_SYSTEM_ROW, TA->t->selectedRow, -1); + return S_OK; } static HRESULT STDMETHODCALLTYPE tableAccget_accDefaultAction(IAccessible *this, VARIANT varChild, BSTR *pszDefaultAction)