ReactOS  0.4.13-dev-544-gede3fdd
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 
21 typedef struct {
23  IHTMLScreen IHTMLScreen_iface;
24 
26 } HTMLScreen;
27 
28 static inline HTMLScreen *impl_from_IHTMLScreen(IHTMLScreen *iface)
29 {
30  return CONTAINING_RECORD(iface, HTMLScreen, IHTMLScreen_iface);
31 }
32 
33 static 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 
55 static ULONG WINAPI HTMLScreen_AddRef(IHTMLScreen *iface)
56 {
59 
60  TRACE("(%p) ref=%d\n", This, ref);
61 
62  return ref;
63 }
64 
65 static 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);
74  heap_free(This);
75  }
76 
77  return ref;
78 }
79 
80 static HRESULT WINAPI HTMLScreen_GetTypeInfoCount(IHTMLScreen *iface, UINT *pctinfo)
81 {
83  return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
84 }
85 
86 static 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 
93 static HRESULT WINAPI HTMLScreen_GetIDsOfNames(IHTMLScreen *iface, REFIID riid,
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 
101 static 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 
110 static 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 
120 static HRESULT WINAPI HTMLScreen_put_bufferDepth(IHTMLScreen *iface, LONG v)
121 {
123  FIXME("(%p)->(%d)\n", This, v);
124  return E_NOTIMPL;
125 }
126 
127 static HRESULT WINAPI HTMLScreen_get_bufferDepth(IHTMLScreen *iface, LONG *p)
128 {
130  FIXME("(%p)->(%p)\n", This, p);
131  return E_NOTIMPL;
132 }
133 
134 static 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 
144 static 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 
154 static HRESULT WINAPI HTMLScreen_put_updateInterval(IHTMLScreen *iface, LONG v)
155 {
157  FIXME("(%p)->(%d)\n", This, v);
158  return E_NOTIMPL;
159 }
160 
161 static HRESULT WINAPI HTMLScreen_get_updateInterval(IHTMLScreen *iface, LONG *p)
162 {
164  FIXME("(%p)->(%p)\n", This, p);
165  return E_NOTIMPL;
166 }
167 
168 static 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 
182 static 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 
203 static const IHTMLScreenVtbl HTMLSreenVtbl = {
221 };
222 
223 static 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 HRESULT WINAPI HTMLScreen_get_width(IHTMLScreen *iface, LONG *p)
Definition: htmlscreen.c:134
static ULONG WINAPI HTMLScreen_Release(IHTMLScreen *iface)
Definition: htmlscreen.c:65
#define BITSPIXEL
Definition: wingdi.h:719
#define HORZRES
Definition: wingdi.h:715
#define REFIID
Definition: guiddef.h:113
#define E_NOINTERFACE
Definition: winerror.h:2364
static dispex_static_data_t HTMLScreen_dispex
Definition: htmlscreen.c:227
REFIID riid
Definition: precomp.h:44
tid_t
Definition: ieframe.h:311
static HRESULT WINAPI HTMLScreen_GetTypeInfoCount(IHTMLScreen *iface, UINT *pctinfo)
Definition: htmlscreen.c:80
#define WARN(fmt,...)
Definition: debug.h:111
static ULONG WINAPI HTMLScreen_AddRef(IHTMLScreen *iface)
Definition: htmlscreen.c:55
static HRESULT WINAPI HTMLScreen_put_updateInterval(IHTMLScreen *iface, LONG v)
Definition: htmlscreen.c:154
REFIID LPVOID * ppv
Definition: atlbase.h:39
LONG top
Definition: windef.h:292
LONG ref
Definition: htmlscreen.c:25
DWORD LCID
Definition: nls.h:13
LONG left
Definition: windef.h:291
static LPOLESTR
Definition: stg_prop.c:27
LONG right
Definition: windef.h:293
#define E_FAIL
Definition: ddrawi.h:102
short VARIANT_BOOL
Definition: compat.h:1931
static HRESULT WINAPI HTMLScreen_QueryInterface(IHTMLScreen *iface, REFIID riid, void **ppv)
Definition: htmlscreen.c:33
Definition: send.c:47
const char * debugstr_mshtml_guid(const GUID *iid)
Definition: main.c:535
DispatchEx dispex
Definition: htmlscreen.c:22
static HRESULT WINAPI HTMLScreen_GetTypeInfo(IHTMLScreen *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: htmlscreen.c:86
HRESULT HTMLScreen_Create(IHTMLScreen **ret)
Definition: htmlscreen.c:234
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static HRESULT WINAPI HTMLScreen_get_availWidth(IHTMLScreen *iface, LONG *p)
Definition: htmlscreen.c:182
long LONG
Definition: pedump.c:60
static HRESULT WINAPI HTMLScreen_get_bufferDepth(IHTMLScreen *iface, LONG *p)
Definition: htmlscreen.c:127
GLenum GLint ref
Definition: glext.h:6028
#define FIXME(fmt,...)
Definition: debug.h:110
IHTMLScreen IHTMLScreen_iface
Definition: htmlscreen.c:23
smooth NULL
Definition: ftsmooth.c:416
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
BOOL WINAPI SystemParametersInfoW(_In_ UINT, _In_ UINT, _Inout_opt_ PVOID, _In_ UINT)
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
#define WINAPI
Definition: msvc.h:8
static HRESULT WINAPI HTMLScreen_get_colorDepth(IHTMLScreen *iface, LONG *p)
Definition: htmlscreen.c:110
unsigned short WORD
Definition: ntddk_ex.h:93
static HRESULT WINAPI HTMLScreen_get_fontSmoothingEnabled(IHTMLScreen *iface, VARIANT_BOOL *p)
Definition: htmlscreen.c:196
static const IHTMLScreenVtbl HTMLSreenVtbl
Definition: htmlscreen.c:203
int ret
#define InterlockedDecrement
Definition: armddk.h:52
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
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
char screen[SCREENY][SCREENX]
Definition: polytest.cpp:65
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:519
static HTMLScreen * impl_from_IHTMLScreen(IHTMLScreen *iface)
Definition: htmlscreen.c:28
struct stdole::EXCEPINFO EXCEPINFO
static VARIANTARG static DISPID
Definition: ordinal.c:49
#define S_OK
Definition: intsafe.h:59
#define InterlockedIncrement
Definition: armddk.h:53
const GLdouble * v
Definition: gl.h:2040
BOOL dispex_query_interface(DispatchEx *This, REFIID riid, void **ppv)
Definition: dispex.c:1656
static HRESULT WINAPI HTMLScreen_GetIDsOfNames(IHTMLScreen *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: htmlscreen.c:93
static const tid_t HTMLScreen_iface_tids[]
Definition: htmlscreen.c:223
#define E_NOTIMPL
Definition: ddrawi.h:99
unsigned int UINT
Definition: ndis.h:50
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
#define VERTRES
Definition: wingdi.h:716
static HRESULT WINAPI HTMLScreen_get_height(IHTMLScreen *iface, LONG *p)
Definition: htmlscreen.c:144
HRESULT init_dispex(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *prototype)
Definition: dispex.c:940
static HRESULT WINAPI HTMLScreen_get_availHeight(IHTMLScreen *iface, LONG *p)
Definition: htmlscreen.c:168
static HRESULT WINAPI HTMLScreen_get_updateInterval(IHTMLScreen *iface, LONG *p)
Definition: htmlscreen.c:161
struct stdole::DISPPARAMS DISPPARAMS
unsigned int ULONG
Definition: retypes.h:1
LONG bottom
Definition: windef.h:294
static HRESULT WINAPI HTMLScreen_put_bufferDepth(IHTMLScreen *iface, LONG v)
Definition: htmlscreen.c:120
GLfloat GLfloat p
Definition: glext.h:8902
HDC get_display_dc(void)
Definition: main.c:166
void release_dispex(DispatchEx *This)
Definition: dispex.c:1706
static BOOL heap_free(void *mem)
Definition: appwiz.h:75