wined3d: Tidy up shader_hw_rsq_rcp.
[wine] / dlls / shdocvw / taskbarlist.c
1 /*
2  * Copyright 2009 Henri Verbeet for CodeWeavers
3  *
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.
8  *
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.
13  *
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
17  *
18  */
19
20 #include "config.h"
21 #include "wine/port.h"
22 #include "wine/debug.h"
23
24 #include "shdocvw.h"
25
26 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
27
28 struct taskbar_list
29 {
30     const struct ITaskbarListVtbl *lpVtbl;
31     LONG refcount;
32 };
33
34 /* IUnknown methods */
35
36 static HRESULT STDMETHODCALLTYPE taskbar_list_QueryInterface(ITaskbarList *iface, REFIID riid, void **object)
37 {
38     TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
39
40     if (IsEqualGUID(riid, &IID_ITaskbarList)
41             || IsEqualGUID(riid, &IID_IUnknown))
42     {
43         IUnknown_AddRef(iface);
44         *object = iface;
45         return S_OK;
46     }
47
48     WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
49
50     *object = NULL;
51     return E_NOINTERFACE;
52 }
53
54 static ULONG STDMETHODCALLTYPE taskbar_list_AddRef(ITaskbarList *iface)
55 {
56     struct taskbar_list *This = (struct taskbar_list *)iface;
57     ULONG refcount = InterlockedIncrement(&This->refcount);
58
59     TRACE("%p increasing refcount to %u\n", This, refcount);
60
61     return refcount;
62 }
63
64 static ULONG STDMETHODCALLTYPE taskbar_list_Release(ITaskbarList *iface)
65 {
66     struct taskbar_list *This = (struct taskbar_list *)iface;
67     ULONG refcount = InterlockedDecrement(&This->refcount);
68
69     TRACE("%p decreasing refcount to %u\n", This, refcount);
70
71     if (!refcount)
72     {
73         HeapFree(GetProcessHeap(), 0, This);
74     }
75
76     return refcount;
77 }
78
79 /* ITaskbarList methods */
80
81 static HRESULT STDMETHODCALLTYPE taskbar_list_HrInit(ITaskbarList *iface)
82 {
83     FIXME("iface %p stub!\n", iface);
84
85     return E_NOTIMPL;
86 }
87
88 static HRESULT STDMETHODCALLTYPE taskbar_list_AddTab(ITaskbarList *iface, HWND hwnd)
89 {
90     FIXME("iface %p, hwnd %p stub!\n", iface, hwnd);
91
92     return E_NOTIMPL;
93 }
94
95 static HRESULT STDMETHODCALLTYPE taskbar_list_DeleteTab(ITaskbarList *iface, HWND hwnd)
96 {
97     FIXME("iface %p, hwnd %p stub!\n", iface, hwnd);
98
99     return E_NOTIMPL;
100 }
101
102 static HRESULT STDMETHODCALLTYPE taskbar_list_ActivateTab(ITaskbarList *iface, HWND hwnd)
103 {
104     FIXME("iface %p, hwnd %p stub!\n", iface, hwnd);
105
106     return E_NOTIMPL;
107 }
108
109 static HRESULT STDMETHODCALLTYPE taskbar_list_SetActiveAlt(ITaskbarList *iface, HWND hwnd)
110 {
111     FIXME("iface %p, hwnd %p stub!\n", iface, hwnd);
112
113     return E_NOTIMPL;
114 }
115
116 static const struct ITaskbarListVtbl taskbar_list_vtbl =
117 {
118     /* IUnknown methods */
119     taskbar_list_QueryInterface,
120     taskbar_list_AddRef,
121     taskbar_list_Release,
122     /* ITaskbarList methods */
123     taskbar_list_HrInit,
124     taskbar_list_AddTab,
125     taskbar_list_DeleteTab,
126     taskbar_list_ActivateTab,
127     taskbar_list_SetActiveAlt,
128 };
129
130 HRESULT TaskbarList_Create(IUnknown *outer, REFIID riid, void **taskbar_list)
131 {
132     struct taskbar_list *object;
133
134     TRACE("outer %p, riid %s, taskbar_list %p\n", outer, debugstr_guid(riid), taskbar_list);
135
136     if (outer)
137     {
138         WARN("Aggregation not supported\n");
139         return CLASS_E_NOAGGREGATION;
140     }
141
142     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
143     if (!object)
144     {
145         ERR("Failed to allocate taskbar list object memory\n");
146         return E_OUTOFMEMORY;
147     }
148
149     object->lpVtbl = &taskbar_list_vtbl;
150     object->refcount = 1;
151
152     *taskbar_list = object;
153
154     TRACE("Created ITaskbarList %p\n", object);
155
156     return S_OK;
157 }