Implemented (most of) get_accState().

This commit is contained in:
Pietro Gagliardi 2015-02-17 11:50:44 -05:00
parent 5eade7c831
commit 6264cf1fee
2 changed files with 50 additions and 4 deletions

View File

@ -366,13 +366,53 @@ static HRESULT STDMETHODCALLTYPE tableAccget_accRole(IAccessible *this, VARIANT
return S_OK;
}
// TODO reason about STATE_SYSTEM_INVISIBLE and STATE_SYSTEM_OFFSCREEN
static HRESULT STDMETHODCALLTYPE tableAccget_accState(IAccessible *this, VARIANT varChild, VARIANT *pvarState)
{
if (TA->t == NULL || TA->std == NULL) {
// TODO set values on error
HRESULT hr;
tableAccWhat what;
LONG state;
if (pvarState == NULL)
return E_POINTER;
pvarState->vt = VT_EMPTY;
if (TA->t == NULL || TA->std == NULL)
return RPC_E_DISCONNECTED;
what = TA->what;
hr = normalizeWhat(TA, varChild, &what);
if (hr != S_OK)
return hr;
state = 0;
switch (what.role) {
case ROLE_SYSTEM_TABLE:
hr = IAccessible_get_accState(TA->std, varChild, pvarState);
if (hr != S_OK)
return hr;
// TODO make sure pvarState->vt == VT_I4 (what to return otherwise?)
state |= pvarState->lVal;
break;
case ROLE_SYSTEM_ROW:
state |= STATE_SYSTEM_SELECTABLE;
if (TA->t->selectedRow == what.row)
state |= STATE_SYSTEM_SELECTED;
break;
case ROLE_SYSTEM_CELL:
if (TA->t->columnTypes[what.column] == tableColumnCheckbox) {
// TODO is there no STATE_SYSTEM_CHECKABLE?
if (isCheckboxChecked(TA->t, what.row, what.column))
state |= STATE_SYSTEM_CHECKED;
}
state |= STATE_SYSTEM_FOCUSABLE;
if (TA->t->selectedRow == what.row && TA->t->selectedColumn == what.column)
state |= STATE_SYSTEM_FOCUSED;
if (TA->t->columnTypes[what.column] != tableColumnCheckbox)
state |= STATE_SYSTEM_READONLY;
break;
}
return IAccessible_get_accState(TA->std, varChild, pvarState);
pvarState->vt = VT_I4;
pvarState->lVal = state;
return S_OK;
}
static HRESULT STDMETHODCALLTYPE tableAccget_accHelp(IAccessible *this, VARIANT varChild, BSTR *pszHelp)

View File

@ -1,5 +1,11 @@
// 8 december 2014
// TODO move to api.h? definitely move somewhere
static int isCheckboxChecked(struct table *t, intptr_t row, intptr_t column)
{
return notify(t, tableNotificationGetCellData, row, column, 0) != 0;
}
struct drawCellParams {
intptr_t row;
intptr_t column;
@ -74,7 +80,7 @@ static void drawCheckboxCell(struct table *t, HDC dc, struct drawCellParams *p,
toCheckboxRect(t, r, p->xoff);
cbState = 0;
if (notify(t, tableNotificationGetCellData, p->row, p->column, 0) != 0)
if (isCheckboxChecked(t, p->row, p->column))
cbState |= checkboxStateChecked;
if (t->checkboxMouseDown)
if (p->row == t->checkboxMouseDownRow && p->column == t->checkboxMouseDownColumn)