wintrust: Add a helper function to initialize chain creation parameters.
[wine] / dlls / mshtml / htmloption.c
1 /*
2  * Copyright 2007 Jacek Caban for CodeWeavers
3  *
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.
8  *
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.
13  *
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
17  */
18
19 #include "config.h"
20
21 #include <stdarg.h>
22 #include <stdio.h>
23
24 #define COBJMACROS
25
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winuser.h"
29 #include "winnls.h"
30 #include "ole2.h"
31
32 #include "wine/debug.h"
33
34 #include "mshtml_private.h"
35
36 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
37
38 typedef struct {
39     HTMLElement element;
40
41     const IHTMLOptionElementVtbl *lpHTMLOptionElementVtbl;
42 } HTMLOptionElement;
43
44 #define HTMLOPTION(x)  ((IHTMLOptionElement*)  &(x)->lpHTMLOptionElementVtbl)
45
46 #define HTMLOPTION_THIS(iface) DEFINE_THIS(HTMLOptionElement, HTMLOptionElement, iface)
47
48 static HRESULT WINAPI HTMLOptionElement_QueryInterface(IHTMLOptionElement *iface,
49         REFIID riid, void **ppv)
50 {
51     HTMLOptionElement *This = HTMLOPTION_THIS(iface);
52
53     return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->element.node), riid, ppv);
54 }
55
56 static ULONG WINAPI HTMLOptionElement_AddRef(IHTMLOptionElement *iface)
57 {
58     HTMLOptionElement *This = HTMLOPTION_THIS(iface);
59
60     return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->element.node));
61 }
62
63 static ULONG WINAPI HTMLOptionElement_Release(IHTMLOptionElement *iface)
64 {
65     HTMLOptionElement *This = HTMLOPTION_THIS(iface);
66
67     return IHTMLDOMNode_Release(HTMLDOMNODE(&This->element.node));
68 }
69
70 static HRESULT WINAPI HTMLOptionElement_GetTypeInfoCount(IHTMLOptionElement *iface, UINT *pctinfo)
71 {
72     HTMLOptionElement *This = HTMLOPTION_THIS(iface);
73     FIXME("(%p)->(%p)\n", This, pctinfo);
74     return E_NOTIMPL;
75 }
76
77 static HRESULT WINAPI HTMLOptionElement_GetTypeInfo(IHTMLOptionElement *iface, UINT iTInfo,
78                                               LCID lcid, ITypeInfo **ppTInfo)
79 {
80     HTMLOptionElement *This = HTMLOPTION_THIS(iface);
81     FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
82     return E_NOTIMPL;
83 }
84
85 static HRESULT WINAPI HTMLOptionElement_GetIDsOfNames(IHTMLOptionElement *iface, REFIID riid,
86                                                 LPOLESTR *rgszNames, UINT cNames,
87                                                 LCID lcid, DISPID *rgDispId)
88 {
89     HTMLOptionElement *This = HTMLOPTION_THIS(iface);
90     FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
91                                         lcid, rgDispId);
92     return E_NOTIMPL;
93 }
94
95 static HRESULT WINAPI HTMLOptionElement_Invoke(IHTMLOptionElement *iface, DISPID dispIdMember,
96                             REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
97                             VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
98 {
99     HTMLOptionElement *This = HTMLOPTION_THIS(iface);
100     FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
101             lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
102     return E_NOTIMPL;
103 }
104
105 static HRESULT WINAPI HTMLOptionElement_put_selected(IHTMLOptionElement *iface, VARIANT_BOOL v)
106 {
107     HTMLOptionElement *This = HTMLOPTION_THIS(iface);
108     FIXME("(%p)->(%x)\n", This, v);
109     return E_NOTIMPL;
110 }
111
112 static HRESULT WINAPI HTMLOptionElement_get_selected(IHTMLOptionElement *iface, VARIANT_BOOL *p)
113 {
114     HTMLOptionElement *This = HTMLOPTION_THIS(iface);
115     FIXME("(%p)->(%p)\n", This, p);
116     return E_NOTIMPL;
117 }
118
119 static HRESULT WINAPI HTMLOptionElement_put_value(IHTMLOptionElement *iface, BSTR v)
120 {
121     HTMLOptionElement *This = HTMLOPTION_THIS(iface);
122     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
123     return E_NOTIMPL;
124 }
125
126 static HRESULT WINAPI HTMLOptionElement_get_value(IHTMLOptionElement *iface, BSTR *p)
127 {
128     HTMLOptionElement *This = HTMLOPTION_THIS(iface);
129     FIXME("(%p)->(%p)\n", This, p);
130     return E_NOTIMPL;
131 }
132
133 static HRESULT WINAPI HTMLOptionElement_put_defaultSelected(IHTMLOptionElement *iface, VARIANT_BOOL v)
134 {
135     HTMLOptionElement *This = HTMLOPTION_THIS(iface);
136     FIXME("(%p)->(%x)\n", This, v);
137     return E_NOTIMPL;
138 }
139
140 static HRESULT WINAPI HTMLOptionElement_get_defaultSelected(IHTMLOptionElement *iface, VARIANT_BOOL *p)
141 {
142     HTMLOptionElement *This = HTMLOPTION_THIS(iface);
143     FIXME("(%p)->(%p)\n", This, p);
144     return E_NOTIMPL;
145 }
146
147 static HRESULT WINAPI HTMLOptionElement_put_index(IHTMLOptionElement *iface, LONG v)
148 {
149     HTMLOptionElement *This = HTMLOPTION_THIS(iface);
150     FIXME("(%p)->(%d)\n", This, v);
151     return E_NOTIMPL;
152 }
153
154 static HRESULT WINAPI HTMLOptionElement_get_index(IHTMLOptionElement *iface, LONG *p)
155 {
156     HTMLOptionElement *This = HTMLOPTION_THIS(iface);
157     FIXME("(%p)->(%p)\n", This, p);
158     return E_NOTIMPL;
159 }
160
161 static HRESULT WINAPI HTMLOptionElement_put_text(IHTMLOptionElement *iface, BSTR v)
162 {
163     HTMLOptionElement *This = HTMLOPTION_THIS(iface);
164     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
165     return E_NOTIMPL;
166 }
167
168 static HRESULT WINAPI HTMLOptionElement_get_text(IHTMLOptionElement *iface, BSTR *p)
169 {
170     HTMLOptionElement *This = HTMLOPTION_THIS(iface);
171     FIXME("(%p)->(%p)\n", This, p);
172     return E_NOTIMPL;
173 }
174
175 static HRESULT WINAPI HTMLOptionElement_get_form(IHTMLOptionElement *iface, IHTMLFormElement **p)
176 {
177     HTMLOptionElement *This = HTMLOPTION_THIS(iface);
178     FIXME("(%p)->(%p)\n", This, p);
179     return E_NOTIMPL;
180 }
181
182 #undef HTMLOPTION_THIS
183
184 static const IHTMLOptionElementVtbl HTMLOptionElementVtbl = {
185     HTMLOptionElement_QueryInterface,
186     HTMLOptionElement_AddRef,
187     HTMLOptionElement_Release,
188     HTMLOptionElement_GetTypeInfoCount,
189     HTMLOptionElement_GetTypeInfo,
190     HTMLOptionElement_GetIDsOfNames,
191     HTMLOptionElement_Invoke,
192     HTMLOptionElement_put_selected,
193     HTMLOptionElement_get_selected,
194     HTMLOptionElement_put_value,
195     HTMLOptionElement_get_value,
196     HTMLOptionElement_put_defaultSelected,
197     HTMLOptionElement_get_defaultSelected,
198     HTMLOptionElement_put_index,
199     HTMLOptionElement_get_index,
200     HTMLOptionElement_put_text,
201     HTMLOptionElement_get_text,
202     HTMLOptionElement_get_form
203 };
204
205 #define HTMLOPTION_NODE_THIS(iface) DEFINE_THIS2(HTMLOptionElement, element.node, iface)
206
207 static HRESULT HTMLOptionElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
208 {
209     HTMLOptionElement *This = HTMLOPTION_NODE_THIS(iface);
210
211     *ppv = NULL;
212
213     if(IsEqualGUID(&IID_IUnknown, riid)) {
214         TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
215         *ppv = HTMLOPTION(This);
216     }else if(IsEqualGUID(&IID_IDispatch, riid)) {
217         TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
218         *ppv = HTMLOPTION(This);
219     }else if(IsEqualGUID(&IID_IHTMLOptionElement, riid)) {
220         TRACE("(%p)->(IID_IHTMLOptionElement %p)\n", This, ppv);
221         *ppv = HTMLOPTION(This);
222     }
223
224     if(*ppv) {
225         IUnknown_AddRef((IUnknown*)*ppv);
226         return S_OK;
227     }
228
229     return HTMLElement_QI(&This->element.node, riid, ppv);
230 }
231
232 static void HTMLOptionElement_destructor(HTMLDOMNode *iface)
233 {
234     HTMLOptionElement *This = HTMLOPTION_NODE_THIS(iface);
235     HTMLElement_destructor(&This->element.node);
236 }
237
238 #undef HTMLOPTION_NODE_THIS
239
240 static const NodeImplVtbl HTMLOptionElementImplVtbl = {
241     HTMLOptionElement_QI,
242     HTMLOptionElement_destructor
243 };
244
245 HTMLElement *HTMLOptionElement_Create(nsIDOMHTMLElement *nselem)
246 {
247     HTMLOptionElement *ret = mshtml_alloc(sizeof(HTMLOptionElement));
248
249     ret->lpHTMLOptionElementVtbl = &HTMLOptionElementVtbl;
250     ret->element.node.vtbl = &HTMLOptionElementImplVtbl;
251
252     return &ret->element;
253 }