2 * AutoComplete interfaces implementation.
4 * Copyright 2004 Maxime Bellengé <maxime.bellenge@laposte.net>
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include "wine/debug.h"
28 #include "undocshell.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(shell
);
43 ICOM_VFIELD(IAutoComplete
);
44 ICOM_VTABLE (IAutoComplete2
) * lpvtblAutoComplete2
;
47 AUTOCOMPLETEOPTIONS options
;
50 static struct ICOM_VTABLE(IAutoComplete
) acvt
;
51 static struct ICOM_VTABLE(IAutoComplete2
) ac2vt
;
53 #define _IAutoComplete2_Offset ((int)(&(((IAutoCompleteImpl*)0)->lpvtblAutoComplete2)))
54 #define _ICOM_THIS_From_IAutoComplete2(class, name) class* This = (class*)(((char*)name)-_IAutoComplete2_Offset);
57 converts This to a interface pointer
59 #define _IUnknown_(This) (IUnknown*)&(This->lpVtbl)
60 #define _IAutoComplete2_(This) (IAutoComplete2*)&(This->lpvtblAutoComplete2)
62 /**************************************************************************
63 * IAutoComplete_Constructor
65 HRESULT WINAPI
IAutoComplete_Constructor(IUnknown
* pUnkOuter
, REFIID riid
, LPVOID
* ppv
)
67 IAutoCompleteImpl
*lpac
;
69 if (pUnkOuter
&& !IsEqualIID (riid
, &IID_IUnknown
))
70 return CLASS_E_NOAGGREGATION
;
72 lpac
= (IAutoCompleteImpl
*)HeapAlloc(GetProcessHeap(),
73 HEAP_ZERO_MEMORY
, sizeof(IAutoCompleteImpl
));
79 lpac
->lpvtblAutoComplete2
= &ac2vt
;
82 if (!SUCCEEDED (IUnknown_QueryInterface (_IUnknown_ (lpac
), riid
, ppv
))) {
83 IUnknown_Release (_IUnknown_ (lpac
));
87 TRACE("-- (%p)->\n",lpac
);
92 /**************************************************************************
93 * AutoComplete_QueryInterface
95 static HRESULT WINAPI
IAutoComplete_fnQueryInterface(
96 IAutoComplete
* iface
,
100 ICOM_THIS(IAutoCompleteImpl
, iface
);
102 TRACE("(%p)->(\n\tIID:\t%s,%p)\n", This
, shdebugstr_guid(riid
), ppvObj
);
105 if(IsEqualIID(riid
, &IID_IUnknown
))
109 else if(IsEqualIID(riid
, &IID_IAutoComplete
))
111 *ppvObj
= (IAutoComplete
*)This
;
113 else if(IsEqualIID(riid
, &IID_IAutoComplete2
))
115 *ppvObj
= _IAutoComplete2_ (This
);
120 IAutoComplete_AddRef((IAutoComplete
*)*ppvObj
);
121 TRACE("-- Interface: (%p)->(%p)\n", ppvObj
, *ppvObj
);
124 TRACE("-- Interface: E_NOINTERFACE\n");
125 return E_NOINTERFACE
;
128 /******************************************************************************
129 * IAutoComplete_fnAddRef
131 static ULONG WINAPI
IAutoComplete_fnAddRef(
132 IAutoComplete
* iface
)
134 ICOM_THIS(IAutoCompleteImpl
,iface
);
136 TRACE("(%p)->(%lu)\n",This
,This
->ref
);
137 return ++(This
->ref
);
140 /******************************************************************************
141 * IAutoComplete_fnRelease
143 static ULONG WINAPI
IAutoComplete_fnRelease(
144 IAutoComplete
* iface
)
146 ICOM_THIS(IAutoCompleteImpl
,iface
);
148 TRACE("(%p)->(%lu)\n",This
,This
->ref
);
150 if (!--(This
->ref
)) {
151 TRACE(" destroying IAutoComplete(%p)\n",This
);
152 HeapFree(GetProcessHeap(), 0, This
);
158 /******************************************************************************
159 * IAutoComplete_fnEnable
161 static HRESULT WINAPI
IAutoComplete_fnEnable(
162 IAutoComplete
* iface
,
165 ICOM_THIS(IAutoCompleteImpl
, iface
);
169 TRACE("(%p)->(%s)\n", This
, (fEnable
)?"true":"false");
171 This
->enable
= fEnable
;
176 /******************************************************************************
177 * IAutoComplete_fnInit
179 static HRESULT WINAPI
IAutoComplete_fnInit(
180 IAutoComplete
* iface
,
183 LPCOLESTR pwzsRegKeyPath
,
184 LPCOLESTR pwszQuickComplete
)
186 ICOM_THIS(IAutoCompleteImpl
, iface
);
188 HRESULT hr
= E_NOTIMPL
;
190 FIXME("(%p)->(0x%08lx, %p, %s, %s) not implemented\n",
191 This
, (long)hwndEdit
, punkACL
, debugstr_w(pwzsRegKeyPath
), debugstr_w(pwszQuickComplete
));
196 /**************************************************************************
197 * IAutoComplete_fnVTable
199 static ICOM_VTABLE (IAutoComplete
) acvt
=
201 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
202 IAutoComplete_fnQueryInterface
,
203 IAutoComplete_fnAddRef
,
204 IAutoComplete_fnRelease
,
205 IAutoComplete_fnInit
,
206 IAutoComplete_fnEnable
,
209 /**************************************************************************
210 * AutoComplete2_QueryInterface
212 static HRESULT WINAPI
IAutoComplete2_fnQueryInterface(
213 IAutoComplete2
* iface
,
217 _ICOM_THIS_From_IAutoComplete2(IAutoCompleteImpl
, iface
);
219 TRACE ("(%p)->(%s,%p)\n", This
, shdebugstr_guid (riid
), ppvObj
);
221 return IAutoComplete_QueryInterface((IAutoComplete
*)This
, riid
, ppvObj
);
224 /******************************************************************************
225 * IAutoComplete2_fnAddRef
227 static ULONG WINAPI
IAutoComplete2_fnAddRef(
228 IAutoComplete2
* iface
)
230 _ICOM_THIS_From_IAutoComplete2(IAutoCompleteImpl
,iface
);
232 TRACE ("(%p)->(count=%lu)\n", This
, This
->ref
);
234 return IAutoComplete2_AddRef((IAutoComplete
*)This
);
237 /******************************************************************************
238 * IAutoComplete2_fnRelease
240 static ULONG WINAPI
IAutoComplete2_fnRelease(
241 IAutoComplete2
* iface
)
243 _ICOM_THIS_From_IAutoComplete2(IAutoCompleteImpl
,iface
);
245 TRACE ("(%p)->(count=%lu)\n", This
, This
->ref
);
247 return IAutoComplete_Release((IAutoComplete
*)This
);
250 /******************************************************************************
251 * IAutoComplete2_fnEnable
253 static HRESULT WINAPI
IAutoComplete2_fnEnable(
254 IAutoComplete2
* iface
,
257 _ICOM_THIS_From_IAutoComplete2(IAutoCompleteImpl
, iface
);
259 TRACE ("(%p)->(%s)\n", This
, (fEnable
)?"true":"false");
261 return IAutoComplete_Enable((IAutoComplete
*)This
, fEnable
);
264 /******************************************************************************
265 * IAutoComplete2_fnInit
267 static HRESULT WINAPI
IAutoComplete2_fnInit(
268 IAutoComplete2
* iface
,
271 LPCOLESTR pwzsRegKeyPath
,
272 LPCOLESTR pwszQuickComplete
)
274 _ICOM_THIS_From_IAutoComplete2(IAutoCompleteImpl
, iface
);
276 TRACE("(%p)\n", This
);
278 return IAutoComplete_Init((IAutoComplete
*)This
, hwndEdit
, punkACL
, pwzsRegKeyPath
, pwszQuickComplete
);
281 /**************************************************************************
282 * IAutoComplete_fnGetOptions
284 static HRESULT WINAPI
IAutoComplete2_fnGetOptions(
285 IAutoComplete2
* iface
,
290 _ICOM_THIS_From_IAutoComplete2(IAutoCompleteImpl
, iface
);
292 TRACE("(%p) -> (%p)\n", This
, pdwFlag
);
294 *pdwFlag
= This
->options
;
299 /**************************************************************************
300 * IAutoComplete_fnSetOptions
302 static HRESULT WINAPI
IAutoComplete2_fnSetOptions(
303 IAutoComplete2
* iface
,
308 _ICOM_THIS_From_IAutoComplete2(IAutoCompleteImpl
, iface
);
310 FIXME("(%p) -> (0x%lx) not implemented\n", This
, dwFlag
);
315 /**************************************************************************
316 * IAutoComplete2_fnVTable
318 static ICOM_VTABLE (IAutoComplete2
) ac2vt
=
320 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
321 IAutoComplete2_fnQueryInterface
,
322 IAutoComplete2_fnAddRef
,
323 IAutoComplete2_fnRelease
,
324 IAutoComplete2_fnInit
,
325 IAutoComplete2_fnEnable
,
327 IAutoComplete2_fnSetOptions
,
328 IAutoComplete2_fnGetOptions
,