summaryrefslogtreecommitdiff
path: root/wintable/accessibility.h
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2015-02-14 09:24:59 -0500
committerPietro Gagliardi <[email protected]>2015-02-14 09:24:59 -0500
commit1d4e5e81d5841c02ee2e90a7f91b4042f95c5fd9 (patch)
tree523d703a204d9c011127e1b69ab2e863c885a3e5 /wintable/accessibility.h
parent3e654bf95931043120ce0460ebb85fc5661fc667 (diff)
Started the real accessibility implementation. Utility functions and role system for now.
Diffstat (limited to 'wintable/accessibility.h')
-rw-r--r--wintable/accessibility.h44
1 files changed, 40 insertions, 4 deletions
diff --git a/wintable/accessibility.h b/wintable/accessibility.h
index e81067b..e880efe 100644
--- a/wintable/accessibility.h
+++ b/wintable/accessibility.h
@@ -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)