wined3d: Implement texbeml.
[wine.git] / dlls / hlink / browse_ctx.c
blobf36fd2fbe1553c7074071a97a6993a04ee1dbd07
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 <stdarg.h>
23 #define COBJMACROS
25 #include "winerror.h"
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winuser.h"
29 #include "ole2.h"
30 #include "unknwn.h"
31 #include "objidl.h"
33 #include "wine/debug.h"
34 #include "hlink.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(hlink);
38 static const IHlinkBrowseContextVtbl hlvt;
40 typedef struct
42 const IHlinkBrowseContextVtbl *lpVtbl;
43 LONG ref;
44 HLBWINFO* BrowseWindowInfo;
45 IHlink* CurrentPage;
46 } HlinkBCImpl;
49 HRESULT WINAPI HLinkBrowseContext_Constructor(IUnknown *pUnkOuter, REFIID riid,
50 LPVOID *ppv)
52 HlinkBCImpl * hl;
54 TRACE("unkOut=%p riid=%s\n", pUnkOuter, debugstr_guid(riid));
55 *ppv = NULL;
57 if (pUnkOuter)
58 return CLASS_E_NOAGGREGATION;
60 hl = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(HlinkBCImpl));
61 if (!hl)
62 return E_OUTOFMEMORY;
64 hl->ref = 1;
65 hl->lpVtbl = &hlvt;
67 *ppv = hl;
68 return S_OK;
71 static HRESULT WINAPI IHlinkBC_fnQueryInterface( IHlinkBrowseContext *iface,
72 REFIID riid, LPVOID* ppvObj)
74 HlinkBCImpl *This = (HlinkBCImpl*)iface;
75 TRACE ("(%p)->(%s,%p)\n", This, debugstr_guid (riid), ppvObj);
77 if (IsEqualIID(riid, &IID_IUnknown) ||
78 IsEqualIID(riid, &IID_IHlinkBrowseContext))
79 *ppvObj = This;
81 if (*ppvObj)
83 IUnknown_AddRef((IUnknown*)(*ppvObj));
84 return S_OK;
86 return E_NOINTERFACE;
89 static ULONG WINAPI IHlinkBC_fnAddRef (IHlinkBrowseContext* iface)
91 HlinkBCImpl *This = (HlinkBCImpl*)iface;
92 ULONG refCount = InterlockedIncrement(&This->ref);
94 TRACE("(%p)->(count=%u)\n", This, refCount - 1);
96 return refCount;
99 static ULONG WINAPI IHlinkBC_fnRelease (IHlinkBrowseContext* iface)
101 HlinkBCImpl *This = (HlinkBCImpl*)iface;
102 ULONG refCount = InterlockedDecrement(&This->ref);
104 TRACE("(%p)->(count=%u)\n", This, refCount + 1);
105 if (refCount)
106 return refCount;
108 TRACE("-- destroying IHlinkBrowseContext (%p)\n", This);
109 HeapFree(GetProcessHeap(), 0, This->BrowseWindowInfo);
110 if (This->CurrentPage)
111 IHlink_Release(This->CurrentPage);
112 HeapFree(GetProcessHeap(), 0, This);
113 return 0;
116 static HRESULT WINAPI IHlinkBC_Register(IHlinkBrowseContext* iface,
117 DWORD dwReserved, IUnknown *piunk, IMoniker *pimk, DWORD *pdwRegister)
119 static const WCHAR szIdent[] = {'W','I','N','E','H','L','I','N','K',0};
120 HlinkBCImpl *This = (HlinkBCImpl*)iface;
121 IMoniker *mon;
122 IMoniker *composite;
123 IRunningObjectTable *ROT;
125 FIXME("(%p)->(%i %p %p %p)\n", This, dwReserved, piunk, pimk, pdwRegister);
127 CreateItemMoniker(NULL, szIdent, &mon);
128 CreateGenericComposite(mon, pimk, &composite);
130 GetRunningObjectTable(0, &ROT);
131 IRunningObjectTable_Register(ROT, 0, piunk, composite, pdwRegister);
133 IRunningObjectTable_Release(ROT);
134 IMoniker_Release(composite);
135 IMoniker_Release(mon);
137 return S_OK;
140 static HRESULT WINAPI IHlinkBC_GetObject(IHlinkBrowseContext* face,
141 IMoniker *pimk, BOOL fBindifRootRegistered, IUnknown **ppiunk)
143 FIXME("\n");
144 return E_NOTIMPL;
147 static HRESULT WINAPI IHlinkBC_Revoke(IHlinkBrowseContext* iface,
148 DWORD dwRegister)
150 HRESULT r = S_OK;
151 IRunningObjectTable *ROT;
152 HlinkBCImpl *This = (HlinkBCImpl*)iface;
154 FIXME("(%p)->(%i)\n", This, dwRegister);
156 GetRunningObjectTable(0, &ROT);
157 r = IRunningObjectTable_Revoke(ROT, dwRegister);
158 IRunningObjectTable_Release(ROT);
160 return r;
163 static HRESULT WINAPI IHlinkBC_SetBrowseWindowInfo(IHlinkBrowseContext* iface,
164 HLBWINFO *phlbwi)
166 HlinkBCImpl *This = (HlinkBCImpl*)iface;
167 TRACE("(%p)->(%p)\n", This, phlbwi);
169 HeapFree(GetProcessHeap(), 0, This->BrowseWindowInfo);
170 This->BrowseWindowInfo = HeapAlloc(GetProcessHeap(), 0, phlbwi->cbSize);
171 memcpy(This->BrowseWindowInfo, phlbwi, phlbwi->cbSize);
173 return S_OK;
176 static HRESULT WINAPI IHlinkBC_GetBrowseWindowInfo(IHlinkBrowseContext* iface,
177 HLBWINFO *phlbwi)
179 FIXME("\n");
180 return E_NOTIMPL;
183 static HRESULT WINAPI IHlinkBC_SetInitialHlink(IHlinkBrowseContext* iface,
184 IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName)
186 HlinkBCImpl *This = (HlinkBCImpl*)iface;
188 FIXME("(%p)->(%p %s %s)\n", This, pimkTarget,
189 debugstr_w(pwzLocation), debugstr_w(pwzFriendlyName));
191 if (This->CurrentPage)
192 IHlink_Release(This->CurrentPage);
194 HlinkCreateFromMoniker(pimkTarget, pwzLocation, pwzFriendlyName, NULL,
195 0, NULL, &IID_IHlink, (LPVOID*) &This->CurrentPage);
197 return S_OK;
200 static HRESULT WINAPI IHlinkBC_OnNavigateHlink(IHlinkBrowseContext *iface,
201 DWORD grfHLNF, IMoniker* pmkTarget, LPCWSTR pwzLocation, LPCWSTR
202 pwzFriendlyName, ULONG *puHLID)
204 HlinkBCImpl *This = (HlinkBCImpl*)iface;
206 FIXME("(%p)->(%i %p %s %s %p)\n", This, grfHLNF, pmkTarget,
207 debugstr_w(pwzLocation), debugstr_w(pwzFriendlyName), puHLID);
209 return S_OK;
212 static HRESULT WINAPI IHlinkBC_UpdateHlink(IHlinkBrowseContext* iface,
213 ULONG uHLID, IMoniker* pimkTarget, LPCWSTR pwzLocation,
214 LPCWSTR pwzFriendlyName)
216 FIXME("\n");
217 return E_NOTIMPL;
220 static HRESULT WINAPI IHlinkBC_EnumNavigationStack( IHlinkBrowseContext *iface,
221 DWORD dwReserved, DWORD grfHLFNAMEF, IEnumHLITEM** ppienumhlitem)
223 FIXME("\n");
224 return E_NOTIMPL;
227 static HRESULT WINAPI IHlinkBC_QueryHlink( IHlinkBrowseContext* iface,
228 DWORD grfHLONG, ULONG uHLID)
230 FIXME("\n");
231 return E_NOTIMPL;
234 static HRESULT WINAPI IHlinkBC_GetHlink( IHlinkBrowseContext* iface,
235 ULONG uHLID, IHlink** ppihl)
237 FIXME("\n");
238 return E_NOTIMPL;
241 static HRESULT WINAPI IHlinkBC_SetCurrentHlink( IHlinkBrowseContext* iface,
242 ULONG uHLID)
244 FIXME("\n");
245 return E_NOTIMPL;
248 static HRESULT WINAPI IHlinkBC_Clone( IHlinkBrowseContext* iface,
249 IUnknown* piunkOuter, REFIID riid, IUnknown** ppiunkOjb)
251 FIXME("\n");
252 return E_NOTIMPL;
255 static HRESULT WINAPI IHlinkBC_Close(IHlinkBrowseContext* iface,
256 DWORD reserverd)
258 FIXME("\n");
259 return E_NOTIMPL;
262 static const IHlinkBrowseContextVtbl hlvt =
264 IHlinkBC_fnQueryInterface,
265 IHlinkBC_fnAddRef,
266 IHlinkBC_fnRelease,
267 IHlinkBC_Register,
268 IHlinkBC_GetObject,
269 IHlinkBC_Revoke,
270 IHlinkBC_SetBrowseWindowInfo,
271 IHlinkBC_GetBrowseWindowInfo,
272 IHlinkBC_SetInitialHlink,
273 IHlinkBC_OnNavigateHlink,
274 IHlinkBC_UpdateHlink,
275 IHlinkBC_EnumNavigationStack,
276 IHlinkBC_QueryHlink,
277 IHlinkBC_GetHlink,
278 IHlinkBC_SetCurrentHlink,
279 IHlinkBC_Clone,
280 IHlinkBC_Close