ddraw: Don't allow setting palette on non root surfaces.
[wine/multimedia.git] / dlls / mshtml / htmlhead.c
blob69e4edfae8d78ebd4bf1d7161b62e44e57f58089
1 /*
2 * Copyright 2011 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 IHTMLTitleElement IHTMLTitleElement_iface;
38 } HTMLTitleElement;
40 static inline HTMLTitleElement *impl_from_IHTMLTitleElement(IHTMLTitleElement *iface)
42 return CONTAINING_RECORD(iface, HTMLTitleElement, IHTMLTitleElement_iface);
45 static HRESULT WINAPI HTMLTitleElement_QueryInterface(IHTMLTitleElement *iface,
46 REFIID riid, void **ppv)
48 HTMLTitleElement *This = impl_from_IHTMLTitleElement(iface);
50 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
53 static ULONG WINAPI HTMLTitleElement_AddRef(IHTMLTitleElement *iface)
55 HTMLTitleElement *This = impl_from_IHTMLTitleElement(iface);
57 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
60 static ULONG WINAPI HTMLTitleElement_Release(IHTMLTitleElement *iface)
62 HTMLTitleElement *This = impl_from_IHTMLTitleElement(iface);
64 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
67 static HRESULT WINAPI HTMLTitleElement_GetTypeInfoCount(IHTMLTitleElement *iface, UINT *pctinfo)
69 HTMLTitleElement *This = impl_from_IHTMLTitleElement(iface);
71 return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
74 static HRESULT WINAPI HTMLTitleElement_GetTypeInfo(IHTMLTitleElement *iface, UINT iTInfo,
75 LCID lcid, ITypeInfo **ppTInfo)
77 HTMLTitleElement *This = impl_from_IHTMLTitleElement(iface);
79 return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid,
80 ppTInfo);
83 static HRESULT WINAPI HTMLTitleElement_GetIDsOfNames(IHTMLTitleElement *iface, REFIID riid,
84 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
86 HTMLTitleElement *This = impl_from_IHTMLTitleElement(iface);
88 return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
89 cNames, lcid, rgDispId);
92 static HRESULT WINAPI HTMLTitleElement_Invoke(IHTMLTitleElement *iface, DISPID dispIdMember,
93 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
94 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
96 HTMLTitleElement *This = impl_from_IHTMLTitleElement(iface);
98 return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
99 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
102 static HRESULT WINAPI HTMLTitleElement_put_text(IHTMLTitleElement *iface, BSTR v)
104 HTMLTitleElement *This = impl_from_IHTMLTitleElement(iface);
105 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
106 return E_NOTIMPL;
109 static HRESULT WINAPI HTMLTitleElement_get_text(IHTMLTitleElement *iface, BSTR *p)
111 HTMLTitleElement *This = impl_from_IHTMLTitleElement(iface);
112 FIXME("(%p)->(%p)\n", This, p);
113 return E_NOTIMPL;
116 static const IHTMLTitleElementVtbl HTMLTitleElementVtbl = {
117 HTMLTitleElement_QueryInterface,
118 HTMLTitleElement_AddRef,
119 HTMLTitleElement_Release,
120 HTMLTitleElement_GetTypeInfoCount,
121 HTMLTitleElement_GetTypeInfo,
122 HTMLTitleElement_GetIDsOfNames,
123 HTMLTitleElement_Invoke,
124 HTMLTitleElement_put_text,
125 HTMLTitleElement_get_text
128 static inline HTMLTitleElement *HTMLTitleElement_from_HTMLDOMNode(HTMLDOMNode *iface)
130 return CONTAINING_RECORD(iface, HTMLTitleElement, element.node);
133 static HRESULT HTMLTitleElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
135 HTMLTitleElement *This = HTMLTitleElement_from_HTMLDOMNode(iface);
137 if(IsEqualGUID(&IID_IHTMLTitleElement, riid)) {
138 TRACE("(%p)->(IID_IHTMLTitleElement %p)\n", This, ppv);
139 *ppv = &This->IHTMLTitleElement_iface;
140 }else {
141 return HTMLElement_QI(&This->element.node, riid, ppv);
144 IUnknown_AddRef((IUnknown*)*ppv);
145 return S_OK;
148 static void HTMLTitleElement_destructor(HTMLDOMNode *iface)
150 HTMLTitleElement *This = HTMLTitleElement_from_HTMLDOMNode(iface);
152 HTMLElement_destructor(&This->element.node);
155 static const NodeImplVtbl HTMLTitleElementImplVtbl = {
156 HTMLTitleElement_QI,
157 HTMLTitleElement_destructor,
158 HTMLElement_clone,
161 static const tid_t HTMLTitleElement_iface_tids[] = {
162 HTMLELEMENT_TIDS,
163 IHTMLTitleElement_tid,
166 static dispex_static_data_t HTMLTitleElement_dispex = {
167 NULL,
168 DispHTMLTitleElement_tid,
169 NULL,
170 HTMLTitleElement_iface_tids
173 HRESULT HTMLTitleElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
175 HTMLTitleElement *ret;
177 ret = heap_alloc_zero(sizeof(*ret));
178 if(!ret)
179 return E_OUTOFMEMORY;
181 ret->IHTMLTitleElement_iface.lpVtbl = &HTMLTitleElementVtbl;
182 ret->element.node.vtbl = &HTMLTitleElementImplVtbl;
184 HTMLElement_Init(&ret->element, doc, nselem, &HTMLTitleElement_dispex);
186 *elem = &ret->element;
187 return S_OK;
190 typedef struct {
191 HTMLElement element;
193 IHTMLHeadElement IHTMLHeadElement_iface;
194 } HTMLHeadElement;
196 static inline HTMLHeadElement *impl_from_IHTMLHeadElement(IHTMLHeadElement *iface)
198 return CONTAINING_RECORD(iface, HTMLHeadElement, IHTMLHeadElement_iface);
201 static HRESULT WINAPI HTMLHeadElement_QueryInterface(IHTMLHeadElement *iface,
202 REFIID riid, void **ppv)
204 HTMLHeadElement *This = impl_from_IHTMLHeadElement(iface);
206 return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
209 static ULONG WINAPI HTMLHeadElement_AddRef(IHTMLHeadElement *iface)
211 HTMLHeadElement *This = impl_from_IHTMLHeadElement(iface);
213 return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
216 static ULONG WINAPI HTMLHeadElement_Release(IHTMLHeadElement *iface)
218 HTMLHeadElement *This = impl_from_IHTMLHeadElement(iface);
220 return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
223 static HRESULT WINAPI HTMLHeadElement_GetTypeInfoCount(IHTMLHeadElement *iface, UINT *pctinfo)
225 HTMLHeadElement *This = impl_from_IHTMLHeadElement(iface);
227 return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
230 static HRESULT WINAPI HTMLHeadElement_GetTypeInfo(IHTMLHeadElement *iface, UINT iTInfo,
231 LCID lcid, ITypeInfo **ppTInfo)
233 HTMLHeadElement *This = impl_from_IHTMLHeadElement(iface);
235 return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid,
236 ppTInfo);
239 static HRESULT WINAPI HTMLHeadElement_GetIDsOfNames(IHTMLHeadElement *iface, REFIID riid,
240 LPOLESTR *rgszNames, UINT cNames,
241 LCID lcid, DISPID *rgDispId)
243 HTMLHeadElement *This = impl_from_IHTMLHeadElement(iface);
245 return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
246 cNames, lcid, rgDispId);
249 static HRESULT WINAPI HTMLHeadElement_Invoke(IHTMLHeadElement *iface, DISPID dispIdMember,
250 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
251 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
253 HTMLHeadElement *This = impl_from_IHTMLHeadElement(iface);
255 return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
256 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
259 static HRESULT WINAPI HTMLHeadElement_put_profile(IHTMLHeadElement *iface, BSTR v)
261 HTMLHeadElement *This = impl_from_IHTMLHeadElement(iface);
262 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
263 return E_NOTIMPL;
266 static HRESULT WINAPI HTMLHeadElement_get_profile(IHTMLHeadElement *iface, BSTR *p)
268 HTMLHeadElement *This = impl_from_IHTMLHeadElement(iface);
269 FIXME("(%p)->(%p)\n", This, p);
270 return E_NOTIMPL;
273 static const IHTMLHeadElementVtbl HTMLHeadElementVtbl = {
274 HTMLHeadElement_QueryInterface,
275 HTMLHeadElement_AddRef,
276 HTMLHeadElement_Release,
277 HTMLHeadElement_GetTypeInfoCount,
278 HTMLHeadElement_GetTypeInfo,
279 HTMLHeadElement_GetIDsOfNames,
280 HTMLHeadElement_Invoke,
281 HTMLHeadElement_put_profile,
282 HTMLHeadElement_get_profile
285 static inline HTMLHeadElement *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
287 return CONTAINING_RECORD(iface, HTMLHeadElement, element.node);
290 static HRESULT HTMLHeadElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
292 HTMLHeadElement *This = impl_from_HTMLDOMNode(iface);
294 if(IsEqualGUID(&IID_IHTMLHeadElement, riid)) {
295 TRACE("(%p)->(IID_IHTMLHeadElement %p)\n", This, ppv);
296 *ppv = &This->IHTMLHeadElement_iface;
297 }else {
298 return HTMLElement_QI(&This->element.node, riid, ppv);
301 IUnknown_AddRef((IUnknown*)*ppv);
302 return S_OK;
305 static void HTMLHeadElement_destructor(HTMLDOMNode *iface)
307 HTMLHeadElement *This = impl_from_HTMLDOMNode(iface);
309 HTMLElement_destructor(&This->element.node);
312 static const NodeImplVtbl HTMLHeadElementImplVtbl = {
313 HTMLHeadElement_QI,
314 HTMLHeadElement_destructor,
315 HTMLElement_clone
318 static const tid_t HTMLHeadElement_iface_tids[] = {
319 HTMLELEMENT_TIDS,
320 IHTMLHeadElement_tid,
323 static dispex_static_data_t HTMLHeadElement_dispex = {
324 NULL,
325 DispHTMLHeadElement_tid,
326 NULL,
327 HTMLHeadElement_iface_tids
330 HRESULT HTMLHeadElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
332 HTMLHeadElement *ret;
334 ret = heap_alloc_zero(sizeof(*ret));
335 if(!ret)
336 return E_OUTOFMEMORY;
338 ret->IHTMLHeadElement_iface.lpVtbl = &HTMLHeadElementVtbl;
339 ret->element.node.vtbl = &HTMLHeadElementImplVtbl;
341 HTMLElement_Init(&ret->element, doc, nselem, &HTMLHeadElement_dispex);
343 *elem = &ret->element;
344 return S_OK;