d2d1/tests: Add a test for bezier intersections.
[wine.git] / dlls / oleacc / window.c
blob64d71677f5d5a84e49df048f602d3b3aa842cf22
1 /*
2 * Copyright 2014 Piotr Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #define COBJMACROS
21 #include "oleacc_private.h"
23 #include "wine/unicode.h"
24 #include "wine/debug.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(oleacc);
28 typedef struct {
29 IAccessible IAccessible_iface;
30 IOleWindow IOleWindow_iface;
31 IEnumVARIANT IEnumVARIANT_iface;
33 LONG ref;
34 } Window;
36 static inline Window* impl_from_Window(IAccessible *iface)
38 return CONTAINING_RECORD(iface, Window, IAccessible_iface);
41 static HRESULT WINAPI Window_QueryInterface(IAccessible *iface, REFIID riid, void **ppv)
43 Window *This = impl_from_Window(iface);
45 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
47 if(IsEqualIID(riid, &IID_IAccessible) ||
48 IsEqualIID(riid, &IID_IDispatch) ||
49 IsEqualIID(riid, &IID_IUnknown)) {
50 *ppv = iface;
51 }else if(IsEqualIID(riid, &IID_IOleWindow)) {
52 *ppv = &This->IOleWindow_iface;
53 }else if(IsEqualIID(riid, &IID_IEnumVARIANT)) {
54 *ppv = &This->IEnumVARIANT_iface;
55 }else {
56 WARN("no interface: %s\n", debugstr_guid(riid));
57 *ppv = NULL;
58 return E_NOINTERFACE;
61 IAccessible_AddRef(iface);
62 return S_OK;
65 static ULONG WINAPI Window_AddRef(IAccessible *iface)
67 Window *This = impl_from_Window(iface);
68 ULONG ref = InterlockedIncrement(&This->ref);
70 TRACE("(%p) ref = %u\n", This, ref);
71 return ref;
74 static ULONG WINAPI Window_Release(IAccessible *iface)
76 Window *This = impl_from_Window(iface);
77 ULONG ref = InterlockedDecrement(&This->ref);
79 TRACE("(%p) ref = %u\n", This, ref);
81 if(!ref)
82 heap_free(This);
83 return ref;
86 static HRESULT WINAPI Window_GetTypeInfoCount(IAccessible *iface, UINT *pctinfo)
88 Window *This = impl_from_Window(iface);
89 FIXME("(%p)->(%p)\n", This, pctinfo);
90 return E_NOTIMPL;
93 static HRESULT WINAPI Window_GetTypeInfo(IAccessible *iface,
94 UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
96 Window *This = impl_from_Window(iface);
97 FIXME("(%p)->(%u %x %p)\n", This, iTInfo, lcid, ppTInfo);
98 return E_NOTIMPL;
101 static HRESULT WINAPI Window_GetIDsOfNames(IAccessible *iface, REFIID riid,
102 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
104 Window *This = impl_from_Window(iface);
105 FIXME("(%p)->(%s %p %u %x %p)\n", This, debugstr_guid(riid),
106 rgszNames, cNames, lcid, rgDispId);
107 return E_NOTIMPL;
110 static HRESULT WINAPI Window_Invoke(IAccessible *iface, DISPID dispIdMember,
111 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
112 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
114 Window *This = impl_from_Window(iface);
115 FIXME("(%p)->(%x %s %x %x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
116 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
117 return E_NOTIMPL;
120 static HRESULT WINAPI Window_get_accParent(IAccessible *iface, IDispatch **ppdispParent)
122 Window *This = impl_from_Window(iface);
123 FIXME("(%p)->(%p)\n", This, ppdispParent);
124 return E_NOTIMPL;
127 static HRESULT WINAPI Window_get_accChildCount(IAccessible *iface, LONG *pcountChildren)
129 Window *This = impl_from_Window(iface);
130 FIXME("(%p)->(%p)\n", This, pcountChildren);
131 return E_NOTIMPL;
134 static HRESULT WINAPI Window_get_accChild(IAccessible *iface,
135 VARIANT varChildID, IDispatch **ppdispChild)
137 Window *This = impl_from_Window(iface);
138 FIXME("(%p)->(%s %p)\n", This, debugstr_variant(&varChildID), ppdispChild);
139 return E_NOTIMPL;
142 static HRESULT WINAPI Window_get_accName(IAccessible *iface, VARIANT varID, BSTR *pszName)
144 Window *This = impl_from_Window(iface);
145 FIXME("(%p)->(%s %p)\n", This, debugstr_variant(&varID), pszName);
146 return E_NOTIMPL;
149 static HRESULT WINAPI Window_get_accValue(IAccessible *iface, VARIANT varID, BSTR *pszValue)
151 Window *This = impl_from_Window(iface);
152 FIXME("(%p)->(%s %p)\n", This, debugstr_variant(&varID), pszValue);
153 return E_NOTIMPL;
156 static HRESULT WINAPI Window_get_accDescription(IAccessible *iface,
157 VARIANT varID, BSTR *pszDescription)
159 Window *This = impl_from_Window(iface);
160 FIXME("(%p)->(%s %p)\n", This, debugstr_variant(&varID), pszDescription);
161 return E_NOTIMPL;
164 static HRESULT WINAPI Window_get_accRole(IAccessible *iface, VARIANT varID, VARIANT *pvarRole)
166 Window *This = impl_from_Window(iface);
167 FIXME("(%p)->(%s %p)\n", This, debugstr_variant(&varID), pvarRole);
168 return E_NOTIMPL;
171 static HRESULT WINAPI Window_get_accState(IAccessible *iface, VARIANT varID, VARIANT *pvarState)
173 Window *This = impl_from_Window(iface);
174 FIXME("(%p)->(%s %p)\n", This, debugstr_variant(&varID), pvarState);
175 return E_NOTIMPL;
178 static HRESULT WINAPI Window_get_accHelp(IAccessible *iface, VARIANT varID, BSTR *pszHelp)
180 Window *This = impl_from_Window(iface);
181 FIXME("(%p)->(%s %p)\n", This, debugstr_variant(&varID), pszHelp);
182 return E_NOTIMPL;
185 static HRESULT WINAPI Window_get_accHelpTopic(IAccessible *iface,
186 BSTR *pszHelpFile, VARIANT varID, LONG *pidTopic)
188 Window *This = impl_from_Window(iface);
189 FIXME("(%p)->(%p %s %p)\n", This, pszHelpFile, debugstr_variant(&varID), pidTopic);
190 return E_NOTIMPL;
193 static HRESULT WINAPI Window_get_accKeyboardShortcut(IAccessible *iface,
194 VARIANT varID, BSTR *pszKeyboardShortcut)
196 Window *This = impl_from_Window(iface);
197 FIXME("(%p)->(%s %p)\n", This, debugstr_variant(&varID), pszKeyboardShortcut);
198 return E_NOTIMPL;
201 static HRESULT WINAPI Window_get_accFocus(IAccessible *iface, VARIANT *pvarID)
203 Window *This = impl_from_Window(iface);
204 FIXME("(%p)->(%p)\n", This, pvarID);
205 return E_NOTIMPL;
208 static HRESULT WINAPI Window_get_accSelection(IAccessible *iface, VARIANT *pvarID)
210 Window *This = impl_from_Window(iface);
211 FIXME("(%p)->(%p)\n", This, pvarID);
212 return E_NOTIMPL;
215 static HRESULT WINAPI Window_get_accDefaultAction(IAccessible *iface,
216 VARIANT varID, BSTR *pszDefaultAction)
218 Window *This = impl_from_Window(iface);
219 FIXME("(%p)->(%s %p)\n", This, debugstr_variant(&varID), pszDefaultAction);
220 return E_NOTIMPL;
223 static HRESULT WINAPI Window_accSelect(IAccessible *iface, LONG flagsSelect, VARIANT varID)
225 Window *This = impl_from_Window(iface);
226 FIXME("(%p)->(%x %s)\n", This, flagsSelect, debugstr_variant(&varID));
227 return E_NOTIMPL;
230 static HRESULT WINAPI Window_accLocation(IAccessible *iface, LONG *pxLeft,
231 LONG *pyTop, LONG *pcxWidth, LONG *pcyHeight, VARIANT varID)
233 Window *This = impl_from_Window(iface);
234 FIXME("(%p)->(%p %p %p %p %s)\n", This, pxLeft, pyTop,
235 pcxWidth, pcyHeight, debugstr_variant(&varID));
236 return E_NOTIMPL;
239 static HRESULT WINAPI Window_accNavigate(IAccessible *iface,
240 LONG navDir, VARIANT varStart, VARIANT *pvarEnd)
242 Window *This = impl_from_Window(iface);
243 FIXME("(%p)->(%d %s %p)\n", This, navDir, debugstr_variant(&varStart), pvarEnd);
244 return E_NOTIMPL;
247 static HRESULT WINAPI Window_accHitTest(IAccessible *iface,
248 LONG xLeft, LONG yTop, VARIANT *pvarID)
250 Window *This = impl_from_Window(iface);
251 FIXME("(%p)->(%d %d %p)\n", This, xLeft, yTop, pvarID);
252 return E_NOTIMPL;
255 static HRESULT WINAPI Window_accDoDefaultAction(IAccessible *iface, VARIANT varID)
257 Window *This = impl_from_Window(iface);
258 FIXME("(%p)->(%s)\n", This, debugstr_variant(&varID));
259 return E_NOTIMPL;
262 static HRESULT WINAPI Window_put_accName(IAccessible *iface, VARIANT varID, BSTR pszName)
264 Window *This = impl_from_Window(iface);
265 FIXME("(%p)->(%s %s)\n", This, debugstr_variant(&varID), debugstr_w(pszName));
266 return E_NOTIMPL;
269 static HRESULT WINAPI Window_put_accValue(IAccessible *iface, VARIANT varID, BSTR pszValue)
271 Window *This = impl_from_Window(iface);
272 FIXME("(%p)->(%s %s)\n", This, debugstr_variant(&varID), debugstr_w(pszValue));
273 return E_NOTIMPL;
276 static const IAccessibleVtbl WindowVtbl = {
277 Window_QueryInterface,
278 Window_AddRef,
279 Window_Release,
280 Window_GetTypeInfoCount,
281 Window_GetTypeInfo,
282 Window_GetIDsOfNames,
283 Window_Invoke,
284 Window_get_accParent,
285 Window_get_accChildCount,
286 Window_get_accChild,
287 Window_get_accName,
288 Window_get_accValue,
289 Window_get_accDescription,
290 Window_get_accRole,
291 Window_get_accState,
292 Window_get_accHelp,
293 Window_get_accHelpTopic,
294 Window_get_accKeyboardShortcut,
295 Window_get_accFocus,
296 Window_get_accSelection,
297 Window_get_accDefaultAction,
298 Window_accSelect,
299 Window_accLocation,
300 Window_accNavigate,
301 Window_accHitTest,
302 Window_accDoDefaultAction,
303 Window_put_accName,
304 Window_put_accValue
307 static inline Window* impl_from_Window_OleWindow(IOleWindow *iface)
309 return CONTAINING_RECORD(iface, Window, IOleWindow_iface);
312 static HRESULT WINAPI Window_OleWindow_QueryInterface(IOleWindow *iface, REFIID riid, void **ppv)
314 Window *This = impl_from_Window_OleWindow(iface);
315 return IAccessible_QueryInterface(&This->IAccessible_iface, riid, ppv);
318 static ULONG WINAPI Window_OleWindow_AddRef(IOleWindow *iface)
320 Window *This = impl_from_Window_OleWindow(iface);
321 return IAccessible_AddRef(&This->IAccessible_iface);
324 static ULONG WINAPI Window_OleWindow_Release(IOleWindow *iface)
326 Window *This = impl_from_Window_OleWindow(iface);
327 return IAccessible_Release(&This->IAccessible_iface);
330 static HRESULT WINAPI Window_OleWindow_GetWindow(IOleWindow *iface, HWND *phwnd)
332 Window *This = impl_from_Window_OleWindow(iface);
333 FIXME("(%p)->(%p)\n", This, phwnd);
334 return E_NOTIMPL;
337 static HRESULT WINAPI Window_OleWindow_ContextSensitiveHelp(IOleWindow *iface, BOOL fEnterMode)
339 Window *This = impl_from_Window_OleWindow(iface);
340 FIXME("(%p)->(%x)\n", This, fEnterMode);
341 return E_NOTIMPL;
344 static const IOleWindowVtbl WindowOleWindowVtbl = {
345 Window_OleWindow_QueryInterface,
346 Window_OleWindow_AddRef,
347 Window_OleWindow_Release,
348 Window_OleWindow_GetWindow,
349 Window_OleWindow_ContextSensitiveHelp
352 static inline Window* impl_from_Window_EnumVARIANT(IEnumVARIANT *iface)
354 return CONTAINING_RECORD(iface, Window, IEnumVARIANT_iface);
357 static HRESULT WINAPI Window_EnumVARIANT_QueryInterface(IEnumVARIANT *iface, REFIID riid, void **ppv)
359 Window *This = impl_from_Window_EnumVARIANT(iface);
360 return IAccessible_QueryInterface(&This->IAccessible_iface, riid, ppv);
363 static ULONG WINAPI Window_EnumVARIANT_AddRef(IEnumVARIANT *iface)
365 Window *This = impl_from_Window_EnumVARIANT(iface);
366 return IAccessible_AddRef(&This->IAccessible_iface);
369 static ULONG WINAPI Window_EnumVARIANT_Release(IEnumVARIANT *iface)
371 Window *This = impl_from_Window_EnumVARIANT(iface);
372 return IAccessible_Release(&This->IAccessible_iface);
375 static HRESULT WINAPI Window_EnumVARIANT_Next(IEnumVARIANT *iface,
376 ULONG celt, VARIANT *rgVar, ULONG *pCeltFetched)
378 Window *This = impl_from_Window_EnumVARIANT(iface);
379 FIXME("(%p)->(%u %p %p)\n", This, celt, rgVar, pCeltFetched);
380 return E_NOTIMPL;
383 static HRESULT WINAPI Window_EnumVARIANT_Skip(IEnumVARIANT *iface, ULONG celt)
385 Window *This = impl_from_Window_EnumVARIANT(iface);
386 FIXME("(%p)->(%u)\n", This, celt);
387 return E_NOTIMPL;
390 static HRESULT WINAPI Window_EnumVARIANT_Reset(IEnumVARIANT *iface)
392 Window *This = impl_from_Window_EnumVARIANT(iface);
393 FIXME("(%p)\n", This);
394 return E_NOTIMPL;
397 static HRESULT WINAPI Window_EnumVARIANT_Clone(IEnumVARIANT *iface, IEnumVARIANT **ppEnum)
399 Window *This = impl_from_Window_EnumVARIANT(iface);
400 FIXME("(%p)->(%p)\n", This, ppEnum);
401 return E_NOTIMPL;
404 static const IEnumVARIANTVtbl WindowEnumVARIANTVtbl = {
405 Window_EnumVARIANT_QueryInterface,
406 Window_EnumVARIANT_AddRef,
407 Window_EnumVARIANT_Release,
408 Window_EnumVARIANT_Next,
409 Window_EnumVARIANT_Skip,
410 Window_EnumVARIANT_Reset,
411 Window_EnumVARIANT_Clone
414 HRESULT create_window_object(HWND hwnd, const IID *iid, void **obj)
416 Window *window;
417 HRESULT hres;
419 if(!IsWindow(hwnd))
420 return E_FAIL;
422 window = heap_alloc_zero(sizeof(Window));
423 if(!window)
424 return E_OUTOFMEMORY;
426 window->IAccessible_iface.lpVtbl = &WindowVtbl;
427 window->IOleWindow_iface.lpVtbl = &WindowOleWindowVtbl;
428 window->IEnumVARIANT_iface.lpVtbl = &WindowEnumVARIANTVtbl;
429 window->ref = 1;
431 hres = IAccessible_QueryInterface(&window->IAccessible_iface, iid, obj);
432 IAccessible_Release(&window->IAccessible_iface);
433 return hres;