2 * Copyright 2006 Jacek Caban for CodeWeavers
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.
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.
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
32 #include "wine/debug.h"
34 #include "mshtml_private.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
39 const IHTMLSelectElementVtbl *lpHTMLSelectElementVtbl;
42 nsIDOMHTMLSelectElement *nsselect;
45 #define HTMLSELECT(x) ((IHTMLSelectElement*) &(x)->lpHTMLSelectElementVtbl)
47 #define HTMLSELECT_THIS(iface) DEFINE_THIS(HTMLSelectElement, HTMLSelectElement, iface)
49 static HRESULT WINAPI HTMLSelectElement_QueryInterface(IHTMLSelectElement *iface,
50 REFIID riid, void **ppv)
52 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
57 if(IsEqualGUID(&IID_IUnknown, riid)) {
58 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
59 *ppv = HTMLSELECT(This);
60 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
61 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
62 *ppv = HTMLSELECT(This);
63 }else if(IsEqualGUID(&IID_IHTMLSelectElement, riid)) {
64 TRACE("(%p)->(IID_IHTMLSelectElement %p)\n", This, ppv);
65 *ppv = HTMLSELECT(This);
69 IUnknown_AddRef((IUnknown*)*ppv);
73 hres = HTMLElement_QI(This->element, riid, ppv);
75 WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
80 static ULONG WINAPI HTMLSelectElement_AddRef(IHTMLSelectElement *iface)
82 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
84 TRACE("(%p)\n", This);
86 return IHTMLDocument2_AddRef(HTMLDOC(This->element->node->doc));
89 static ULONG WINAPI HTMLSelectElement_Release(IHTMLSelectElement *iface)
91 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
93 TRACE("(%p)\n", This);
95 return IHTMLDocument2_Release(HTMLDOC(This->element->node->doc));
98 static HRESULT WINAPI HTMLSelectElement_GetTypeInfoCount(IHTMLSelectElement *iface, UINT *pctinfo)
100 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
101 FIXME("(%p)->(%p)\n", This, pctinfo);
105 static HRESULT WINAPI HTMLSelectElement_GetTypeInfo(IHTMLSelectElement *iface, UINT iTInfo,
106 LCID lcid, ITypeInfo **ppTInfo)
108 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
109 FIXME("(%p)->(%u %lu %p)\n", This, iTInfo, lcid, ppTInfo);
113 static HRESULT WINAPI HTMLSelectElement_GetIDsOfNames(IHTMLSelectElement *iface, REFIID riid,
114 LPOLESTR *rgszNames, UINT cNames,
115 LCID lcid, DISPID *rgDispId)
117 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
118 FIXME("(%p)->(%s %p %u %lu %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
123 static HRESULT WINAPI HTMLSelectElement_Invoke(IHTMLSelectElement *iface, DISPID dispIdMember,
124 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
125 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
127 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
128 FIXME("(%p)->(%ld %s %ld %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
129 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
133 static HRESULT WINAPI HTMLSelectElement_put_size(IHTMLSelectElement *iface, long v)
135 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
136 FIXME("(%p)->(%ld)\n", This, v);
140 static HRESULT WINAPI HTMLSelectElement_get_size(IHTMLSelectElement *iface, long *p)
142 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
143 FIXME("(%p)->(%p)\n", This, p);
147 static HRESULT WINAPI HTMLSelectElement_put_multiple(IHTMLSelectElement *iface, VARIANT_BOOL v)
149 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
150 FIXME("(%p)->(%x)\n", This, v);
154 static HRESULT WINAPI HTMLSelectElement_get_multiple(IHTMLSelectElement *iface, VARIANT_BOOL *p)
156 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
157 FIXME("(%p)->(%p)\n", This, p);
161 static HRESULT WINAPI HTMLSelectElement_put_name(IHTMLSelectElement *iface, BSTR v)
163 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
164 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
168 static HRESULT WINAPI HTMLSelectElement_get_name(IHTMLSelectElement *iface, BSTR *p)
170 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
172 const PRUnichar *name = NULL;
175 TRACE("(%p)->(%p)\n", This, p);
177 nsAString_Init(&name_str, NULL);
179 nsres = nsIDOMHTMLSelectElement_GetName(This->nsselect, &name_str);
180 if(NS_SUCCEEDED(nsres)) {
181 nsAString_GetData(&name_str, &name, NULL);
182 *p = SysAllocString(name);
184 ERR("GetName failed: %08lx\n", nsres);
187 nsAString_Finish(&name_str);
189 TRACE("name=%s\n", debugstr_w(name));
193 static HRESULT WINAPI HTMLSelectElement_get_options(IHTMLSelectElement *iface, IDispatch **p)
195 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
196 FIXME("(%p)->(%p)\n", This, p);
200 static HRESULT WINAPI HTMLSelectElement_put_onchange(IHTMLSelectElement *iface, VARIANT v)
202 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
203 FIXME("(%p)->()\n", This);
207 static HRESULT WINAPI HTMLSelectElement_get_onchange(IHTMLSelectElement *iface, VARIANT *p)
209 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
210 FIXME("(%p)->(%p)\n", This, p);
214 static HRESULT WINAPI HTMLSelectElement_put_selectedIndex(IHTMLSelectElement *iface, long v)
216 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
217 FIXME("(%p)->(%ld)\n", This, v);
221 static HRESULT WINAPI HTMLSelectElement_get_selectedIndex(IHTMLSelectElement *iface, long *p)
223 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
224 FIXME("(%p)->(%p)\n", This, p);
228 static HRESULT WINAPI HTMLSelectElement_get_type(IHTMLSelectElement *iface, BSTR *p)
230 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
231 FIXME("(%p)->(%p)\n", This, p);
235 static HRESULT WINAPI HTMLSelectElement_put_value(IHTMLSelectElement *iface, BSTR v)
237 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
238 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
242 static HRESULT WINAPI HTMLSelectElement_get_value(IHTMLSelectElement *iface, BSTR *p)
244 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
246 const PRUnichar *value = NULL;
249 TRACE("(%p)->(%p)\n", This, p);
251 nsAString_Init(&value_str, NULL);
253 nsres = nsIDOMHTMLSelectElement_GetValue(This->nsselect, &value_str);
254 if(NS_SUCCEEDED(nsres)) {
255 nsAString_GetData(&value_str, &value, NULL);
256 *p = SysAllocString(value);
258 ERR("GetValue failed: %08lx\n", nsres);
261 nsAString_Finish(&value_str);
263 TRACE("value=%s\n", debugstr_w(value));
267 static HRESULT WINAPI HTMLSelectElement_put_disabled(IHTMLSelectElement *iface, VARIANT_BOOL v)
269 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
270 FIXME("(%p)->(%x)\n", This, v);
274 static HRESULT WINAPI HTMLSelectElement_get_disabled(IHTMLSelectElement *iface, VARIANT_BOOL *p)
276 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
277 FIXME("(%p)->(%p)\n", This, p);
281 static HRESULT WINAPI HTMLSelectElement_get_form(IHTMLSelectElement *iface, IHTMLFormElement **p)
283 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
284 FIXME("(%p)->(%p)\n", This, p);
288 static HRESULT WINAPI HTMLSelectElement_add(IHTMLSelectElement *iface, IHTMLElement *element,
291 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
292 FIXME("(%p)->(%p v)\n", This, element);
296 static HRESULT WINAPI HTMLSelectElement_remove(IHTMLSelectElement *iface, long index)
298 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
299 FIXME("(%p)->(%ld)\n", This, index);
303 static HRESULT WINAPI HTMLSelectElement_put_length(IHTMLSelectElement *iface, long v)
305 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
306 FIXME("(%p)->(%ld)\n", This, v);
310 static HRESULT WINAPI HTMLSelectElement_get_length(IHTMLSelectElement *iface, long *p)
312 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
313 FIXME("(%p)->(%p)\n", This, p);
317 static HRESULT WINAPI HTMLSelectElement_get__newEnum(IHTMLSelectElement *iface, IUnknown **p)
319 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
320 FIXME("(%p)->(%p)\n", This, p);
324 static HRESULT WINAPI HTMLSelectElement_item(IHTMLSelectElement *iface, VARIANT name,
325 VARIANT index, IDispatch **pdisp)
327 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
328 FIXME("(%p)->(v v %p)\n", This, pdisp);
332 static HRESULT WINAPI HTMLSelectElement_tags(IHTMLSelectElement *iface, VARIANT tagName,
335 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
336 FIXME("(%p)->(v %p)\n", This, pdisp);
340 static void HTMLSelectElement_destructor(IUnknown *iface)
342 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
344 nsIDOMHTMLSelectElement_Release(This->nsselect);
345 HeapFree(GetProcessHeap(), 0, This);
348 static const IHTMLSelectElementVtbl HTMLSelectElementVtbl = {
349 HTMLSelectElement_QueryInterface,
350 HTMLSelectElement_AddRef,
351 HTMLSelectElement_Release,
352 HTMLSelectElement_GetTypeInfoCount,
353 HTMLSelectElement_GetTypeInfo,
354 HTMLSelectElement_GetIDsOfNames,
355 HTMLSelectElement_Invoke,
356 HTMLSelectElement_put_size,
357 HTMLSelectElement_get_size,
358 HTMLSelectElement_put_multiple,
359 HTMLSelectElement_get_multiple,
360 HTMLSelectElement_put_name,
361 HTMLSelectElement_get_name,
362 HTMLSelectElement_get_options,
363 HTMLSelectElement_put_onchange,
364 HTMLSelectElement_get_onchange,
365 HTMLSelectElement_put_selectedIndex,
366 HTMLSelectElement_get_selectedIndex,
367 HTMLSelectElement_get_type,
368 HTMLSelectElement_put_value,
369 HTMLSelectElement_get_value,
370 HTMLSelectElement_put_disabled,
371 HTMLSelectElement_get_disabled,
372 HTMLSelectElement_get_form,
373 HTMLSelectElement_add,
374 HTMLSelectElement_remove,
375 HTMLSelectElement_put_length,
376 HTMLSelectElement_get_length,
377 HTMLSelectElement_get__newEnum,
378 HTMLSelectElement_item,
379 HTMLSelectElement_tags
382 void HTMLSelectElement_Create(HTMLElement *element)
384 HTMLSelectElement *ret = HeapAlloc(GetProcessHeap(), 0, sizeof(HTMLSelectElement));
387 ret->lpHTMLSelectElementVtbl = &HTMLSelectElementVtbl;
388 ret->element = element;
390 nsres = nsIDOMHTMLElement_QueryInterface(element->nselem, &IID_nsIDOMHTMLSelectElement,
391 (void**)&ret->nsselect);
393 ERR("Could not get nsIDOMHTMLSelectElement interfce: %08lx\n", nsres);
395 element->impl = (IUnknown*)HTMLSELECT(ret);
396 element->destructor = HTMLSelectElement_destructor;