uidesigner/com.nokia.sdt.series60.componentlibrary/components/app/CAknAppUi_visual.js
changeset 0 fb279309251b
equal deleted inserted replaced
-1:000000000000 0:fb279309251b
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 /*		
       
    20  *		graphics (wrapped SWT GC)
       
    21  *		Colors (object from which getColor(r,g,b) is available)
       
    22  *		Images (object from which newImage(device,w,h) is available)
       
    23  */
       
    24 function CAknAppUiVisual() {
       
    25 }
       
    26 
       
    27 CAknAppUiVisual.prototype.draw = function(instance, laf, graphics) {
       
    28 
       
    29 	var width = instance.properties.size.width;
       
    30 	var height = instance.properties.size.height;
       
    31 
       
    32 	var screenBackground = laf.getColor("screen.background");	
       
    33 	graphics.setBackground(screenBackground);
       
    34 	graphics.fillRectangle(0, 0, width, height);
       
    35 	
       
    36 	drawStatusBar(laf, graphics, "status.bar1.bounds");
       
    37 	drawStatusBar(laf, graphics, "status.bar2.bounds");
       
    38 }
       
    39 
       
    40 function drawStatusBar(laf, graphics, boundsName) {
       
    41 	var bounds = laf.getRectangle(boundsName);
       
    42 	if (bounds != null) {
       
    43 		var useGradient = laf.getBoolean("status.bar.gradient", false);
       
    44 		if (useGradient) {
       
    45 			var navGradientStart = laf.getColor("status.bar.gradient.start");
       
    46 			var navGradientEnd = laf.getColor("status.bar.gradient.end");
       
    47 			graphics.setForeground(navGradientStart);
       
    48 			graphics.setBackground(navGradientEnd);
       
    49 			var cbaW = 0;
       
    50 			if (laf.getBoolean("is.landscape", true))
       
    51 				cbaW = laf.getRectangle("control.pane.bounds").width;
       
    52 			graphics.fillGradientRectangle(bounds.x, bounds.y, bounds.width - cbaW, bounds.height, false);
       
    53 		}
       
    54 		else {
       
    55 		 	var color = laf.getColor("status.bar.color");
       
    56 		 	graphics.setBackground(color);
       
    57 		 	graphics.fillRectangle(bounds);
       
    58 		}
       
    59 	}
       
    60 }
       
    61 
       
    62 CAknAppUiVisual.prototype.getPreferredSize = function(instance, laf, wHint, hHint) {
       
    63 	return null; // needs implementation	
       
    64 }
       
    65