More accessibility utility definitions.

This commit is contained in:
Pietro Gagliardi 2015-02-14 10:39:26 -05:00
parent 1d4e5e81d5
commit 32b09d5cb7
1 changed files with 21 additions and 12 deletions

View File

@ -5,7 +5,7 @@ typedef struct tableAccWhat tableAccWhat;
struct tableAccWhat { struct tableAccWhat {
LONG role; LONG role;
intptr_t row; intptr_t row;
intptr_t col; intptr_t column;
}; };
struct tableAcc { struct tableAcc {
@ -16,6 +16,10 @@ struct tableAcc {
tableAccWhat what; tableAccWhat what;
}; };
// called after each allocation
// TODO really be a forward declaration?
static void initAcc(struct tableAcc *acc, struct table *t, LONG role, intptr_t row, intptr_t column);
// common validation for accessibility functions that take varChild // common validation for accessibility functions that take varChild
// also normalizes what as if varChild == CHILDID_SELF // also normalizes what as if varChild == CHILDID_SELF
static HRESULT normalizeWhat(struct tableAcc *ta, VARIANT varChild, tableAccWhat *what) static HRESULT normalizeWhat(struct tableAcc *ta, VARIANT varChild, tableAccWhat *what)
@ -245,25 +249,30 @@ static const IAccessibleVtbl tableAccVtbl = {
.put_accValue = tableAccput_accValue, .put_accValue = tableAccput_accValue,
}; };
static struct tableAcc *newTableAcc(struct table *t) static void initAcc(struct tableAcc *acc, struct table *t, LONG role, intptr_t row, intptr_t column)
{ {
struct tableAcc *ta;
HRESULT hr; HRESULT hr;
IAccessible *std; IAccessible *std;
ta = (struct tableAcc *) tableAlloc(sizeof (struct tableAcc), "error creating Table accessibility object"); acc->vtbl = &tableAccVtbl;
ta->vtbl = &tableAccVtbl; acc->refcount = 1;
// TODO acc->t = t;
IAccessible_AddRef((IAccessible *) ta);
ta->t = t;
hr = CreateStdAccessibleObject(t->hwnd, OBJID_CLIENT, &IID_IAccessible, (void *) (&std)); hr = CreateStdAccessibleObject(t->hwnd, OBJID_CLIENT, &IID_IAccessible, (void *) (&std));
if (hr != S_OK) if (hr != S_OK)
// TODO panichresult // TODO panichresult
panic("error creating standard accessible object for Table"); panic("error creating standard accessible object for Table");
ta->std = std; acc->std = std;
ta->role = ROLE_SYSTEM_TABLE; acc->what.role = role;
ta->row = -1; acc->what.row = row;
ta->column = -1; acc->what.column = column;
}
static struct tableAcc *newTableAcc(struct table *t)
{
struct tableAcc *ta;
ta = (struct tableAcc *) tableAlloc(sizeof (struct tableAcc), "error creating Table accessibility object");
initAcc(ta, t, ROLE_SYSTEM_TABLE, -1, -1);
return ta; return ta;
} }