gdi32/tests: Mark tests failing randomly on Windows as flaky.
[wine.git] / dlls / explorerframe / taskbarlist.c
blobdd61cc62ae445653b622658a33841413f4b67e64
1 /*
2 * Copyright 2009 Henri Verbeet for CodeWeavers
3 * Copyright 2011 André Hentschel
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "explorerframe_main.h"
23 #include "wine/debug.h"
25 WINE_DEFAULT_DEBUG_CHANNEL(explorerframe);
27 #define WM_WINE_DELETE_TAB (WM_USER + 1)
28 #define WM_WINE_ADD_TAB (WM_USER + 2)
30 struct taskbar_list
32 ITaskbarList4 ITaskbarList4_iface;
33 LONG refcount;
36 static inline struct taskbar_list *impl_from_ITaskbarList4(ITaskbarList4 *iface)
38 return CONTAINING_RECORD(iface, struct taskbar_list, ITaskbarList4_iface);
41 /* IUnknown methods */
43 static HRESULT STDMETHODCALLTYPE taskbar_list_QueryInterface(ITaskbarList4 *iface, REFIID riid, void **object)
45 TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
47 if (IsEqualGUID(riid, &IID_ITaskbarList) ||
48 IsEqualGUID(riid, &IID_ITaskbarList2) ||
49 IsEqualGUID(riid, &IID_ITaskbarList3) ||
50 IsEqualGUID(riid, &IID_ITaskbarList4) ||
51 IsEqualGUID(riid, &IID_IUnknown))
53 ITaskbarList4_AddRef(iface);
54 *object = iface;
55 return S_OK;
58 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
60 *object = NULL;
61 return E_NOINTERFACE;
64 static ULONG STDMETHODCALLTYPE taskbar_list_AddRef(ITaskbarList4 *iface)
66 struct taskbar_list *This = impl_from_ITaskbarList4(iface);
67 ULONG refcount = InterlockedIncrement(&This->refcount);
69 TRACE("%p increasing refcount to %lu\n", This, refcount);
71 return refcount;
74 static ULONG STDMETHODCALLTYPE taskbar_list_Release(ITaskbarList4 *iface)
76 struct taskbar_list *This = impl_from_ITaskbarList4(iface);
77 ULONG refcount = InterlockedDecrement(&This->refcount);
79 TRACE("%p decreasing refcount to %lu\n", This, refcount);
81 if (!refcount)
83 free(This);
84 EFRAME_UnlockModule();
87 return refcount;
90 /* ITaskbarList methods */
92 static HRESULT STDMETHODCALLTYPE taskbar_list_HrInit(ITaskbarList4 *iface)
94 TRACE("iface %p\n", iface);
96 return S_OK;
99 static HRESULT STDMETHODCALLTYPE taskbar_list_AddTab(ITaskbarList4 *iface, HWND hwnd)
101 TRACE("iface %p, hwnd %p\n", iface, hwnd);
103 SendMessageW(GetDesktopWindow(), WM_WINE_ADD_TAB, (WPARAM)hwnd, 0);
104 return S_OK;
107 static HRESULT STDMETHODCALLTYPE taskbar_list_DeleteTab(ITaskbarList4 *iface, HWND hwnd)
109 TRACE("iface %p, hwnd %p\n", iface, hwnd);
111 SendMessageW(GetDesktopWindow(), WM_WINE_DELETE_TAB, (WPARAM)hwnd, 0);
112 return S_OK;
115 static HRESULT STDMETHODCALLTYPE taskbar_list_ActivateTab(ITaskbarList4 *iface, HWND hwnd)
117 FIXME("iface %p, hwnd %p stub!\n", iface, hwnd);
119 return E_NOTIMPL;
122 static HRESULT STDMETHODCALLTYPE taskbar_list_SetActiveAlt(ITaskbarList4 *iface, HWND hwnd)
124 FIXME("iface %p, hwnd %p stub!\n", iface, hwnd);
126 return E_NOTIMPL;
129 /* ITaskbarList2 method */
131 static HRESULT STDMETHODCALLTYPE taskbar_list_MarkFullscreenWindow(ITaskbarList4 *iface,
132 HWND hwnd,
133 BOOL fullscreen)
135 FIXME("iface %p, hwnd %p, fullscreen %s stub!\n", iface, hwnd, (fullscreen)?"true":"false");
137 return E_NOTIMPL;
140 /* ITaskbarList3 methods */
142 static HRESULT STDMETHODCALLTYPE taskbar_list_SetProgressValue(ITaskbarList4 *iface,
143 HWND hwnd,
144 ULONGLONG ullCompleted,
145 ULONGLONG ullTotal)
147 static BOOL fixme_once;
148 if(!fixme_once++) FIXME("iface %p, hwnd %p, ullCompleted %s, ullTotal %s stub!\n", iface, hwnd,
149 wine_dbgstr_longlong(ullCompleted), wine_dbgstr_longlong(ullTotal));
151 return S_OK;
154 static HRESULT STDMETHODCALLTYPE taskbar_list_SetProgressState(ITaskbarList4 *iface,
155 HWND hwnd,
156 TBPFLAG tbpFlags)
158 static BOOL fixme_once;
159 if(!fixme_once++) FIXME("iface %p, hwnd %p, flags %x stub!\n", iface, hwnd, tbpFlags);
161 return S_OK;
164 static HRESULT STDMETHODCALLTYPE taskbar_list_RegisterTab(ITaskbarList4 *iface, HWND hwndTab, HWND hwndMDI)
166 FIXME("iface %p, hwndTab %p, hwndMDI %p stub!\n", iface, hwndTab, hwndMDI);
168 return S_OK;
171 static HRESULT STDMETHODCALLTYPE taskbar_list_UnregisterTab(ITaskbarList4 *iface, HWND hwndTab)
173 FIXME("iface %p, hwndTab %p stub!\n", iface, hwndTab);
175 return E_NOTIMPL;
178 static HRESULT STDMETHODCALLTYPE taskbar_list_SetTabOrder(ITaskbarList4 *iface,
179 HWND hwndTab,
180 HWND hwndInsertBefore)
182 FIXME("iface %p, hwndTab %p, hwndInsertBefore %p stub!\n", iface, hwndTab, hwndInsertBefore);
184 return E_NOTIMPL;
187 static HRESULT STDMETHODCALLTYPE taskbar_list_SetTabActive(ITaskbarList4 *iface,
188 HWND hwndTab,
189 HWND hwndMDI,
190 DWORD dwReserved)
192 FIXME("iface %p, hwndTab %p, hwndMDI %p, dwReserved %lx stub!\n", iface, hwndTab, hwndMDI, dwReserved);
194 return E_NOTIMPL;
197 static HRESULT STDMETHODCALLTYPE taskbar_list_ThumbBarAddButtons(ITaskbarList4 *iface,
198 HWND hwnd,
199 UINT cButtons,
200 LPTHUMBBUTTON pButton)
202 FIXME("iface %p, hwnd %p, cButtons %u, pButton %p stub, faking success!\n", iface, hwnd, cButtons, pButton);
204 return S_OK;
207 static HRESULT STDMETHODCALLTYPE taskbar_list_ThumbBarUpdateButtons(ITaskbarList4 *iface,
208 HWND hwnd,
209 UINT cButtons,
210 LPTHUMBBUTTON pButton)
212 FIXME("iface %p, hwnd %p, cButtons %u, pButton %p stub, faking success!\n", iface, hwnd, cButtons, pButton);
214 return S_OK;
217 static HRESULT STDMETHODCALLTYPE taskbar_list_ThumbBarSetImageList(ITaskbarList4 *iface,
218 HWND hwnd,
219 HIMAGELIST himl)
221 FIXME("iface %p, hwnd %p, himl %p stub!\n", iface, hwnd, himl);
223 return S_OK;
226 static HRESULT STDMETHODCALLTYPE taskbar_list_SetOverlayIcon(ITaskbarList4 *iface,
227 HWND hwnd,
228 HICON hIcon,
229 LPCWSTR pszDescription)
231 FIXME("iface %p, hwnd %p, hIcon %p, pszDescription %s stub!\n", iface, hwnd, hIcon,
232 debugstr_w(pszDescription));
234 return S_OK;
237 static HRESULT STDMETHODCALLTYPE taskbar_list_SetThumbnailTooltip(ITaskbarList4 *iface,
238 HWND hwnd,
239 LPCWSTR pszTip)
241 FIXME("iface %p, hwnd %p, pszTip %s stub, faking success!\n", iface, hwnd, debugstr_w(pszTip));
243 return S_OK;
246 static HRESULT STDMETHODCALLTYPE taskbar_list_SetThumbnailClip(ITaskbarList4 *iface,
247 HWND hwnd,
248 RECT *prcClip)
250 FIXME("iface %p, hwnd %p, prcClip %s stub!\n", iface, hwnd, wine_dbgstr_rect(prcClip));
252 return E_NOTIMPL;
255 /* ITaskbarList4 method */
257 static HRESULT STDMETHODCALLTYPE taskbar_list_SetTabProperties(ITaskbarList4 *iface,
258 HWND hwndTab,
259 STPFLAG stpFlags)
261 FIXME("iface %p, hwndTab %p, stpFlags %u stub!\n", iface, hwndTab, stpFlags);
263 return E_NOTIMPL;
266 static const struct ITaskbarList4Vtbl taskbar_list_vtbl =
268 /* IUnknown methods */
269 taskbar_list_QueryInterface,
270 taskbar_list_AddRef,
271 taskbar_list_Release,
272 /* ITaskbarList methods */
273 taskbar_list_HrInit,
274 taskbar_list_AddTab,
275 taskbar_list_DeleteTab,
276 taskbar_list_ActivateTab,
277 taskbar_list_SetActiveAlt,
278 /* ITaskbarList2 method */
279 taskbar_list_MarkFullscreenWindow,
280 /* ITaskbarList3 methods */
281 taskbar_list_SetProgressValue,
282 taskbar_list_SetProgressState,
283 taskbar_list_RegisterTab,
284 taskbar_list_UnregisterTab,
285 taskbar_list_SetTabOrder,
286 taskbar_list_SetTabActive,
287 taskbar_list_ThumbBarAddButtons,
288 taskbar_list_ThumbBarUpdateButtons,
289 taskbar_list_ThumbBarSetImageList,
290 taskbar_list_SetOverlayIcon,
291 taskbar_list_SetThumbnailTooltip,
292 taskbar_list_SetThumbnailClip,
293 /* ITaskbarList4 method */
294 taskbar_list_SetTabProperties,
297 HRESULT TaskbarList_Constructor(IUnknown *outer, REFIID riid, void **taskbar_list)
299 struct taskbar_list *object;
300 HRESULT hres;
302 TRACE("outer %p, riid %s, taskbar_list %p\n", outer, debugstr_guid(riid), taskbar_list);
304 if (outer)
306 WARN("Aggregation not supported\n");
307 *taskbar_list = NULL;
308 return CLASS_E_NOAGGREGATION;
311 object = malloc(sizeof(*object));
312 if (!object)
314 ERR("Failed to allocate taskbar list object memory\n");
315 *taskbar_list = NULL;
316 return E_OUTOFMEMORY;
319 object->ITaskbarList4_iface.lpVtbl = &taskbar_list_vtbl;
320 object->refcount = 1;
321 EFRAME_LockModule();
323 TRACE("Created ITaskbarList4 %p\n", object);
325 hres = ITaskbarList4_QueryInterface(&object->ITaskbarList4_iface, riid, taskbar_list);
326 ITaskbarList4_Release(&object->ITaskbarList4_iface);
327 return hres;