Signed-off-by: Connor McAdams cmcadams@codeweavers.com --- dlls/oleacc/client.c | 69 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 55 insertions(+), 14 deletions(-)
diff --git a/dlls/oleacc/client.c b/dlls/oleacc/client.c index 5f702d0135b..043d98d93cc 100644 --- a/dlls/oleacc/client.c +++ b/dlls/oleacc/client.c @@ -25,6 +25,10 @@
WINE_DEFAULT_DEBUG_CHANNEL(oleacc);
+typedef struct { + HRESULT (*get_state)(IAccessible *, VARIANT, VARIANT *); +} WinClassVtbl; + typedef struct { IAccessible IAccessible_iface; IOleWindow IOleWindow_iface; @@ -35,6 +39,8 @@ typedef struct { HWND hwnd; HWND enum_pos; INT role; + + WinClassVtbl vtbl; } Client;
static inline Client* impl_from_Client(IAccessible *iface) @@ -225,33 +231,44 @@ static HRESULT WINAPI Client_get_accRole(IAccessible *iface, VARIANT varID, VARI return S_OK; }
-static HRESULT WINAPI Client_get_accState(IAccessible *iface, VARIANT varID, VARIANT *pvarState) +static void default_client_get_state(IAccessible *iface, VARIANT *var_state) { Client *This = impl_from_Client(iface); GUITHREADINFO info; LONG style;
- TRACE("(%p)->(%s %p)\n", This, debugstr_variant(&varID), pvarState); - - if(convert_child_id(&varID) != CHILDID_SELF) { - V_VT(pvarState) = VT_EMPTY; - return E_INVALIDARG; - } - - V_VT(pvarState) = VT_I4; - V_I4(pvarState) = 0; + V_VT(var_state) = VT_I4; + V_I4(var_state) = 0;
style = GetWindowLongW(This->hwnd, GWL_STYLE); if(style & WS_DISABLED) - V_I4(pvarState) |= STATE_SYSTEM_UNAVAILABLE; + V_I4(var_state) |= STATE_SYSTEM_UNAVAILABLE; else if(IsWindow(This->hwnd)) - V_I4(pvarState) |= STATE_SYSTEM_FOCUSABLE; + V_I4(var_state) |= STATE_SYSTEM_FOCUSABLE;
info.cbSize = sizeof(info); if(GetGUIThreadInfo(0, &info) && info.hwndFocus == This->hwnd) - V_I4(pvarState) |= STATE_SYSTEM_FOCUSED; + V_I4(var_state) |= STATE_SYSTEM_FOCUSED; if(!(style & WS_VISIBLE)) - V_I4(pvarState) |= STATE_SYSTEM_INVISIBLE; + V_I4(var_state) |= STATE_SYSTEM_INVISIBLE; +} + +static HRESULT WINAPI Client_get_accState(IAccessible *iface, VARIANT varID, VARIANT *pvarState) +{ + Client *This = impl_from_Client(iface); + + TRACE("(%p)->(%s %p)\n", This, debugstr_variant(&varID), pvarState); + + if (This->vtbl.get_state) + return This->vtbl.get_state(iface, varID, pvarState); + + if(convert_child_id(&varID) != CHILDID_SELF) { + V_VT(pvarState) = VT_EMPTY; + return E_INVALIDARG; + } + + default_client_get_state(iface, pvarState); + return S_OK; }
@@ -676,6 +693,29 @@ HRESULT create_client_object(HWND hwnd, const IID *iid, void **obj) return hres; }
+static HRESULT edit_get_state(IAccessible *iface, VARIANT var_id, VARIANT *out_state) +{ + Client *This = impl_from_Client(iface); + LONG style; + + TRACE("(%p)->(%s %p)\n", This, debugstr_variant(&var_id), out_state); + + if(convert_child_id(&var_id) != CHILDID_SELF) { + V_VT(out_state) = VT_EMPTY; + return E_INVALIDARG; + } + + default_client_get_state(iface, out_state); + + style = GetWindowLongW(This->hwnd, GWL_STYLE); + if(style & ES_READONLY) + V_I4(out_state) |= STATE_SYSTEM_READONLY; + if(style & ES_PASSWORD) + V_I4(out_state) |= STATE_SYSTEM_PROTECTED; + + return S_OK; +} + HRESULT create_edit_client_object(HWND hwnd, const IID *iid, void **obj) { IAccessible *acc; @@ -687,6 +727,7 @@ HRESULT create_edit_client_object(HWND hwnd, const IID *iid, void **obj)
client = impl_from_Client(acc); client->role = ROLE_SYSTEM_TEXT; + client->vtbl.get_state = &edit_get_state;
hres = IAccessible_QueryInterface(acc, iid, obj); IAccessible_Release(acc);