mshtml: Fix debug traces.
[wine/wine-kai.git] / dlls / mshtml / htmlselect.c
blobce1b40be05c5d1afcc845ad739ab4e8f04c30da9
1 /*
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
19 #include "config.h"
21 #include <stdarg.h>
22 #include <stdio.h>
24 #define COBJMACROS
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winuser.h"
29 #include "winnls.h"
30 #include "ole2.h"
32 #include "wine/debug.h"
34 #include "mshtml_private.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
38 typedef struct {
39 const IHTMLSelectElementVtbl *lpHTMLSelectElementVtbl;
41 HTMLElement *element;
42 nsIDOMHTMLSelectElement *nsselect;
43 } HTMLSelectElement;
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);
53 HRESULT hres;
55 *ppv = NULL;
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);
68 if(*ppv) {
69 IUnknown_AddRef((IUnknown*)*ppv);
70 return S_OK;
73 hres = HTMLElement_QI(This->element, riid, ppv);
74 if(FAILED(hres))
75 WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
77 return hres;
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);
102 return E_NOTIMPL;
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 %u %p)\n", This, iTInfo, lcid, ppTInfo);
110 return E_NOTIMPL;
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 %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
119 lcid, rgDispId);
120 return E_NOTIMPL;
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)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
129 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
130 return E_NOTIMPL;
133 static HRESULT WINAPI HTMLSelectElement_put_size(IHTMLSelectElement *iface, long v)
135 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
136 FIXME("(%p)->(%ld)\n", This, v);
137 return E_NOTIMPL;
140 static HRESULT WINAPI HTMLSelectElement_get_size(IHTMLSelectElement *iface, long *p)
142 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
143 FIXME("(%p)->(%p)\n", This, p);
144 return E_NOTIMPL;
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);
151 return E_NOTIMPL;
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);
158 return E_NOTIMPL;
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));
165 return E_NOTIMPL;
168 static HRESULT WINAPI HTMLSelectElement_get_name(IHTMLSelectElement *iface, BSTR *p)
170 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
171 nsAString name_str;
172 const PRUnichar *name = NULL;
173 nsresult nsres;
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);
183 }else {
184 ERR("GetName failed: %08x\n", nsres);
187 nsAString_Finish(&name_str);
189 TRACE("name=%s\n", debugstr_w(*p));
190 return S_OK;
193 static HRESULT WINAPI HTMLSelectElement_get_options(IHTMLSelectElement *iface, IDispatch **p)
195 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
196 FIXME("(%p)->(%p)\n", This, p);
197 return E_NOTIMPL;
200 static HRESULT WINAPI HTMLSelectElement_put_onchange(IHTMLSelectElement *iface, VARIANT v)
202 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
203 FIXME("(%p)->()\n", This);
204 return E_NOTIMPL;
207 static HRESULT WINAPI HTMLSelectElement_get_onchange(IHTMLSelectElement *iface, VARIANT *p)
209 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
210 FIXME("(%p)->(%p)\n", This, p);
211 return E_NOTIMPL;
214 static HRESULT WINAPI HTMLSelectElement_put_selectedIndex(IHTMLSelectElement *iface, long v)
216 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
217 FIXME("(%p)->(%ld)\n", This, v);
218 return E_NOTIMPL;
221 static HRESULT WINAPI HTMLSelectElement_get_selectedIndex(IHTMLSelectElement *iface, long *p)
223 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
224 FIXME("(%p)->(%p)\n", This, p);
225 return E_NOTIMPL;
228 static HRESULT WINAPI HTMLSelectElement_get_type(IHTMLSelectElement *iface, BSTR *p)
230 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
231 FIXME("(%p)->(%p)\n", This, p);
232 return E_NOTIMPL;
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));
239 return E_NOTIMPL;
242 static HRESULT WINAPI HTMLSelectElement_get_value(IHTMLSelectElement *iface, BSTR *p)
244 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
245 nsAString value_str;
246 const PRUnichar *value = NULL;
247 nsresult nsres;
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);
257 }else {
258 ERR("GetValue failed: %08x\n", nsres);
261 nsAString_Finish(&value_str);
263 TRACE("value=%s\n", debugstr_w(*p));
264 return S_OK;
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);
271 return E_NOTIMPL;
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);
278 return E_NOTIMPL;
281 static HRESULT WINAPI HTMLSelectElement_get_form(IHTMLSelectElement *iface, IHTMLFormElement **p)
283 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
284 FIXME("(%p)->(%p)\n", This, p);
285 return E_NOTIMPL;
288 static HRESULT WINAPI HTMLSelectElement_add(IHTMLSelectElement *iface, IHTMLElement *element,
289 VARIANT before)
291 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
292 FIXME("(%p)->(%p v)\n", This, element);
293 return E_NOTIMPL;
296 static HRESULT WINAPI HTMLSelectElement_remove(IHTMLSelectElement *iface, long index)
298 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
299 FIXME("(%p)->(%ld)\n", This, index);
300 return E_NOTIMPL;
303 static HRESULT WINAPI HTMLSelectElement_put_length(IHTMLSelectElement *iface, long v)
305 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
306 FIXME("(%p)->(%ld)\n", This, v);
307 return E_NOTIMPL;
310 static HRESULT WINAPI HTMLSelectElement_get_length(IHTMLSelectElement *iface, long *p)
312 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
313 FIXME("(%p)->(%p)\n", This, p);
314 return E_NOTIMPL;
317 static HRESULT WINAPI HTMLSelectElement_get__newEnum(IHTMLSelectElement *iface, IUnknown **p)
319 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
320 FIXME("(%p)->(%p)\n", This, p);
321 return E_NOTIMPL;
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);
329 return E_NOTIMPL;
332 static HRESULT WINAPI HTMLSelectElement_tags(IHTMLSelectElement *iface, VARIANT tagName,
333 IDispatch **pdisp)
335 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
336 FIXME("(%p)->(v %p)\n", This, pdisp);
337 return E_NOTIMPL;
340 static void HTMLSelectElement_destructor(IUnknown *iface)
342 HTMLSelectElement *This = HTMLSELECT_THIS(iface);
344 nsIDOMHTMLSelectElement_Release(This->nsselect);
345 mshtml_free(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 = mshtml_alloc(sizeof(HTMLSelectElement));
385 nsresult nsres;
387 ret->lpHTMLSelectElementVtbl = &HTMLSelectElementVtbl;
388 ret->element = element;
390 nsres = nsIDOMHTMLElement_QueryInterface(element->nselem, &IID_nsIDOMHTMLSelectElement,
391 (void**)&ret->nsselect);
392 if(NS_FAILED(nsres))
393 ERR("Could not get nsIDOMHTMLSelectElement interfce: %08x\n", nsres);
395 element->impl = (IUnknown*)HTMLSELECT(ret);
396 element->destructor = HTMLSelectElement_destructor;