Add copy of .ttf font with .eot extension for testing
[wine-gecko.git] / widget / src / photon / nsScreenPh.cpp
blobfcb546c69a3f19d592bf615e14dba6d3d01a96b1
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 2000
20 * the Initial Developer. All Rights Reserved.
22 * Contributor(s):
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
38 #include "nsScreenPh.h"
40 #include <Pt.h>
41 #include "nsPhGfxLog.h"
43 nsScreenPh :: nsScreenPh ( ) {
44 PhSysInfo_t SysInfo;
45 PhRect_t rect;
46 char *p;
47 int inp_grp;
48 PhRid_t rid;
49 PhRegion_t region;
51 p = NULL;
53 /* Initialize the data members */
54 /* Get the Screen Size and Depth*/
55 p = getenv("PHIG");
56 if( p ) inp_grp = atoi(p);
57 else inp_grp = 1;
59 PhQueryRids( 0, 0, inp_grp, Ph_INPUTGROUP_REGION, 0, 0, 0, &rid, 1 );
60 PhRegionQuery( rid, &region, &rect, NULL, 0 );
61 inp_grp = region.input_group;
62 PhWindowQueryVisible( Ph_QUERY_IG_POINTER, 0, inp_grp, &rect );
63 mWidth = rect.lr.x - rect.ul.x + 1;
64 mHeight = rect.lr.y - rect.ul.y + 1;
66 /* Get the System Info for the RID */
67 if( PhQuerySystemInfo(rid, NULL, &SysInfo ) ) {
68 /* Make sure the "color_bits" field is valid */
69 if( SysInfo.gfx.valid_fields & Ph_GFX_COLOR_BITS ) mPixelDepth = SysInfo.gfx.color_bits;
73 nsScreenPh :: ~nsScreenPh( ) { }
75 // addref, release, QI
76 NS_IMPL_ISUPPORTS1(nsScreenPh, nsIScreen)
78 NS_IMETHODIMP nsScreenPh :: GetPixelDepth( PRInt32 *aPixelDepth ) {
79 *aPixelDepth = mPixelDepth;
80 return NS_OK;
81 } // GetPixelDepth
84 NS_IMETHODIMP nsScreenPh :: GetColorDepth( PRInt32 *aColorDepth ) {
85 return GetPixelDepth ( aColorDepth );
88 NS_IMETHODIMP nsScreenPh :: GetRect( PRInt32 *outLeft, PRInt32 *outTop, PRInt32 *outWidth, PRInt32 *outHeight ) {
89 *outTop = 0;
90 *outLeft = 0;
91 *outWidth = mWidth;
92 *outHeight = mHeight;
93 return NS_OK;
96 NS_IMETHODIMP nsScreenPh :: GetAvailRect( PRInt32 *outLeft, PRInt32 *outTop, PRInt32 *outWidth, PRInt32 *outHeight ) {
97 *outTop = 0;
98 *outLeft = 0;
99 *outWidth = mWidth;
100 *outHeight = mHeight;
101 return NS_OK;