winex11: Use the subpixel rendering configuration from fontconfig to override the...
[wine/multimedia.git] / dlls / hlink / browse_ctx.c
blob1e15c13a5439b7a26a39a45c6518349c60a78fe3
1 /*
2 * Implementation of hyperlinking (hlink.dll)
4 * Copyright 2005 Aric Stewart for CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "hlink_private.h"
23 #include "wine/debug.h"
25 WINE_DEFAULT_DEBUG_CHANNEL(hlink);
27 static const IHlinkBrowseContextVtbl hlvt;
29 typedef struct
31 const IHlinkBrowseContextVtbl *lpVtbl;
32 LONG ref;
33 HLBWINFO* BrowseWindowInfo;
34 IHlink* CurrentPage;
35 } HlinkBCImpl;
38 HRESULT WINAPI HLinkBrowseContext_Constructor(IUnknown *pUnkOuter, REFIID riid,
39 LPVOID *ppv)
41 HlinkBCImpl * hl;
43 TRACE("unkOut=%p riid=%s\n", pUnkOuter, debugstr_guid(riid));
44 *ppv = NULL;
46 if (pUnkOuter)
47 return CLASS_E_NOAGGREGATION;
49 hl = heap_alloc_zero(sizeof(HlinkBCImpl));
50 if (!hl)
51 return E_OUTOFMEMORY;
53 hl->ref = 1;
54 hl->lpVtbl = &hlvt;
56 *ppv = hl;
57 return S_OK;
60 static HRESULT WINAPI IHlinkBC_fnQueryInterface( IHlinkBrowseContext *iface,
61 REFIID riid, LPVOID* ppvObj)
63 HlinkBCImpl *This = (HlinkBCImpl*)iface;
64 TRACE ("(%p)->(%s,%p)\n", This, debugstr_guid (riid), ppvObj);
66 if (IsEqualIID(riid, &IID_IUnknown) ||
67 IsEqualIID(riid, &IID_IHlinkBrowseContext))
68 *ppvObj = This;
70 if (*ppvObj)
72 IUnknown_AddRef((IUnknown*)(*ppvObj));
73 return S_OK;
75 return E_NOINTERFACE;
78 static ULONG WINAPI IHlinkBC_fnAddRef (IHlinkBrowseContext* iface)
80 HlinkBCImpl *This = (HlinkBCImpl*)iface;
81 ULONG refCount = InterlockedIncrement(&This->ref);
83 TRACE("(%p)->(count=%u)\n", This, refCount - 1);
85 return refCount;
88 static ULONG WINAPI IHlinkBC_fnRelease (IHlinkBrowseContext* iface)
90 HlinkBCImpl *This = (HlinkBCImpl*)iface;
91 ULONG refCount = InterlockedDecrement(&This->ref);
93 TRACE("(%p)->(count=%u)\n", This, refCount + 1);
94 if (refCount)
95 return refCount;
97 TRACE("-- destroying IHlinkBrowseContext (%p)\n", This);
98 heap_free(This->BrowseWindowInfo);
99 if (This->CurrentPage)
100 IHlink_Release(This->CurrentPage);
101 heap_free(This);
102 return 0;
105 static HRESULT WINAPI IHlinkBC_Register(IHlinkBrowseContext* iface,
106 DWORD dwReserved, IUnknown *piunk, IMoniker *pimk, DWORD *pdwRegister)
108 static const WCHAR szIdent[] = {'W','I','N','E','H','L','I','N','K',0};
109 HlinkBCImpl *This = (HlinkBCImpl*)iface;
110 IMoniker *mon;
111 IMoniker *composite;
112 IRunningObjectTable *ROT;
114 FIXME("(%p)->(%i %p %p %p)\n", This, dwReserved, piunk, pimk, pdwRegister);
116 CreateItemMoniker(NULL, szIdent, &mon);
117 CreateGenericComposite(mon, pimk, &composite);
119 GetRunningObjectTable(0, &ROT);
120 IRunningObjectTable_Register(ROT, 0, piunk, composite, pdwRegister);
122 IRunningObjectTable_Release(ROT);
123 IMoniker_Release(composite);
124 IMoniker_Release(mon);
126 return S_OK;
129 static HRESULT WINAPI IHlinkBC_GetObject(IHlinkBrowseContext* face,
130 IMoniker *pimk, BOOL fBindifRootRegistered, IUnknown **ppiunk)
132 FIXME("\n");
133 return E_NOTIMPL;
136 static HRESULT WINAPI IHlinkBC_Revoke(IHlinkBrowseContext* iface,
137 DWORD dwRegister)
139 HRESULT r = S_OK;
140 IRunningObjectTable *ROT;
141 HlinkBCImpl *This = (HlinkBCImpl*)iface;
143 FIXME("(%p)->(%i)\n", This, dwRegister);
145 GetRunningObjectTable(0, &ROT);
146 r = IRunningObjectTable_Revoke(ROT, dwRegister);
147 IRunningObjectTable_Release(ROT);
149 return r;
152 static HRESULT WINAPI IHlinkBC_SetBrowseWindowInfo(IHlinkBrowseContext* iface,
153 HLBWINFO *phlbwi)
155 HlinkBCImpl *This = (HlinkBCImpl*)iface;
156 TRACE("(%p)->(%p)\n", This, phlbwi);
158 if(!phlbwi)
159 return E_INVALIDARG;
161 heap_free(This->BrowseWindowInfo);
162 This->BrowseWindowInfo = heap_alloc(phlbwi->cbSize);
163 memcpy(This->BrowseWindowInfo, phlbwi, phlbwi->cbSize);
165 return S_OK;
168 static HRESULT WINAPI IHlinkBC_GetBrowseWindowInfo(IHlinkBrowseContext* iface,
169 HLBWINFO *phlbwi)
171 HlinkBCImpl *This = (HlinkBCImpl*)iface;
172 TRACE("(%p)->(%p)\n", This, phlbwi);
174 if(!phlbwi)
175 return E_INVALIDARG;
177 if(!This->BrowseWindowInfo)
178 phlbwi->cbSize = 0;
179 else
180 memcpy(phlbwi, This->BrowseWindowInfo, This->BrowseWindowInfo->cbSize);
182 return S_OK;
185 static HRESULT WINAPI IHlinkBC_SetInitialHlink(IHlinkBrowseContext* iface,
186 IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName)
188 HlinkBCImpl *This = (HlinkBCImpl*)iface;
190 FIXME("(%p)->(%p %s %s)\n", This, pimkTarget,
191 debugstr_w(pwzLocation), debugstr_w(pwzFriendlyName));
193 if (This->CurrentPage)
194 IHlink_Release(This->CurrentPage);
196 HlinkCreateFromMoniker(pimkTarget, pwzLocation, pwzFriendlyName, NULL,
197 0, NULL, &IID_IHlink, (LPVOID*) &This->CurrentPage);
199 return S_OK;
202 static HRESULT WINAPI IHlinkBC_OnNavigateHlink(IHlinkBrowseContext *iface,
203 DWORD grfHLNF, IMoniker* pmkTarget, LPCWSTR pwzLocation, LPCWSTR
204 pwzFriendlyName, ULONG *puHLID)
206 HlinkBCImpl *This = (HlinkBCImpl*)iface;
208 FIXME("(%p)->(%i %p %s %s %p)\n", This, grfHLNF, pmkTarget,
209 debugstr_w(pwzLocation), debugstr_w(pwzFriendlyName), puHLID);
211 return S_OK;
214 static HRESULT WINAPI IHlinkBC_UpdateHlink(IHlinkBrowseContext* iface,
215 ULONG uHLID, IMoniker* pimkTarget, LPCWSTR pwzLocation,
216 LPCWSTR pwzFriendlyName)
218 FIXME("\n");
219 return E_NOTIMPL;
222 static HRESULT WINAPI IHlinkBC_EnumNavigationStack( IHlinkBrowseContext *iface,
223 DWORD dwReserved, DWORD grfHLFNAMEF, IEnumHLITEM** ppienumhlitem)
225 FIXME("\n");
226 return E_NOTIMPL;
229 static HRESULT WINAPI IHlinkBC_QueryHlink( IHlinkBrowseContext* iface,
230 DWORD grfHLONG, ULONG uHLID)
232 FIXME("\n");
233 return E_NOTIMPL;
236 static HRESULT WINAPI IHlinkBC_GetHlink( IHlinkBrowseContext* iface,
237 ULONG uHLID, IHlink** ppihl)
239 HlinkBCImpl *This = (HlinkBCImpl*)iface;
241 TRACE("(%p)->(%x %p)\n", This, uHLID, ppihl);
243 if(uHLID != HLID_CURRENT) {
244 FIXME("Only HLID_CURRENT implemented, given: %x\n", uHLID);
245 return E_NOTIMPL;
248 *ppihl = This->CurrentPage;
249 IHlink_AddRef(*ppihl);
251 return S_OK;
254 static HRESULT WINAPI IHlinkBC_SetCurrentHlink( IHlinkBrowseContext* iface,
255 ULONG uHLID)
257 FIXME("\n");
258 return E_NOTIMPL;
261 static HRESULT WINAPI IHlinkBC_Clone( IHlinkBrowseContext* iface,
262 IUnknown* piunkOuter, REFIID riid, IUnknown** ppiunkOjb)
264 FIXME("\n");
265 return E_NOTIMPL;
268 static HRESULT WINAPI IHlinkBC_Close(IHlinkBrowseContext* iface,
269 DWORD reserverd)
271 FIXME("\n");
272 return E_NOTIMPL;
275 static const IHlinkBrowseContextVtbl hlvt =
277 IHlinkBC_fnQueryInterface,
278 IHlinkBC_fnAddRef,
279 IHlinkBC_fnRelease,
280 IHlinkBC_Register,
281 IHlinkBC_GetObject,
282 IHlinkBC_Revoke,
283 IHlinkBC_SetBrowseWindowInfo,
284 IHlinkBC_GetBrowseWindowInfo,
285 IHlinkBC_SetInitialHlink,
286 IHlinkBC_OnNavigateHlink,
287 IHlinkBC_UpdateHlink,
288 IHlinkBC_EnumNavigationStack,
289 IHlinkBC_QueryHlink,
290 IHlinkBC_GetHlink,
291 IHlinkBC_SetCurrentHlink,
292 IHlinkBC_Clone,
293 IHlinkBC_Close