crypt32: Add additional path for Solaris 11 Express.
[wine] / dlls / shdocvw / taskbarlist.c
1 /*
2  * Copyright 2009 Henri Verbeet for CodeWeavers
3  * Copyright 2011 AndrĂ© Hentschel
4  *
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.
9  *
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.
14  *
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
18  *
19  */
20
21 #include "config.h"
22 #include "wine/port.h"
23 #include "wine/debug.h"
24
25 #include "shdocvw.h"
26
27 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
28
29 struct taskbar_list
30 {
31     ITaskbarList4 ITaskbarList4_iface;
32     LONG refcount;
33 };
34
35 static inline struct taskbar_list *impl_from_ITaskbarList4(ITaskbarList4 *iface)
36 {
37     return CONTAINING_RECORD(iface, struct taskbar_list, ITaskbarList4_iface);
38 }
39
40 /* IUnknown methods */
41
42 static HRESULT STDMETHODCALLTYPE taskbar_list_QueryInterface(ITaskbarList4 *iface, REFIID riid, void **object)
43 {
44     TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
45
46     if (IsEqualGUID(riid, &IID_ITaskbarList) ||
47         IsEqualGUID(riid, &IID_ITaskbarList2) ||
48         IsEqualGUID(riid, &IID_ITaskbarList3) ||
49         IsEqualGUID(riid, &IID_ITaskbarList4) ||
50         IsEqualGUID(riid, &IID_IUnknown))
51     {
52         IUnknown_AddRef(iface);
53         *object = iface;
54         return S_OK;
55     }
56
57     WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
58
59     *object = NULL;
60     return E_NOINTERFACE;
61 }
62
63 static ULONG STDMETHODCALLTYPE taskbar_list_AddRef(ITaskbarList4 *iface)
64 {
65     struct taskbar_list *This = impl_from_ITaskbarList4(iface);
66     ULONG refcount = InterlockedIncrement(&This->refcount);
67
68     TRACE("%p increasing refcount to %u\n", This, refcount);
69
70     return refcount;
71 }
72
73 static ULONG STDMETHODCALLTYPE taskbar_list_Release(ITaskbarList4 *iface)
74 {
75     struct taskbar_list *This = impl_from_ITaskbarList4(iface);
76     ULONG refcount = InterlockedDecrement(&This->refcount);
77
78     TRACE("%p decreasing refcount to %u\n", This, refcount);
79
80     if (!refcount)
81     {
82         HeapFree(GetProcessHeap(), 0, This);
83         SHDOCVW_UnlockModule();
84     }
85
86     return refcount;
87 }
88
89 /* ITaskbarList methods */
90
91 static HRESULT STDMETHODCALLTYPE taskbar_list_HrInit(ITaskbarList4 *iface)
92 {
93     TRACE("iface %p\n", iface);
94
95     return S_OK;
96 }
97
98 static HRESULT STDMETHODCALLTYPE taskbar_list_AddTab(ITaskbarList4 *iface, HWND hwnd)
99 {
100     FIXME("iface %p, hwnd %p stub!\n", iface, hwnd);
101
102     return E_NOTIMPL;
103 }
104
105 static HRESULT STDMETHODCALLTYPE taskbar_list_DeleteTab(ITaskbarList4 *iface, HWND hwnd)
106 {
107     FIXME("iface %p, hwnd %p stub!\n", iface, hwnd);
108
109     return E_NOTIMPL;
110 }
111
112 static HRESULT STDMETHODCALLTYPE taskbar_list_ActivateTab(ITaskbarList4 *iface, HWND hwnd)
113 {
114     FIXME("iface %p, hwnd %p stub!\n", iface, hwnd);
115
116     return E_NOTIMPL;
117 }
118
119 static HRESULT STDMETHODCALLTYPE taskbar_list_SetActiveAlt(ITaskbarList4 *iface, HWND hwnd)
120 {
121     FIXME("iface %p, hwnd %p stub!\n", iface, hwnd);
122
123     return E_NOTIMPL;
124 }
125
126 /* ITaskbarList2 method */
127
128 static HRESULT STDMETHODCALLTYPE taskbar_list_MarkFullscreenWindow(ITaskbarList4 *iface,
129                                                                    HWND hwnd,
130                                                                    BOOL fullscreen)
131 {
132     FIXME("iface %p, hwnd %p, fullscreen %s stub!\n", iface, hwnd, (fullscreen)?"true":"false");
133
134     return E_NOTIMPL;
135 }
136
137 /* ITaskbarList3 methods */
138
139 static HRESULT STDMETHODCALLTYPE taskbar_list_SetProgressValue(ITaskbarList4 *iface,
140                                                                HWND hwnd,
141                                                                ULONGLONG ullCompleted,
142                                                                ULONGLONG ullTotal)
143 {
144     FIXME("iface %p, hwnd %p, ullCompleted %s, ullTotal %s stub!\n", iface, hwnd,
145           wine_dbgstr_longlong(ullCompleted), wine_dbgstr_longlong(ullTotal));
146
147     return S_OK;
148 }
149
150 static HRESULT STDMETHODCALLTYPE taskbar_list_SetProgressState(ITaskbarList4 *iface,
151                                                                HWND hwnd,
152                                                                TBPFLAG tbpFlags)
153 {
154     FIXME("iface %p, hwnd %p, flags %x stub!\n", iface, hwnd, tbpFlags);
155
156     return S_OK;
157 }
158
159 static HRESULT STDMETHODCALLTYPE taskbar_list_RegisterTab(ITaskbarList4 *iface, HWND hwndTab, HWND hwndMDI)
160 {
161     FIXME("iface %p, hwndTab %p, hwndMDI %p stub!\n", iface, hwndTab, hwndMDI);
162
163     return E_NOTIMPL;
164 }
165
166 static HRESULT STDMETHODCALLTYPE taskbar_list_UnregisterTab(ITaskbarList4 *iface, HWND hwndTab)
167 {
168     FIXME("iface %p, hwndTab %p stub!\n", iface, hwndTab);
169
170     return E_NOTIMPL;
171 }
172
173 static HRESULT STDMETHODCALLTYPE taskbar_list_SetTabOrder(ITaskbarList4 *iface,
174                                                           HWND hwndTab,
175                                                           HWND hwndInsertBefore)
176 {
177     FIXME("iface %p, hwndTab %p, hwndInsertBefore %p stub!\n", iface, hwndTab, hwndInsertBefore);
178
179     return E_NOTIMPL;
180 }
181
182 static HRESULT STDMETHODCALLTYPE taskbar_list_SetTabActive(ITaskbarList4 *iface,
183                                                           HWND hwndTab,
184                                                           HWND hwndMDI,
185                                                           DWORD dwReserved)
186 {
187     FIXME("iface %p, hwndTab %p, hwndMDI %p, dwReserved %x stub!\n", iface, hwndTab, hwndMDI, dwReserved);
188
189     return E_NOTIMPL;
190 }
191
192 static HRESULT STDMETHODCALLTYPE taskbar_list_ThumbBarAddButtons(ITaskbarList4 *iface,
193                                                                  HWND hwnd,
194                                                                  UINT cButtons,
195                                                                  LPTHUMBBUTTON pButton)
196 {
197     FIXME("iface %p, hwnd %p, cButtons %u, pButton %p stub!\n", iface, hwnd, cButtons, pButton);
198
199     return E_NOTIMPL;
200 }
201
202 static HRESULT STDMETHODCALLTYPE taskbar_list_ThumbBarUpdateButtons(ITaskbarList4 *iface,
203                                                                    HWND hwnd,
204                                                                    UINT cButtons,
205                                                                    LPTHUMBBUTTON pButton)
206 {
207     FIXME("iface %p, hwnd %p, cButtons %u, pButton %p stub!\n", iface, hwnd, cButtons, pButton);
208
209     return E_NOTIMPL;
210 }
211
212 static HRESULT STDMETHODCALLTYPE taskbar_list_ThumbBarSetImageList(ITaskbarList4 *iface,
213                                                                    HWND hwnd,
214                                                                    HIMAGELIST himl)
215 {
216     FIXME("iface %p, hwnd %p, himl %p stub!\n", iface, hwnd, himl);
217
218     return E_NOTIMPL;
219 }
220
221 static HRESULT STDMETHODCALLTYPE taskbar_list_SetOverlayIcon(ITaskbarList4 *iface,
222                                                              HWND hwnd,
223                                                              HICON hIcon,
224                                                              LPCWSTR pszDescription)
225 {
226     FIXME("iface %p, hwnd %p, hIcon %p, pszDescription %s stub!\n", iface, hwnd, hIcon,
227           debugstr_w(pszDescription));
228
229     return E_NOTIMPL;
230 }
231
232 static HRESULT STDMETHODCALLTYPE taskbar_list_SetThumbnailTooltip(ITaskbarList4 *iface,
233                                                                   HWND hwnd,
234                                                                   LPCWSTR pszTip)
235 {
236     FIXME("iface %p, hwnd %p, pszTip %s stub!\n", iface, hwnd, debugstr_w(pszTip));
237
238     return E_NOTIMPL;
239 }
240
241 static HRESULT STDMETHODCALLTYPE taskbar_list_SetThumbnailClip(ITaskbarList4 *iface,
242                                                                HWND hwnd,
243                                                                RECT *prcClip)
244 {
245     FIXME("iface %p, hwnd %p, prcClip %s stub!\n", iface, hwnd, wine_dbgstr_rect(prcClip));
246
247     return E_NOTIMPL;
248 }
249
250 /* ITaskbarList4 method */
251
252 static HRESULT STDMETHODCALLTYPE taskbar_list_SetTabProperties(ITaskbarList4 *iface,
253                                                                HWND hwndTab,
254                                                                STPFLAG stpFlags)
255 {
256     FIXME("iface %p, hwndTab %p, stpFlags %u stub!\n", iface, hwndTab, stpFlags);
257
258     return E_NOTIMPL;
259 }
260
261 static const struct ITaskbarList4Vtbl taskbar_list_vtbl =
262 {
263     /* IUnknown methods */
264     taskbar_list_QueryInterface,
265     taskbar_list_AddRef,
266     taskbar_list_Release,
267     /* ITaskbarList methods */
268     taskbar_list_HrInit,
269     taskbar_list_AddTab,
270     taskbar_list_DeleteTab,
271     taskbar_list_ActivateTab,
272     taskbar_list_SetActiveAlt,
273     /* ITaskbarList2 method */
274     taskbar_list_MarkFullscreenWindow,
275     /* ITaskbarList3 methods */
276     taskbar_list_SetProgressValue,
277     taskbar_list_SetProgressState,
278     taskbar_list_RegisterTab,
279     taskbar_list_UnregisterTab,
280     taskbar_list_SetTabOrder,
281     taskbar_list_SetTabActive,
282     taskbar_list_ThumbBarAddButtons,
283     taskbar_list_ThumbBarUpdateButtons,
284     taskbar_list_ThumbBarSetImageList,
285     taskbar_list_SetOverlayIcon,
286     taskbar_list_SetThumbnailTooltip,
287     taskbar_list_SetThumbnailClip,
288     /* ITaskbarList4 method */
289     taskbar_list_SetTabProperties,
290 };
291
292 HRESULT TaskbarList_Create(IUnknown *outer, REFIID riid, void **taskbar_list)
293 {
294     struct taskbar_list *object;
295     HRESULT hr;
296
297     TRACE("outer %p, riid %s, taskbar_list %p\n", outer, debugstr_guid(riid), taskbar_list);
298
299     if (outer)
300     {
301         WARN("Aggregation not supported\n");
302         *taskbar_list = NULL;
303         return CLASS_E_NOAGGREGATION;
304     }
305
306     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
307     if (!object)
308     {
309         ERR("Failed to allocate taskbar list object memory\n");
310         *taskbar_list = NULL;
311         return E_OUTOFMEMORY;
312     }
313
314     object->ITaskbarList4_iface.lpVtbl = &taskbar_list_vtbl;
315     object->refcount = 0;
316
317     TRACE("Created ITaskbarList4 %p\n", object);
318
319     hr = ITaskbarList4_QueryInterface(&object->ITaskbarList4_iface, riid, taskbar_list);
320     if (FAILED(hr))
321     {
322         HeapFree(GetProcessHeap(), 0, object);
323         return hr;
324     }
325
326     SHDOCVW_LockModule();
327
328     return S_OK;
329 }