wined3d: Track synchronized buffer maps.
[wine.git] / dlls / oleacc / window.c
blobf8090b588615afb42d3b2c4119d4e767a93437df
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;
32 LONG ref;
33 } Window;
35 static inline Window* impl_from_Window(IAccessible *iface)
37 return CONTAINING_RECORD(iface, Window, IAccessible_iface);
40 static HRESULT WINAPI Window_QueryInterface(IAccessible *iface, REFIID riid, void **ppv)
42 Window *This = impl_from_Window(iface);
44 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
46 if(IsEqualIID(riid, &IID_IAccessible) ||
47 IsEqualIID(riid, &IID_IDispatch) ||
48 IsEqualIID(riid, &IID_IUnknown)) {
49 *ppv = iface;
50 }else if(IsEqualIID(riid, &IID_IOleWindow)) {
51 *ppv = &This->IOleWindow_iface;
52 }else {
53 WARN("no interface: %s\n", debugstr_guid(riid));
54 *ppv = NULL;
55 return E_NOINTERFACE;
58 IAccessible_AddRef(iface);
59 return S_OK;
62 static ULONG WINAPI Window_AddRef(IAccessible *iface)
64 Window *This = impl_from_Window(iface);
65 ULONG ref = InterlockedIncrement(&This->ref);
67 TRACE("(%p) ref = %u\n", This, ref);
68 return ref;
71 static ULONG WINAPI Window_Release(IAccessible *iface)
73 Window *This = impl_from_Window(iface);
74 ULONG ref = InterlockedDecrement(&This->ref);
76 TRACE("(%p) ref = %u\n", This, ref);
78 if(!ref)
79 heap_free(This);
80 return ref;
83 static HRESULT WINAPI Window_GetTypeInfoCount(IAccessible *iface, UINT *pctinfo)
85 Window *This = impl_from_Window(iface);
86 FIXME("(%p)->(%p)\n", This, pctinfo);
87 return E_NOTIMPL;
90 static HRESULT WINAPI Window_GetTypeInfo(IAccessible *iface,
91 UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
93 Window *This = impl_from_Window(iface);
94 FIXME("(%p)->(%u %x %p)\n", This, iTInfo, lcid, ppTInfo);
95 return E_NOTIMPL;
98 static HRESULT WINAPI Window_GetIDsOfNames(IAccessible *iface, REFIID riid,
99 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
101 Window *This = impl_from_Window(iface);
102 FIXME("(%p)->(%s %p %u %x %p)\n", This, debugstr_guid(riid),
103 rgszNames, cNames, lcid, rgDispId);
104 return E_NOTIMPL;
107 static HRESULT WINAPI Window_Invoke(IAccessible *iface, DISPID dispIdMember,
108 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
109 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
111 Window *This = impl_from_Window(iface);
112 FIXME("(%p)->(%x %s %x %x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
113 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
114 return E_NOTIMPL;
117 static HRESULT WINAPI Window_get_accParent(IAccessible *iface, IDispatch **ppdispParent)
119 Window *This = impl_from_Window(iface);
120 FIXME("(%p)->(%p)\n", This, ppdispParent);
121 return E_NOTIMPL;
124 static HRESULT WINAPI Window_get_accChildCount(IAccessible *iface, LONG *pcountChildren)
126 Window *This = impl_from_Window(iface);
127 FIXME("(%p)->(%p)\n", This, pcountChildren);
128 return E_NOTIMPL;
131 static HRESULT WINAPI Window_get_accChild(IAccessible *iface,
132 VARIANT varChildID, IDispatch **ppdispChild)
134 Window *This = impl_from_Window(iface);
135 FIXME("(%p)->(%s %p)\n", This, debugstr_variant(&varChildID), ppdispChild);
136 return E_NOTIMPL;
139 static HRESULT WINAPI Window_get_accName(IAccessible *iface, VARIANT varID, BSTR *pszName)
141 Window *This = impl_from_Window(iface);
142 FIXME("(%p)->(%s %p)\n", This, debugstr_variant(&varID), pszName);
143 return E_NOTIMPL;
146 static HRESULT WINAPI Window_get_accValue(IAccessible *iface, VARIANT varID, BSTR *pszValue)
148 Window *This = impl_from_Window(iface);
149 FIXME("(%p)->(%s %p)\n", This, debugstr_variant(&varID), pszValue);
150 return E_NOTIMPL;
153 static HRESULT WINAPI Window_get_accDescription(IAccessible *iface,
154 VARIANT varID, BSTR *pszDescription)
156 Window *This = impl_from_Window(iface);
157 FIXME("(%p)->(%s %p)\n", This, debugstr_variant(&varID), pszDescription);
158 return E_NOTIMPL;
161 static HRESULT WINAPI Window_get_accRole(IAccessible *iface, VARIANT varID, VARIANT *pvarRole)
163 Window *This = impl_from_Window(iface);
164 FIXME("(%p)->(%s %p)\n", This, debugstr_variant(&varID), pvarRole);
165 return E_NOTIMPL;
168 static HRESULT WINAPI Window_get_accState(IAccessible *iface, VARIANT varID, VARIANT *pvarState)
170 Window *This = impl_from_Window(iface);
171 FIXME("(%p)->(%s %p)\n", This, debugstr_variant(&varID), pvarState);
172 return E_NOTIMPL;
175 static HRESULT WINAPI Window_get_accHelp(IAccessible *iface, VARIANT varID, BSTR *pszHelp)
177 Window *This = impl_from_Window(iface);
178 FIXME("(%p)->(%s %p)\n", This, debugstr_variant(&varID), pszHelp);
179 return E_NOTIMPL;
182 static HRESULT WINAPI Window_get_accHelpTopic(IAccessible *iface,
183 BSTR *pszHelpFile, VARIANT varID, LONG *pidTopic)
185 Window *This = impl_from_Window(iface);
186 FIXME("(%p)->(%p %s %p)\n", This, pszHelpFile, debugstr_variant(&varID), pidTopic);
187 return E_NOTIMPL;
190 static HRESULT WINAPI Window_get_accKeyboardShortcut(IAccessible *iface,
191 VARIANT varID, BSTR *pszKeyboardShortcut)
193 Window *This = impl_from_Window(iface);
194 FIXME("(%p)->(%s %p)\n", This, debugstr_variant(&varID), pszKeyboardShortcut);
195 return E_NOTIMPL;
198 static HRESULT WINAPI Window_get_accFocus(IAccessible *iface, VARIANT *pvarID)
200 Window *This = impl_from_Window(iface);
201 FIXME("(%p)->(%p)\n", This, pvarID);
202 return E_NOTIMPL;
205 static HRESULT WINAPI Window_get_accSelection(IAccessible *iface, VARIANT *pvarID)
207 Window *This = impl_from_Window(iface);
208 FIXME("(%p)->(%p)\n", This, pvarID);
209 return E_NOTIMPL;
212 static HRESULT WINAPI Window_get_accDefaultAction(IAccessible *iface,
213 VARIANT varID, BSTR *pszDefaultAction)
215 Window *This = impl_from_Window(iface);
216 FIXME("(%p)->(%s %p)\n", This, debugstr_variant(&varID), pszDefaultAction);
217 return E_NOTIMPL;
220 static HRESULT WINAPI Window_accSelect(IAccessible *iface, LONG flagsSelect, VARIANT varID)
222 Window *This = impl_from_Window(iface);
223 FIXME("(%p)->(%x %s)\n", This, flagsSelect, debugstr_variant(&varID));
224 return E_NOTIMPL;
227 static HRESULT WINAPI Window_accLocation(IAccessible *iface, LONG *pxLeft,
228 LONG *pyTop, LONG *pcxWidth, LONG *pcyHeight, VARIANT varID)
230 Window *This = impl_from_Window(iface);
231 FIXME("(%p)->(%p %p %p %p %s)\n", This, pxLeft, pyTop,
232 pcxWidth, pcyHeight, debugstr_variant(&varID));
233 return E_NOTIMPL;
236 static HRESULT WINAPI Window_accNavigate(IAccessible *iface,
237 LONG navDir, VARIANT varStart, VARIANT *pvarEnd)
239 Window *This = impl_from_Window(iface);
240 FIXME("(%p)->(%d %s %p)\n", This, navDir, debugstr_variant(&varStart), pvarEnd);
241 return E_NOTIMPL;
244 static HRESULT WINAPI Window_accHitTest(IAccessible *iface,
245 LONG xLeft, LONG yTop, VARIANT *pvarID)
247 Window *This = impl_from_Window(iface);
248 FIXME("(%p)->(%d %d %p)\n", This, xLeft, yTop, pvarID);
249 return E_NOTIMPL;
252 static HRESULT WINAPI Window_accDoDefaultAction(IAccessible *iface, VARIANT varID)
254 Window *This = impl_from_Window(iface);
255 FIXME("(%p)->(%s)\n", This, debugstr_variant(&varID));
256 return E_NOTIMPL;
259 static HRESULT WINAPI Window_put_accName(IAccessible *iface, VARIANT varID, BSTR pszName)
261 Window *This = impl_from_Window(iface);
262 FIXME("(%p)->(%s %s)\n", This, debugstr_variant(&varID), debugstr_w(pszName));
263 return E_NOTIMPL;
266 static HRESULT WINAPI Window_put_accValue(IAccessible *iface, VARIANT varID, BSTR pszValue)
268 Window *This = impl_from_Window(iface);
269 FIXME("(%p)->(%s %s)\n", This, debugstr_variant(&varID), debugstr_w(pszValue));
270 return E_NOTIMPL;
273 static const IAccessibleVtbl WindowVtbl = {
274 Window_QueryInterface,
275 Window_AddRef,
276 Window_Release,
277 Window_GetTypeInfoCount,
278 Window_GetTypeInfo,
279 Window_GetIDsOfNames,
280 Window_Invoke,
281 Window_get_accParent,
282 Window_get_accChildCount,
283 Window_get_accChild,
284 Window_get_accName,
285 Window_get_accValue,
286 Window_get_accDescription,
287 Window_get_accRole,
288 Window_get_accState,
289 Window_get_accHelp,
290 Window_get_accHelpTopic,
291 Window_get_accKeyboardShortcut,
292 Window_get_accFocus,
293 Window_get_accSelection,
294 Window_get_accDefaultAction,
295 Window_accSelect,
296 Window_accLocation,
297 Window_accNavigate,
298 Window_accHitTest,
299 Window_accDoDefaultAction,
300 Window_put_accName,
301 Window_put_accValue
304 static inline Window* impl_from_Window_OleWindow(IOleWindow *iface)
306 return CONTAINING_RECORD(iface, Window, IOleWindow_iface);
309 static HRESULT WINAPI Window_OleWindow_QueryInterface(IOleWindow *iface, REFIID riid, void **ppv)
311 Window *This = impl_from_Window_OleWindow(iface);
312 return IAccessible_QueryInterface(&This->IAccessible_iface, riid, ppv);
315 static ULONG WINAPI Window_OleWindow_AddRef(IOleWindow *iface)
317 Window *This = impl_from_Window_OleWindow(iface);
318 return IAccessible_AddRef(&This->IAccessible_iface);
321 static ULONG WINAPI Window_OleWindow_Release(IOleWindow *iface)
323 Window *This = impl_from_Window_OleWindow(iface);
324 return IAccessible_Release(&This->IAccessible_iface);
327 static HRESULT WINAPI Window_OleWindow_GetWindow(IOleWindow *iface, HWND *phwnd)
329 Window *This = impl_from_Window_OleWindow(iface);
330 FIXME("(%p)->(%p)\n", This, phwnd);
331 return E_NOTIMPL;
334 static HRESULT WINAPI Window_OleWindow_ContextSensitiveHelp(IOleWindow *iface, BOOL fEnterMode)
336 Window *This = impl_from_Window_OleWindow(iface);
337 FIXME("(%p)->(%x)\n", This, fEnterMode);
338 return E_NOTIMPL;
341 static const IOleWindowVtbl WindowOleWindowVtbl = {
342 Window_OleWindow_QueryInterface,
343 Window_OleWindow_AddRef,
344 Window_OleWindow_Release,
345 Window_OleWindow_GetWindow,
346 Window_OleWindow_ContextSensitiveHelp
349 HRESULT create_window_object(HWND hwnd, const IID *iid, void **obj)
351 Window *window;
352 HRESULT hres;
354 if(!IsWindow(hwnd))
355 return E_FAIL;
357 window = heap_alloc_zero(sizeof(Window));
358 if(!window)
359 return E_OUTOFMEMORY;
361 window->IAccessible_iface.lpVtbl = &WindowVtbl;
362 window->IOleWindow_iface.lpVtbl = &WindowOleWindowVtbl;
363 window->ref = 1;
365 hres = IAccessible_QueryInterface(&window->IAccessible_iface, iid, obj);
366 IAccessible_Release(&window->IAccessible_iface);
367 return hres;