Started the real accessibility implementation. Utility functions and role system for now.

This commit is contained in:
Pietro Gagliardi 2015-02-14 09:24:59 -05:00
parent 3e654bf959
commit 1d4e5e81d5
1 changed files with 40 additions and 4 deletions

View File

@ -1,16 +1,52 @@
// 24 december 2014
typedef struct tableAccWhat tableAccWhat;
struct tableAccWhat {
LONG role;
intptr_t row;
intptr_t col;
};
struct tableAcc {
const IAccessibleVtbl *vtbl;
ULONG refcount;
struct table *t;
IAccessible *std;
LONG role;
intptr_t row;
intptr_t column;
tableAccWhat what;
};
// common validation for accessibility functions that take varChild
// also normalizes what as if varChild == CHILDID_SELF
static HRESULT normalizeWhat(struct tableAcc *ta, VARIANT varChild, tableAccWhat *what)
{
LONG cid;
if (varChild.vt != VT_I4)
return E_INVALIDARG;
cid = varChild.lVal;
if (cid == CHILDID_SELF)
return S_OK;
cid--;
if (cid < 0)
return E_INVALIDARG;
switch (what->role) {
case ROLE_SYSTEM_TABLE:
// TODO +1?
if (cid >= ta->t->count)
return E_INVALIDARG;
what->role = ROLE_SYSTEM_ROW;
what->row = (intptr_t) cid;
what->column = -1;
break;
case ROLE_SYSTEM_ROW:
case ROLE_SYSTEM_CELL:
// TODO
break;
}
return S_OK;
}
#define TA ((struct tableAcc *) this)
static HRESULT STDMETHODCALLTYPE tableAccQueryInterface(IAccessible *this, REFIID riid, void **ppvObject)