winhttp/tests: Send a not empty payload in the server authorization response, check...
[wine/multimedia.git] / dlls / mshtml / htmlscreen.c
blob5e5129996b34e5c04e9d75571fc8bf45663f8985
1 /*
2 * Copyright 2009 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 DispatchEx dispex;
36 IHTMLScreen IHTMLScreen_iface;
38 LONG ref;
39 } HTMLScreen;
41 static inline HTMLScreen *impl_from_IHTMLScreen(IHTMLScreen *iface)
43 return CONTAINING_RECORD(iface, HTMLScreen, IHTMLScreen_iface);
46 static HRESULT WINAPI HTMLScreen_QueryInterface(IHTMLScreen *iface, REFIID riid, void **ppv)
48 HTMLScreen *This = impl_from_IHTMLScreen(iface);
50 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
52 if(IsEqualGUID(&IID_IUnknown, riid)) {
53 *ppv = &This->IHTMLScreen_iface;
54 }else if(IsEqualGUID(&IID_IHTMLScreen, riid)) {
55 *ppv = &This->IHTMLScreen_iface;
56 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
57 return *ppv ? S_OK : E_NOINTERFACE;
58 }else {
59 *ppv = NULL;
60 WARN("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
61 return E_NOINTERFACE;
64 IUnknown_AddRef((IUnknown*)*ppv);
65 return S_OK;
68 static ULONG WINAPI HTMLScreen_AddRef(IHTMLScreen *iface)
70 HTMLScreen *This = impl_from_IHTMLScreen(iface);
71 LONG ref = InterlockedIncrement(&This->ref);
73 TRACE("(%p) ref=%d\n", This, ref);
75 return ref;
78 static ULONG WINAPI HTMLScreen_Release(IHTMLScreen *iface)
80 HTMLScreen *This = impl_from_IHTMLScreen(iface);
81 LONG ref = InterlockedDecrement(&This->ref);
83 TRACE("(%p) ref=%d\n", This, ref);
85 if(!ref) {
86 release_dispex(&This->dispex);
87 heap_free(This);
90 return ref;
93 static HRESULT WINAPI HTMLScreen_GetTypeInfoCount(IHTMLScreen *iface, UINT *pctinfo)
95 HTMLScreen *This = impl_from_IHTMLScreen(iface);
96 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
99 static HRESULT WINAPI HTMLScreen_GetTypeInfo(IHTMLScreen *iface, UINT iTInfo,
100 LCID lcid, ITypeInfo **ppTInfo)
102 HTMLScreen *This = impl_from_IHTMLScreen(iface);
103 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
106 static HRESULT WINAPI HTMLScreen_GetIDsOfNames(IHTMLScreen *iface, REFIID riid,
107 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
109 HTMLScreen *This = impl_from_IHTMLScreen(iface);
110 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
111 lcid, rgDispId);
114 static HRESULT WINAPI HTMLScreen_Invoke(IHTMLScreen *iface, DISPID dispIdMember,
115 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
116 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
118 HTMLScreen *This = impl_from_IHTMLScreen(iface);
119 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
120 pDispParams, pVarResult, pExcepInfo, puArgErr);
123 static HRESULT WINAPI HTMLScreen_get_colorDepth(IHTMLScreen *iface, LONG *p)
125 HTMLScreen *This = impl_from_IHTMLScreen(iface);
127 TRACE("(%p)->(%p)\n", This, p);
129 *p = GetDeviceCaps(get_display_dc(), BITSPIXEL);
130 return S_OK;
133 static HRESULT WINAPI HTMLScreen_put_bufferDepth(IHTMLScreen *iface, LONG v)
135 HTMLScreen *This = impl_from_IHTMLScreen(iface);
136 FIXME("(%p)->(%d)\n", This, v);
137 return E_NOTIMPL;
140 static HRESULT WINAPI HTMLScreen_get_bufferDepth(IHTMLScreen *iface, LONG *p)
142 HTMLScreen *This = impl_from_IHTMLScreen(iface);
143 FIXME("(%p)->(%p)\n", This, p);
144 return E_NOTIMPL;
147 static HRESULT WINAPI HTMLScreen_get_width(IHTMLScreen *iface, LONG *p)
149 HTMLScreen *This = impl_from_IHTMLScreen(iface);
151 TRACE("(%p)->(%p)\n", This, p);
153 *p = GetDeviceCaps(get_display_dc(), HORZRES);
154 return S_OK;
157 static HRESULT WINAPI HTMLScreen_get_height(IHTMLScreen *iface, LONG *p)
159 HTMLScreen *This = impl_from_IHTMLScreen(iface);
161 TRACE("(%p)->(%p)\n", This, p);
163 *p = GetDeviceCaps(get_display_dc(), VERTRES);
164 return S_OK;
167 static HRESULT WINAPI HTMLScreen_put_updateInterval(IHTMLScreen *iface, LONG v)
169 HTMLScreen *This = impl_from_IHTMLScreen(iface);
170 FIXME("(%p)->(%d)\n", This, v);
171 return E_NOTIMPL;
174 static HRESULT WINAPI HTMLScreen_get_updateInterval(IHTMLScreen *iface, LONG *p)
176 HTMLScreen *This = impl_from_IHTMLScreen(iface);
177 FIXME("(%p)->(%p)\n", This, p);
178 return E_NOTIMPL;
181 static HRESULT WINAPI HTMLScreen_get_availHeight(IHTMLScreen *iface, LONG *p)
183 HTMLScreen *This = impl_from_IHTMLScreen(iface);
184 RECT work_area;
186 TRACE("(%p)->(%p)\n", This, p);
188 if(!SystemParametersInfoW(SPI_GETWORKAREA, 0, &work_area, 0))
189 return E_FAIL;
191 *p = work_area.bottom-work_area.top;
192 return S_OK;
195 static HRESULT WINAPI HTMLScreen_get_availWidth(IHTMLScreen *iface, LONG *p)
197 HTMLScreen *This = impl_from_IHTMLScreen(iface);
198 RECT work_area;
200 TRACE("(%p)->(%p)\n", This, p);
202 if(!SystemParametersInfoW(SPI_GETWORKAREA, 0, &work_area, 0))
203 return E_FAIL;
205 *p = work_area.right-work_area.left;
206 return S_OK;
209 static HRESULT WINAPI HTMLScreen_get_fontSmoothingEnabled(IHTMLScreen *iface, VARIANT_BOOL *p)
211 HTMLScreen *This = impl_from_IHTMLScreen(iface);
212 FIXME("(%p)->(%p)\n", This, p);
213 return E_NOTIMPL;
216 static const IHTMLScreenVtbl HTMLSreenVtbl = {
217 HTMLScreen_QueryInterface,
218 HTMLScreen_AddRef,
219 HTMLScreen_Release,
220 HTMLScreen_GetTypeInfoCount,
221 HTMLScreen_GetTypeInfo,
222 HTMLScreen_GetIDsOfNames,
223 HTMLScreen_Invoke,
224 HTMLScreen_get_colorDepth,
225 HTMLScreen_put_bufferDepth,
226 HTMLScreen_get_bufferDepth,
227 HTMLScreen_get_width,
228 HTMLScreen_get_height,
229 HTMLScreen_put_updateInterval,
230 HTMLScreen_get_updateInterval,
231 HTMLScreen_get_availHeight,
232 HTMLScreen_get_availWidth,
233 HTMLScreen_get_fontSmoothingEnabled
236 static const tid_t HTMLScreen_iface_tids[] = {
237 IHTMLScreen_tid,
240 static dispex_static_data_t HTMLScreen_dispex = {
241 NULL,
242 DispHTMLScreen_tid,
243 NULL,
244 HTMLScreen_iface_tids
247 HRESULT HTMLScreen_Create(IHTMLScreen **ret)
249 HTMLScreen *screen;
251 screen = heap_alloc_zero(sizeof(HTMLScreen));
252 if(!screen)
253 return E_OUTOFMEMORY;
255 screen->IHTMLScreen_iface.lpVtbl = &HTMLSreenVtbl;
256 screen->ref = 1;
258 init_dispex(&screen->dispex, (IUnknown*)&screen->IHTMLScreen_iface, &HTMLScreen_dispex);
260 *ret = &screen->IHTMLScreen_iface;
261 return S_OK;