uidesigner/com.nokia.sdt.series60.componentlibrary/components/statuspane/StatusPaneTitle_visual.js
author timkelly
Thu, 23 Apr 2009 08:52:08 -0500
branchRCL_2_0
changeset 117 bac3606e1ea9
parent 2 d760517a8095
permissions -rw-r--r--
fix bug 8914. endless sdk refresh when devices.xml is empty or has xml format error
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
cawthron
parents:
diff changeset
     1
/*
cawthron
parents:
diff changeset
     2
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
cawthron
parents:
diff changeset
     3
* All rights reserved.
cawthron
parents:
diff changeset
     4
* This component and the accompanying materials are made available
cawthron
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
cawthron
parents:
diff changeset
     6
* which accompanies this distribution, and is available
cawthron
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
cawthron
parents:
diff changeset
     8
*
cawthron
parents:
diff changeset
     9
* Initial Contributors:
cawthron
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
cawthron
parents:
diff changeset
    11
*
cawthron
parents:
diff changeset
    12
* Contributors:
cawthron
parents:
diff changeset
    13
*
cawthron
parents:
diff changeset
    14
* Description: 
cawthron
parents:
diff changeset
    15
*
cawthron
parents:
diff changeset
    16
*/
cawthron
parents:
diff changeset
    17
cawthron
parents:
diff changeset
    18
cawthron
parents:
diff changeset
    19
include("../implLibrary.js")
cawthron
parents:
diff changeset
    20
include("../renderLibrary.js")
cawthron
parents:
diff changeset
    21
include("../srcgenLibrary.js")
cawthron
parents:
diff changeset
    22
include("titleLibrary.js")
cawthron
parents:
diff changeset
    23
cawthron
parents:
diff changeset
    24
function StatusPaneTitleVisual() {
cawthron
parents:
diff changeset
    25
}
cawthron
parents:
diff changeset
    26
cawthron
parents:
diff changeset
    27
StatusPaneTitleVisual.prototype.draw = function(instance, laf, graphics) {
cawthron
parents:
diff changeset
    28
	var properties = instance.properties;
cawthron
parents:
diff changeset
    29
	var titleText = properties.titleText;
cawthron
parents:
diff changeset
    30
	
cawthron
parents:
diff changeset
    31
	// image title not shown in landscape, but currently we
cawthron
parents:
diff changeset
    32
	// don't retain the text property, so use default
cawthron
parents:
diff changeset
    33
	if (laf.getBoolean("is.landscape", false)) {
cawthron
parents:
diff changeset
    34
		if (titleText == "")
cawthron
parents:
diff changeset
    35
			titleText = getProjectName();
cawthron
parents:
diff changeset
    36
	}
cawthron
parents:
diff changeset
    37
	
cawthron
parents:
diff changeset
    38
	if (titleText != "") {
cawthron
parents:
diff changeset
    39
		drawTitleText(instance, laf, graphics, titleText);
cawthron
parents:
diff changeset
    40
	} else {
cawthron
parents:
diff changeset
    41
		// no text, try image
cawthron
parents:
diff changeset
    42
		renderImage(StatusPaneTitleVisual.prototype, instance, laf, graphics, 
cawthron
parents:
diff changeset
    43
			0, 0, "image", false);
cawthron
parents:
diff changeset
    44
	}
cawthron
parents:
diff changeset
    45
}
cawthron
parents:
diff changeset
    46
cawthron
parents:
diff changeset
    47
StatusPaneTitleVisual.prototype.getPreferredSize = function(instance, wHint, hHint, laf) {
cawthron
parents:
diff changeset
    48
	return null;
cawthron
parents:
diff changeset
    49
}
cawthron
parents:
diff changeset
    50
cawthron
parents:
diff changeset
    51
StatusPaneTitleVisual.prototype.getViewableSize = function(instance, propertyId, laf) {
cawthron
parents:
diff changeset
    52
	var	size = instance.properties.size;
cawthron
parents:
diff changeset
    53
	return new Point(size.width, size.height);
cawthron
parents:
diff changeset
    54
}
cawthron
parents:
diff changeset
    55
cawthron
parents:
diff changeset
    56
StatusPaneTitleVisual.prototype.isScaling = function(instance, propertyId, laf) {
cawthron
parents:
diff changeset
    57
	return isScalingIcons();
cawthron
parents:
diff changeset
    58
}
cawthron
parents:
diff changeset
    59
cawthron
parents:
diff changeset
    60
StatusPaneTitleVisual.prototype.getAlignmentWeights = function(instance, propertyId, laf) {
cawthron
parents:
diff changeset
    61
	return new Point(ImageUtils.ALIGN_CENTER_OR_LEFT, ImageUtils.ALIGN_CENTER_OR_TOP);
cawthron
parents:
diff changeset
    62
}
cawthron
parents:
diff changeset
    63
cawthron
parents:
diff changeset
    64
StatusPaneTitleVisual.prototype.isPreservingAspectRatio = function(instance, propertyId, laf) {
cawthron
parents:
diff changeset
    65
	return true;
cawthron
parents:
diff changeset
    66
}
cawthron
parents:
diff changeset
    67
cawthron
parents:
diff changeset
    68
StatusPaneTitleVisual.prototype.propertyChanged = function(instance, propertyId) {
cawthron
parents:
diff changeset
    69
	// reset title text when image is set
cawthron
parents:
diff changeset
    70
	if (propertyId == "image" && isImagePropertySet(instance.properties.image)) {
cawthron
parents:
diff changeset
    71
		instance.properties.titleText = "";
cawthron
parents:
diff changeset
    72
	}
cawthron
parents:
diff changeset
    73
}
cawthron
parents:
diff changeset
    74
cawthron
parents:
diff changeset
    75
setupCommonDirectLabelEditing(StatusPaneTitleVisual.prototype, "titleText",
cawthron
parents:
diff changeset
    76
	null,	
cawthron
parents:
diff changeset
    77
	function(instance, laf) { return laf.getFont("titleFont"); 
cawthron
parents:
diff changeset
    78
	}
cawthron
parents:
diff changeset
    79
)
cawthron
parents:
diff changeset
    80
cawthron
parents:
diff changeset
    81
cawthron
parents:
diff changeset
    82
setupCommonDirectImageEditing(StatusPaneTitleVisual.prototype, "image",
cawthron
parents:
diff changeset
    83
	null // areafunction
cawthron
parents:
diff changeset
    84
)
cawthron
parents:
diff changeset
    85
cawthron
parents:
diff changeset
    86