ReactOS 0.4.15-dev-7654-g6bc40d3
htmlscreen.c
Go to the documentation of this file.
1/*
2 * Copyright 2009 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 "mshtml_private.h"
20
21typedef struct {
23 IHTMLScreen IHTMLScreen_iface;
24
27
28static inline HTMLScreen *impl_from_IHTMLScreen(IHTMLScreen *iface)
29{
30 return CONTAINING_RECORD(iface, HTMLScreen, IHTMLScreen_iface);
31}
32
33static HRESULT WINAPI HTMLScreen_QueryInterface(IHTMLScreen *iface, REFIID riid, void **ppv)
34{
36
37 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
38
40 *ppv = &This->IHTMLScreen_iface;
41 }else if(IsEqualGUID(&IID_IHTMLScreen, riid)) {
42 *ppv = &This->IHTMLScreen_iface;
43 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
44 return *ppv ? S_OK : E_NOINTERFACE;
45 }else {
46 *ppv = NULL;
47 WARN("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
48 return E_NOINTERFACE;
49 }
50
51 IUnknown_AddRef((IUnknown*)*ppv);
52 return S_OK;
53}
54
55static ULONG WINAPI HTMLScreen_AddRef(IHTMLScreen *iface)
56{
59
60 TRACE("(%p) ref=%d\n", This, ref);
61
62 return ref;
63}
64
65static ULONG WINAPI HTMLScreen_Release(IHTMLScreen *iface)
66{
69
70 TRACE("(%p) ref=%d\n", This, ref);
71
72 if(!ref) {
73 release_dispex(&This->dispex);
75 }
76
77 return ref;
78}
79
80static HRESULT WINAPI HTMLScreen_GetTypeInfoCount(IHTMLScreen *iface, UINT *pctinfo)
81{
83 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
84}
85
86static HRESULT WINAPI HTMLScreen_GetTypeInfo(IHTMLScreen *iface, UINT iTInfo,
87 LCID lcid, ITypeInfo **ppTInfo)
88{
90 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
91}
92
94 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
95{
97 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
98 lcid, rgDispId);
99}
100
101static HRESULT WINAPI HTMLScreen_Invoke(IHTMLScreen *iface, DISPID dispIdMember,
102 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
103 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
104{
106 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
107 pDispParams, pVarResult, pExcepInfo, puArgErr);
108}
109
110static HRESULT WINAPI HTMLScreen_get_colorDepth(IHTMLScreen *iface, LONG *p)
111{
113
114 TRACE("(%p)->(%p)\n", This, p);
115
117 return S_OK;
118}
119
120static HRESULT WINAPI HTMLScreen_put_bufferDepth(IHTMLScreen *iface, LONG v)
121{
123 FIXME("(%p)->(%d)\n", This, v);
124 return E_NOTIMPL;
125}
126
127static HRESULT WINAPI HTMLScreen_get_bufferDepth(IHTMLScreen *iface, LONG *p)
128{
130 FIXME("(%p)->(%p)\n", This, p);
131 return E_NOTIMPL;
132}
133
134static HRESULT WINAPI HTMLScreen_get_width(IHTMLScreen *iface, LONG *p)
135{
137
138 TRACE("(%p)->(%p)\n", This, p);
139
141 return S_OK;
142}
143
144static HRESULT WINAPI HTMLScreen_get_height(IHTMLScreen *iface, LONG *p)
145{
147
148 TRACE("(%p)->(%p)\n", This, p);
149
151 return S_OK;
152}
153
155{
157 FIXME("(%p)->(%d)\n", This, v);
158 return E_NOTIMPL;
159}
160
162{
164 FIXME("(%p)->(%p)\n", This, p);
165 return E_NOTIMPL;
166}
167
168static HRESULT WINAPI HTMLScreen_get_availHeight(IHTMLScreen *iface, LONG *p)
169{
171 RECT work_area;
172
173 TRACE("(%p)->(%p)\n", This, p);
174
175 if(!SystemParametersInfoW(SPI_GETWORKAREA, 0, &work_area, 0))
176 return E_FAIL;
177
178 *p = work_area.bottom-work_area.top;
179 return S_OK;
180}
181
182static HRESULT WINAPI HTMLScreen_get_availWidth(IHTMLScreen *iface, LONG *p)
183{
185 RECT work_area;
186
187 TRACE("(%p)->(%p)\n", This, p);
188
189 if(!SystemParametersInfoW(SPI_GETWORKAREA, 0, &work_area, 0))
190 return E_FAIL;
191
192 *p = work_area.right-work_area.left;
193 return S_OK;
194}
195
197{
199 FIXME("(%p)->(%p)\n", This, p);
200 return E_NOTIMPL;
201}
202
203static const IHTMLScreenVtbl HTMLSreenVtbl = {
221};
222
223static const tid_t HTMLScreen_iface_tids[] = {
224 IHTMLScreen_tid,
225 0
226};
228 NULL,
229 DispHTMLScreen_tid,
230 NULL,
232};
233
235{
237
238 screen = heap_alloc_zero(sizeof(HTMLScreen));
239 if(!screen)
240 return E_OUTOFMEMORY;
241
242 screen->IHTMLScreen_iface.lpVtbl = &HTMLSreenVtbl;
243 screen->ref = 1;
244
245 init_dispex(&screen->dispex, (IUnknown*)&screen->IHTMLScreen_iface, &HTMLScreen_dispex);
246
247 *ret = &screen->IHTMLScreen_iface;
248 return S_OK;
249}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
const GUID IID_IUnknown
#define FIXME(fmt,...)
Definition: debug.h:111
#define WARN(fmt,...)
Definition: debug.h:112
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define NULL
Definition: types.h:112
short VARIANT_BOOL
Definition: compat.h:2290
const char * debugstr_mshtml_guid(const GUID *iid)
Definition: main.c:542
HDC get_display_dc(void)
Definition: main.c:173
unsigned short WORD
Definition: ntddk_ex.h:93
const GLdouble * v
Definition: gl.h:2040
GLfloat GLfloat p
Definition: glext.h:8902
static const IHTMLScreenVtbl HTMLSreenVtbl
Definition: htmlscreen.c:203
static HRESULT WINAPI HTMLScreen_QueryInterface(IHTMLScreen *iface, REFIID riid, void **ppv)
Definition: htmlscreen.c:33
static HRESULT WINAPI HTMLScreen_get_bufferDepth(IHTMLScreen *iface, LONG *p)
Definition: htmlscreen.c:127
static const tid_t HTMLScreen_iface_tids[]
Definition: htmlscreen.c:223
static HRESULT WINAPI HTMLScreen_get_availWidth(IHTMLScreen *iface, LONG *p)
Definition: htmlscreen.c:182
static HRESULT WINAPI HTMLScreen_get_availHeight(IHTMLScreen *iface, LONG *p)
Definition: htmlscreen.c:168
static ULONG WINAPI HTMLScreen_AddRef(IHTMLScreen *iface)
Definition: htmlscreen.c:55
static HRESULT WINAPI HTMLScreen_get_colorDepth(IHTMLScreen *iface, LONG *p)
Definition: htmlscreen.c:110
static dispex_static_data_t HTMLScreen_dispex
Definition: htmlscreen.c:227
static HRESULT WINAPI HTMLScreen_put_updateInterval(IHTMLScreen *iface, LONG v)
Definition: htmlscreen.c:154
static HTMLScreen * impl_from_IHTMLScreen(IHTMLScreen *iface)
Definition: htmlscreen.c:28
static HRESULT WINAPI HTMLScreen_put_bufferDepth(IHTMLScreen *iface, LONG v)
Definition: htmlscreen.c:120
static HRESULT WINAPI HTMLScreen_get_updateInterval(IHTMLScreen *iface, LONG *p)
Definition: htmlscreen.c:161
static HRESULT WINAPI HTMLScreen_get_height(IHTMLScreen *iface, LONG *p)
Definition: htmlscreen.c:144
static HRESULT WINAPI HTMLScreen_GetIDsOfNames(IHTMLScreen *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: htmlscreen.c:93
static HRESULT WINAPI HTMLScreen_get_fontSmoothingEnabled(IHTMLScreen *iface, VARIANT_BOOL *p)
Definition: htmlscreen.c:196
static HRESULT WINAPI HTMLScreen_Invoke(IHTMLScreen *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
Definition: htmlscreen.c:101
static HRESULT WINAPI HTMLScreen_GetTypeInfoCount(IHTMLScreen *iface, UINT *pctinfo)
Definition: htmlscreen.c:80
HRESULT HTMLScreen_Create(IHTMLScreen **ret)
Definition: htmlscreen.c:234
static ULONG WINAPI HTMLScreen_Release(IHTMLScreen *iface)
Definition: htmlscreen.c:65
static HRESULT WINAPI HTMLScreen_get_width(IHTMLScreen *iface, LONG *p)
Definition: htmlscreen.c:134
static HRESULT WINAPI HTMLScreen_GetTypeInfo(IHTMLScreen *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: htmlscreen.c:86
tid_t
Definition: ieframe.h:311
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
HRESULT init_dispex(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *prototype)
Definition: dispex.c:919
static LPOLESTR
Definition: stg_prop.c:27
static VARIANTARG static DISPID
Definition: ordinal.c:52
void release_dispex(DispatchEx *This)
Definition: dispex.c:1706
BOOL dispex_query_interface(DispatchEx *This, REFIID riid, void **ppv)
Definition: dispex.c:1656
unsigned int UINT
Definition: ndis.h:50
long LONG
Definition: pedump.c:60
char screen[SCREENY][SCREENX]
Definition: polytest.cpp:65
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
DWORD LCID
Definition: nls.h:13
#define TRACE(s)
Definition: solgame.cpp:4
LONG ref
Definition: htmlscreen.c:25
IHTMLScreen IHTMLScreen_iface
Definition: htmlscreen.c:23
DispatchEx dispex
Definition: htmlscreen.c:22
Definition: send.c:48
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
int ret
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:531
#define WINAPI
Definition: msvc.h:6
#define E_NOINTERFACE
Definition: winerror.h:2364
#define HORZRES
Definition: wingdi.h:716
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define VERTRES
Definition: wingdi.h:717
#define BITSPIXEL
Definition: wingdi.h:720
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)