qedit: Let C look like C.
[wine.git] / dlls / mshtml / htmlscreen.c
blob68091a03981a0f18bb3f495db620aaf0618c4cf6
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 *ppv = NULL;
52 if(IsEqualGUID(&IID_IUnknown, riid)) {
53 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
54 *ppv = &This->IHTMLScreen_iface;
55 }else if(IsEqualGUID(&IID_IHTMLScreen, riid)) {
56 TRACE("(%p)->(IID_IHTMLScreen %p)\n", This, ppv);
57 *ppv = &This->IHTMLScreen_iface;
58 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
59 return *ppv ? S_OK : E_NOINTERFACE;
62 if(*ppv) {
63 IUnknown_AddRef((IUnknown*)*ppv);
64 return S_OK;
67 WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
68 return E_NOINTERFACE;
71 static ULONG WINAPI HTMLScreen_AddRef(IHTMLScreen *iface)
73 HTMLScreen *This = impl_from_IHTMLScreen(iface);
74 LONG ref = InterlockedIncrement(&This->ref);
76 TRACE("(%p) ref=%d\n", This, ref);
78 return ref;
81 static ULONG WINAPI HTMLScreen_Release(IHTMLScreen *iface)
83 HTMLScreen *This = impl_from_IHTMLScreen(iface);
84 LONG ref = InterlockedDecrement(&This->ref);
86 TRACE("(%p) ref=%d\n", This, ref);
88 if(!ref) {
89 release_dispex(&This->dispex);
90 heap_free(This);
93 return ref;
96 static HRESULT WINAPI HTMLScreen_GetTypeInfoCount(IHTMLScreen *iface, UINT *pctinfo)
98 HTMLScreen *This = impl_from_IHTMLScreen(iface);
99 FIXME("(%p)\n", This);
100 return E_NOTIMPL;
103 static HRESULT WINAPI HTMLScreen_GetTypeInfo(IHTMLScreen *iface, UINT iTInfo,
104 LCID lcid, ITypeInfo **ppTInfo)
106 HTMLScreen *This = impl_from_IHTMLScreen(iface);
107 FIXME("(%p)\n", This);
108 return E_NOTIMPL;
111 static HRESULT WINAPI HTMLScreen_GetIDsOfNames(IHTMLScreen *iface, REFIID riid,
112 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
114 HTMLScreen *This = impl_from_IHTMLScreen(iface);
115 FIXME("(%p)\n", This);
116 return E_NOTIMPL;
119 static HRESULT WINAPI HTMLScreen_Invoke(IHTMLScreen *iface, DISPID dispIdMember,
120 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
121 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
123 HTMLScreen *This = impl_from_IHTMLScreen(iface);
124 FIXME("(%p)\n", This);
125 return E_NOTIMPL;
128 static HRESULT WINAPI HTMLScreen_get_colorDepth(IHTMLScreen *iface, LONG *p)
130 HTMLScreen *This = impl_from_IHTMLScreen(iface);
132 TRACE("(%p)->(%p)\n", This, p);
134 *p = GetDeviceCaps(get_display_dc(), BITSPIXEL);
135 return S_OK;
138 static HRESULT WINAPI HTMLScreen_put_bufferDepth(IHTMLScreen *iface, LONG v)
140 HTMLScreen *This = impl_from_IHTMLScreen(iface);
141 FIXME("(%p)->(%d)\n", This, v);
142 return E_NOTIMPL;
145 static HRESULT WINAPI HTMLScreen_get_bufferDepth(IHTMLScreen *iface, LONG *p)
147 HTMLScreen *This = impl_from_IHTMLScreen(iface);
148 FIXME("(%p)->(%p)\n", This, p);
149 return E_NOTIMPL;
152 static HRESULT WINAPI HTMLScreen_get_width(IHTMLScreen *iface, LONG *p)
154 HTMLScreen *This = impl_from_IHTMLScreen(iface);
156 TRACE("(%p)->(%p)\n", This, p);
158 *p = GetDeviceCaps(get_display_dc(), HORZRES);
159 return S_OK;
162 static HRESULT WINAPI HTMLScreen_get_height(IHTMLScreen *iface, LONG *p)
164 HTMLScreen *This = impl_from_IHTMLScreen(iface);
166 TRACE("(%p)->(%p)\n", This, p);
168 *p = GetDeviceCaps(get_display_dc(), VERTRES);
169 return S_OK;
172 static HRESULT WINAPI HTMLScreen_put_updateInterval(IHTMLScreen *iface, LONG v)
174 HTMLScreen *This = impl_from_IHTMLScreen(iface);
175 FIXME("(%p)->(%d)\n", This, v);
176 return E_NOTIMPL;
179 static HRESULT WINAPI HTMLScreen_get_updateInterval(IHTMLScreen *iface, LONG *p)
181 HTMLScreen *This = impl_from_IHTMLScreen(iface);
182 FIXME("(%p)->(%p)\n", This, p);
183 return E_NOTIMPL;
186 static HRESULT WINAPI HTMLScreen_get_availHeight(IHTMLScreen *iface, LONG *p)
188 HTMLScreen *This = impl_from_IHTMLScreen(iface);
189 RECT work_area;
191 TRACE("(%p)->(%p)\n", This, p);
193 if(!SystemParametersInfoW(SPI_GETWORKAREA, 0, &work_area, 0))
194 return E_FAIL;
196 *p = work_area.bottom-work_area.top;
197 return S_OK;
200 static HRESULT WINAPI HTMLScreen_get_availWidth(IHTMLScreen *iface, LONG *p)
202 HTMLScreen *This = impl_from_IHTMLScreen(iface);
203 RECT work_area;
205 TRACE("(%p)->(%p)\n", This, p);
207 if(!SystemParametersInfoW(SPI_GETWORKAREA, 0, &work_area, 0))
208 return E_FAIL;
210 *p = work_area.right-work_area.left;
211 return S_OK;
214 static HRESULT WINAPI HTMLScreen_get_fontSmoothingEnabled(IHTMLScreen *iface, VARIANT_BOOL *p)
216 HTMLScreen *This = impl_from_IHTMLScreen(iface);
217 FIXME("(%p)->(%p)\n", This, p);
218 return E_NOTIMPL;
221 static const IHTMLScreenVtbl HTMLSreenVtbl = {
222 HTMLScreen_QueryInterface,
223 HTMLScreen_AddRef,
224 HTMLScreen_Release,
225 HTMLScreen_GetTypeInfoCount,
226 HTMLScreen_GetTypeInfo,
227 HTMLScreen_GetIDsOfNames,
228 HTMLScreen_Invoke,
229 HTMLScreen_get_colorDepth,
230 HTMLScreen_put_bufferDepth,
231 HTMLScreen_get_bufferDepth,
232 HTMLScreen_get_width,
233 HTMLScreen_get_height,
234 HTMLScreen_put_updateInterval,
235 HTMLScreen_get_updateInterval,
236 HTMLScreen_get_availHeight,
237 HTMLScreen_get_availWidth,
238 HTMLScreen_get_fontSmoothingEnabled
241 static const tid_t HTMLScreen_iface_tids[] = {
242 IHTMLScreen_tid,
245 static dispex_static_data_t HTMLScreen_dispex = {
246 NULL,
247 DispHTMLScreen_tid,
248 NULL,
249 HTMLScreen_iface_tids
252 HRESULT HTMLScreen_Create(IHTMLScreen **ret)
254 HTMLScreen *screen;
256 screen = heap_alloc_zero(sizeof(HTMLScreen));
257 if(!screen)
258 return E_OUTOFMEMORY;
260 screen->IHTMLScreen_iface.lpVtbl = &HTMLSreenVtbl;
261 screen->ref = 1;
263 init_dispex(&screen->dispex, (IUnknown*)&screen->IHTMLScreen_iface, &HTMLScreen_dispex);
265 *ret = &screen->IHTMLScreen_iface;
266 return S_OK;