Back to index

lightning-sunbird  0.9+nobinonly
nsScreenQt.cpp
Go to the documentation of this file.
00001 /* ***** BEGIN LICENSE BLOCK *****
00002  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00003  *
00004  * The contents of this file are subject to the Mozilla Public License Version
00005  * 1.1 (the "License"); you may not use this file except in compliance with
00006  * the License. You may obtain a copy of the License at
00007  * http://www.mozilla.org/MPL/
00008  *
00009  * Software distributed under the License is distributed on an "AS IS" basis,
00010  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00011  * for the specific language governing rights and limitations under the
00012  * License.
00013  *
00014  * The Original Code is mozilla.org code.
00015  *
00016  * The Initial Developer of the Original Code is
00017  * Netscape Communications Corporation.
00018  * Portions created by the Initial Developer are Copyright (C) 2000
00019  * the Initial Developer. All Rights Reserved.
00020  *
00021  * Contributor(s):
00022  *   Lars Knoll <knoll@kde.org>
00023  *   Zack Rusin <zack@kde.org>
00024  *   John C. Griggs <johng@corel.com>
00025  *
00026  * Alternatively, the contents of this file may be used under the terms of
00027  * either the GNU General Public License Version 2 or later (the "GPL"), or
00028  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00029  * in which case the provisions of the GPL or the LGPL are applicable instead
00030  * of those above. If you wish to allow use of your version of this file only
00031  * under the terms of either the GPL or the LGPL, and not to allow others to
00032  * use your version of this file under the terms of the MPL, indicate your
00033  * decision by deleting the provisions above and replace them with the notice
00034  * and other provisions required by the GPL or the LGPL. If you do not delete
00035  * the provisions above, a recipient may use your version of this file under
00036  * the terms of any one of the MPL, the GPL or the LGPL.
00037  *
00038  * ***** END LICENSE BLOCK ***** */
00039 
00040 #include "nsScreenQt.h"
00041 
00042 #include <qcolor.h>
00043 #include <qapplication.h>
00044 
00045 #include "qtlog.h"
00046 
00047 nsScreenQt::nsScreenQt(int aScreen)
00048 {
00049     screen = aScreen;
00050     // nothing else to do. I guess we could cache a bunch of information
00051     // here, but we want to ask the device at runtime in case anything
00052     // has changed.
00053 }
00054 
00055 nsScreenQt::~nsScreenQt()
00056 {
00057     // nothing to see here.
00058 }
00059 
00060 // addref, release, QI
00061 NS_IMPL_ISUPPORTS1(nsScreenQt, nsIScreen)
00062 
00063     NS_IMETHODIMP
00064 nsScreenQt::GetRect(PRInt32 *outLeft,PRInt32 *outTop,
00065                     PRInt32 *outWidth,PRInt32 *outHeight)
00066 {
00067     QRect r = QApplication::desktop()->screenGeometry(screen);
00068     *outTop = r.x();
00069     *outLeft = r.y();
00070     *outWidth = r.width();
00071     *outHeight = r.height();
00072 
00073     return NS_OK;
00074 }
00075 
00076 NS_IMETHODIMP
00077 nsScreenQt::GetAvailRect(PRInt32 *outLeft,PRInt32 *outTop,
00078                          PRInt32 *outWidth,PRInt32 *outHeight)
00079 {
00080     QRect r = QApplication::desktop()->availableGeometry(screen);
00081     *outTop = r.x();
00082     *outLeft = r.y();
00083     *outWidth = r.width();
00084     *outHeight = r.height();
00085 
00086     return NS_OK;
00087 }
00088 
00089 NS_IMETHODIMP
00090 nsScreenQt::GetPixelDepth(PRInt32 *aPixelDepth)
00091 {
00092     // #############
00093     *aPixelDepth = (PRInt32)QColor::numBitPlanes();
00094     return NS_OK;
00095 }
00096 
00097 NS_IMETHODIMP
00098 nsScreenQt::GetColorDepth(PRInt32 *aColorDepth)
00099 {
00100     // ###############
00101     return GetPixelDepth(aColorDepth);
00102 }