explorer: add a navbar to explorer
[wine/gsoc_explorer.git] / dlls / mshtml / htmltablerow.c
blobee2c29548c63fd41c99d590ddd8c308524b29dfc
1 /*
2 * Copyright 2008 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 <stdarg.h>
21 #define COBJMACROS
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winuser.h"
26 #include "ole2.h"
28 #include "wine/debug.h"
30 #include "mshtml_private.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
34 typedef struct {
35 HTMLElement element;
37 IHTMLTableRow IHTMLTableRow_iface;
39 nsIDOMHTMLTableRowElement *nsrow;
40 } HTMLTableRow;
42 static inline HTMLTableRow *impl_from_IHTMLTableRow(IHTMLTableRow *iface)
44 return CONTAINING_RECORD(iface, HTMLTableRow, IHTMLTableRow_iface);
47 static HRESULT WINAPI HTMLTableRow_QueryInterface(IHTMLTableRow *iface,
48 REFIID riid, void **ppv)
50 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
52 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
55 static ULONG WINAPI HTMLTableRow_AddRef(IHTMLTableRow *iface)
57 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
59 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
62 static ULONG WINAPI HTMLTableRow_Release(IHTMLTableRow *iface)
64 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
66 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
69 static HRESULT WINAPI HTMLTableRow_GetTypeInfoCount(IHTMLTableRow *iface, UINT *pctinfo)
71 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
72 return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
75 static HRESULT WINAPI HTMLTableRow_GetTypeInfo(IHTMLTableRow *iface, UINT iTInfo,
76 LCID lcid, ITypeInfo **ppTInfo)
78 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
79 return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid,
80 ppTInfo);
83 static HRESULT WINAPI HTMLTableRow_GetIDsOfNames(IHTMLTableRow *iface, REFIID riid,
84 LPOLESTR *rgszNames, UINT cNames,
85 LCID lcid, DISPID *rgDispId)
87 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
88 return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
89 cNames, lcid, rgDispId);
92 static HRESULT WINAPI HTMLTableRow_Invoke(IHTMLTableRow *iface, DISPID dispIdMember,
93 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
94 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
96 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
97 return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
98 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
101 static HRESULT WINAPI HTMLTableRow_put_align(IHTMLTableRow *iface, BSTR v)
103 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
104 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
105 return E_NOTIMPL;
108 static HRESULT WINAPI HTMLTableRow_get_align(IHTMLTableRow *iface, BSTR *p)
110 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
111 FIXME("(%p)->(%p)\n", This, p);
112 return E_NOTIMPL;
115 static HRESULT WINAPI HTMLTableRow_put_vAlign(IHTMLTableRow *iface, BSTR v)
117 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
118 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
119 return E_NOTIMPL;
122 static HRESULT WINAPI HTMLTableRow_get_vAlign(IHTMLTableRow *iface, BSTR *p)
124 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
125 FIXME("(%p)->(%p)\n", This, p);
126 return E_NOTIMPL;
129 static HRESULT WINAPI HTMLTableRow_put_bgColor(IHTMLTableRow *iface, VARIANT v)
131 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
132 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
133 return E_NOTIMPL;
136 static HRESULT WINAPI HTMLTableRow_get_bgColor(IHTMLTableRow *iface, VARIANT *p)
138 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
139 FIXME("(%p)->(%p)\n", This, p);
140 return E_NOTIMPL;
143 static HRESULT WINAPI HTMLTableRow_put_borderColor(IHTMLTableRow *iface, VARIANT v)
145 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
146 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
147 return E_NOTIMPL;
150 static HRESULT WINAPI HTMLTableRow_get_borderColor(IHTMLTableRow *iface, VARIANT *p)
152 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
153 FIXME("(%p)->(%p)\n", This, p);
154 return E_NOTIMPL;
157 static HRESULT WINAPI HTMLTableRow_put_borderColorLight(IHTMLTableRow *iface, VARIANT v)
159 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
160 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
161 return E_NOTIMPL;
164 static HRESULT WINAPI HTMLTableRow_get_borderColorLight(IHTMLTableRow *iface, VARIANT *p)
166 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
167 FIXME("(%p)->(%p)\n", This, p);
168 return E_NOTIMPL;
171 static HRESULT WINAPI HTMLTableRow_put_borderColorDark(IHTMLTableRow *iface, VARIANT v)
173 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
174 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
175 return E_NOTIMPL;
178 static HRESULT WINAPI HTMLTableRow_get_borderColorDark(IHTMLTableRow *iface, VARIANT *p)
180 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
181 FIXME("(%p)->(%p)\n", This, p);
182 return E_NOTIMPL;
185 static HRESULT WINAPI HTMLTableRow_get_rowIndex(IHTMLTableRow *iface, LONG *p)
187 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
188 FIXME("(%p)->(%p)\n", This, p);
189 return E_NOTIMPL;
192 static HRESULT WINAPI HTMLTableRow_get_selectionRowIndex(IHTMLTableRow *iface, LONG *p)
194 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
195 FIXME("(%p)->(%p)\n", This, p);
196 return E_NOTIMPL;
199 static HRESULT WINAPI HTMLTableRow_get_cells(IHTMLTableRow *iface, IHTMLElementCollection **p)
201 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
202 nsIDOMHTMLCollection *nscol;
203 nsresult nsres;
205 TRACE("(%p)->(%p)\n", This, p);
207 nsres = nsIDOMHTMLTableRowElement_GetCells(This->nsrow, &nscol);
208 if(NS_FAILED(nsres)) {
209 ERR("GetCells failed: %08x\n", nsres);
210 return E_FAIL;
213 *p = create_collection_from_htmlcol(This->element.node.doc, (IUnknown*)&This->IHTMLTableRow_iface, nscol);
215 nsIDOMHTMLCollection_Release(nscol);
216 return S_OK;
219 static HRESULT WINAPI HTMLTableRow_insertCell(IHTMLTableRow *iface, LONG index, IDispatch **row)
221 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
222 FIXME("(%p)->(%d %p)\n", This, index, row);
223 return E_NOTIMPL;
226 static HRESULT WINAPI HTMLTableRow_deleteCell(IHTMLTableRow *iface, LONG index)
228 HTMLTableRow *This = impl_from_IHTMLTableRow(iface);
229 FIXME("(%p)->(%d)\n", This, index);
230 return E_NOTIMPL;
233 static const IHTMLTableRowVtbl HTMLTableRowVtbl = {
234 HTMLTableRow_QueryInterface,
235 HTMLTableRow_AddRef,
236 HTMLTableRow_Release,
237 HTMLTableRow_GetTypeInfoCount,
238 HTMLTableRow_GetTypeInfo,
239 HTMLTableRow_GetIDsOfNames,
240 HTMLTableRow_Invoke,
241 HTMLTableRow_put_align,
242 HTMLTableRow_get_align,
243 HTMLTableRow_put_vAlign,
244 HTMLTableRow_get_vAlign,
245 HTMLTableRow_put_bgColor,
246 HTMLTableRow_get_bgColor,
247 HTMLTableRow_put_borderColor,
248 HTMLTableRow_get_borderColor,
249 HTMLTableRow_put_borderColorLight,
250 HTMLTableRow_get_borderColorLight,
251 HTMLTableRow_put_borderColorDark,
252 HTMLTableRow_get_borderColorDark,
253 HTMLTableRow_get_rowIndex,
254 HTMLTableRow_get_selectionRowIndex,
255 HTMLTableRow_get_cells,
256 HTMLTableRow_insertCell,
257 HTMLTableRow_deleteCell
260 static inline HTMLTableRow *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
262 return CONTAINING_RECORD(iface, HTMLTableRow, element.node);
265 static HRESULT HTMLTableRow_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
267 HTMLTableRow *This = impl_from_HTMLDOMNode(iface);
269 *ppv = NULL;
271 if(IsEqualGUID(&IID_IUnknown, riid)) {
272 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
273 *ppv = &This->IHTMLTableRow_iface;
274 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
275 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
276 *ppv = &This->IHTMLTableRow_iface;
277 }else if(IsEqualGUID(&IID_IHTMLTableRow, riid)) {
278 TRACE("(%p)->(IID_IHTMLTableRow %p)\n", This, ppv);
279 *ppv = &This->IHTMLTableRow_iface;
282 if(*ppv) {
283 IUnknown_AddRef((IUnknown*)*ppv);
284 return S_OK;
287 return HTMLElement_QI(&This->element.node, riid, ppv);
290 static void HTMLTableRow_destructor(HTMLDOMNode *iface)
292 HTMLTableRow *This = impl_from_HTMLDOMNode(iface);
294 if(This->nsrow)
295 nsIDOMHTMLTableRowElement_Release(This->nsrow);
297 HTMLElement_destructor(&This->element.node);
300 static const NodeImplVtbl HTMLTableRowImplVtbl = {
301 HTMLTableRow_QI,
302 HTMLTableRow_destructor,
303 HTMLElement_clone
306 static const tid_t HTMLTableRow_iface_tids[] = {
307 HTMLELEMENT_TIDS,
308 IHTMLTableRow_tid,
312 static dispex_static_data_t HTMLTableRow_dispex = {
313 NULL,
314 DispHTMLTableRow_tid,
315 NULL,
316 HTMLTableRow_iface_tids
319 HRESULT HTMLTableRow_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
321 HTMLTableRow *ret;
322 nsresult nsres;
324 ret = heap_alloc_zero(sizeof(HTMLTableRow));
325 if(!ret)
326 return E_OUTOFMEMORY;
328 ret->IHTMLTableRow_iface.lpVtbl = &HTMLTableRowVtbl;
329 ret->element.node.vtbl = &HTMLTableRowImplVtbl;
331 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLTableRowElement, (void**)&ret->nsrow);
332 if(NS_FAILED(nsres)) {
333 ERR("Could not get nsIDOMHTMLTableRowElement iface: %08x\n", nsres);
334 heap_free(ret);
335 return E_OUTOFMEMORY;
338 HTMLElement_Init(&ret->element, doc, nselem, &HTMLTableRow_dispex);
340 *elem = &ret->element;
341 return S_OK;