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
28 #include "wine/debug.h"
30 #include "mshtml_private.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
36 IHTMLScreen IHTMLScreen_iface
;
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
;
60 WARN("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
64 IUnknown_AddRef((IUnknown
*)*ppv
);
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
);
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
);
86 release_dispex(&This
->dispex
);
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
,
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
);
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
);
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
);
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
);
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
);
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
);
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
);
181 static HRESULT WINAPI
HTMLScreen_get_availHeight(IHTMLScreen
*iface
, LONG
*p
)
183 HTMLScreen
*This
= impl_from_IHTMLScreen(iface
);
186 TRACE("(%p)->(%p)\n", This
, p
);
188 if(!SystemParametersInfoW(SPI_GETWORKAREA
, 0, &work_area
, 0))
191 *p
= work_area
.bottom
-work_area
.top
;
195 static HRESULT WINAPI
HTMLScreen_get_availWidth(IHTMLScreen
*iface
, LONG
*p
)
197 HTMLScreen
*This
= impl_from_IHTMLScreen(iface
);
200 TRACE("(%p)->(%p)\n", This
, p
);
202 if(!SystemParametersInfoW(SPI_GETWORKAREA
, 0, &work_area
, 0))
205 *p
= work_area
.right
-work_area
.left
;
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
);
216 static const IHTMLScreenVtbl HTMLSreenVtbl
= {
217 HTMLScreen_QueryInterface
,
220 HTMLScreen_GetTypeInfoCount
,
221 HTMLScreen_GetTypeInfo
,
222 HTMLScreen_GetIDsOfNames
,
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
[] = {
240 static dispex_static_data_t HTMLScreen_dispex
= {
244 HTMLScreen_iface_tids
247 HRESULT
HTMLScreen_Create(IHTMLScreen
**ret
)
251 screen
= heap_alloc_zero(sizeof(HTMLScreen
));
253 return E_OUTOFMEMORY
;
255 screen
->IHTMLScreen_iface
.lpVtbl
= &HTMLSreenVtbl
;
258 init_dispex(&screen
->dispex
, (IUnknown
*)&screen
->IHTMLScreen_iface
, &HTMLScreen_dispex
);
260 *ret
= &screen
->IHTMLScreen_iface
;