Back to index

lightning-sunbird  0.9+nobinonly
nsScreenBeOS.cpp
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 2000
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either of the GNU General Public License Version 2 or later (the "GPL"),
00026  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 #include "nsScreenBeOS.h"
00039 
00040 #include <Screen.h>
00041 
00042 nsScreenBeOS :: nsScreenBeOS (  )
00043 {
00044   // nothing else to do. I guess we could cache a bunch of information
00045   // here, but we want to ask the device at runtime in case anything
00046   // has changed.
00047 }
00048 
00049 
00050 nsScreenBeOS :: ~nsScreenBeOS()
00051 {
00052   // nothing to see here.
00053 }
00054 
00055 
00056 // addref, release, QI
00057 NS_IMPL_ISUPPORTS1(nsScreenBeOS, nsIScreen)
00058 
00059 
00060 NS_IMETHODIMP
00061 nsScreenBeOS :: GetRect(PRInt32 *outLeft, PRInt32 *outTop, PRInt32 *outWidth, PRInt32 *outHeight)
00062 {
00063        BScreen screen;
00064        
00065   *outTop = 0;
00066   *outLeft = 0;
00067   *outWidth = PRInt32(screen.Frame().Width()+1);
00068   *outHeight = PRInt32(screen.Frame().Height()+1);
00069 
00070   return NS_OK;
00071   
00072 } // GetRect
00073 
00074 
00075 NS_IMETHODIMP
00076 nsScreenBeOS :: GetAvailRect(PRInt32 *outLeft, PRInt32 *outTop, PRInt32 *outWidth, PRInt32 *outHeight)
00077 {
00078        BScreen screen;
00079 
00080   *outTop = 0;
00081   *outLeft = 0;
00082   *outWidth = PRInt32(screen.Frame().Width()+1);
00083   *outHeight = PRInt32(screen.Frame().Height()+1);
00084 
00085   return NS_OK;
00086   
00087 } // GetAvailRect
00088 
00089 
00090 NS_IMETHODIMP 
00091 nsScreenBeOS :: GetPixelDepth(PRInt32 *aPixelDepth)
00092 {
00093        BScreen screen;
00094 
00095        color_space depth;
00096        PRInt32 pixelDepth;
00097        
00098        depth = screen.ColorSpace();
00099        switch(depth)
00100        {      
00101               case B_CMAP8:
00102                      pixelDepth = 8;
00103                      break;
00104               case B_RGB32:
00105                      pixelDepth = 32;
00106                      break;
00107               case B_RGB15:
00108                      pixelDepth = 15;
00109                      break;
00110               case B_RGB16:
00111                      pixelDepth = 16;
00112                      break;
00113               default:
00114                      NS_NOTREACHED("FIXME:  Please add this screen depth to the code nsScreenBeOS.cpp");
00115                      pixelDepth = 32;
00116                      break; 
00117        }
00118   *aPixelDepth = pixelDepth;
00119 
00120   return NS_OK;
00121 
00122 } // GetPixelDepth
00123 
00124 
00125 NS_IMETHODIMP 
00126 nsScreenBeOS :: GetColorDepth(PRInt32 *aColorDepth)
00127 {
00128   return GetPixelDepth ( aColorDepth );
00129 
00130 } // GetColorDepth
00131 
00132