plugins/org.symbian.tools.tmw.previewer/preview/script/menu.js
author Eugene Ostroukhov <eugeneo@symbian.org>
Thu, 04 Nov 2010 15:22:02 -0700
changeset 495 0008ebdc0ec0
parent 485 df4f55e8569e
permissions -rw-r--r--
Launch configurations were updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
485
df4f55e8569e Fixed copyright headers and removed unneeded WRT mentions from TMW code
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 470
diff changeset
     1
/*******************************************************************************
df4f55e8569e Fixed copyright headers and removed unneeded WRT mentions from TMW code
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 470
diff changeset
     2
 * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
df4f55e8569e Fixed copyright headers and removed unneeded WRT mentions from TMW code
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 470
diff changeset
     3
 * All rights reserved.
df4f55e8569e Fixed copyright headers and removed unneeded WRT mentions from TMW code
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 470
diff changeset
     4
 * This component and the accompanying materials are made available
df4f55e8569e Fixed copyright headers and removed unneeded WRT mentions from TMW code
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 470
diff changeset
     5
 * under the terms of the License "Eclipse Public License v1.0"
df4f55e8569e Fixed copyright headers and removed unneeded WRT mentions from TMW code
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 470
diff changeset
     6
 * which accompanies this distribution, and is available
df4f55e8569e Fixed copyright headers and removed unneeded WRT mentions from TMW code
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 470
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
df4f55e8569e Fixed copyright headers and removed unneeded WRT mentions from TMW code
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 470
diff changeset
     8
 *
df4f55e8569e Fixed copyright headers and removed unneeded WRT mentions from TMW code
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 470
diff changeset
     9
 * Initial Contributors:
df4f55e8569e Fixed copyright headers and removed unneeded WRT mentions from TMW code
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 470
diff changeset
    10
 * Symbian Foundation - initial contribution.
df4f55e8569e Fixed copyright headers and removed unneeded WRT mentions from TMW code
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 470
diff changeset
    11
 * Contributors:
df4f55e8569e Fixed copyright headers and removed unneeded WRT mentions from TMW code
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 470
diff changeset
    12
 * Description:
df4f55e8569e Fixed copyright headers and removed unneeded WRT mentions from TMW code
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 470
diff changeset
    13
 * Overview:
df4f55e8569e Fixed copyright headers and removed unneeded WRT mentions from TMW code
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 470
diff changeset
    14
 * Details:
df4f55e8569e Fixed copyright headers and removed unneeded WRT mentions from TMW code
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 470
diff changeset
    15
 * Platforms/Drives/Compatibility:
df4f55e8569e Fixed copyright headers and removed unneeded WRT mentions from TMW code
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 470
diff changeset
    16
 * Assumptions/Requirement/Pre-requisites:
df4f55e8569e Fixed copyright headers and removed unneeded WRT mentions from TMW code
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 470
diff changeset
    17
 * Failures and causes:
df4f55e8569e Fixed copyright headers and removed unneeded WRT mentions from TMW code
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 470
diff changeset
    18
 *******************************************************************************/
402
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    19
function EmulatorMenu() {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    20
	this.is_menu_visible = false; // true/false
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    21
	this.is_softkeys_visible = false; // true : only when MenuItem's are
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    22
										// displayed
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    23
	this.softkeys_visibility = true; // true/false : for hide/show SFK's
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    24
	this.is_dimmed = false;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    25
	this.is_rsk_overridden = false;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    26
	this.log_counter = 1;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    27
	this.enable_log = false;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    28
	this.rsk_label = '';
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    29
	this.rsk_event = false;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    30
	this.highlighted_item = null;
424
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
    31
	
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
    32
	this.lskCallback = null;
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
    33
	this.innerLskCallback = null;
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
    34
	this.rskCallback = null;
402
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    35
}
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    36
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    37
EmulatorMenu.prototype.hide = function() {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    38
	$("#MenuItemsArea").fadeIn("slow");
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    39
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    40
	// Hide the SFK's If user hidden them from his code
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    41
	if (NOKIA.menu.softkeys_visibility)
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    42
		$("#SoftKeysArea").fadeIn("slow");
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    43
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    44
	NOKIA.menu.is_softkeys_visible = false;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    45
};
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    46
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    47
EmulatorMenu.prototype.log = function(str) {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    48
	if (!this.enable_log)
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    49
		return false;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    50
	NOKIA.layout.log("log", NOKIA.menu.log_counter + ' ' + str);
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    51
	NOKIA.layout.log("log", 'is_rsk_overridden: '
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    52
			+ NOKIA.menu.is_rsk_overridden);
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    53
	NOKIA.layout.log("log", 'rsk_label: ' + NOKIA.menu.rsk_label);
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    54
	NOKIA.layout.log("log", 'rsk_event: ' + NOKIA.menu.rsk_event);
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    55
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    56
	NOKIA.menu.log_counter++;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    57
};
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    58
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    59
EmulatorMenu.prototype.show = function() {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    60
	if (NOKIA.menu.is_dimmed)
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    61
		return false;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    62
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    63
	NOKIA.menu.showSoftKeys();
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    64
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    65
	NOKIA.menu.is_menu_visible = true;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    66
	$("#MenuItemsArea").show();
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    67
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    68
	NOKIA.menu.highlighted_item = $("#MenuItemsArea > ul > li")[0];
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    69
	NOKIA.menu.highlighted_item.className = 'active';
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    70
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    71
	$("#MenuItemsArea > ul > li").mouseover(function() {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    72
		if (NOKIA.menu.highlighted_item != null) {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    73
			NOKIA.menu.highlighted_item.className = '';
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    74
			NOKIA.menu.highlighted_item = null;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    75
		}
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    76
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    77
		NOKIA.menu.highlighted_item = this;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    78
		NOKIA.menu.highlighted_item.className = 'active';
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    79
	});
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    80
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    81
	$("#SoftKeysArea").mouseout(function() {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    82
		if (!NOKIA.menu.is_menu_visible) {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    83
			return false;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    84
		}
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    85
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    86
		if (NOKIA.helper.intervalId) {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    87
			clearInterval(NOKIA.helper.intervalId);
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    88
		}
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    89
		NOKIA.helper.intervalId = setTimeout(function() {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    90
			NOKIA.menu.cancel();
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    91
		}, 500);
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    92
	});
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    93
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    94
	// Change the label "Options" to "Select" to LSK
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    95
	$("#LskLabel > a")[0].innerHTML = "Select";
424
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
    96
	NOKIA.menu.setInnerLsk(NOKIA.menu.selectMenu);
402
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    97
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    98
	// Change the label "Exit" to "Cancel" to RSK
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    99
	$("#RskLabel > a")[0].innerHTML = 'Cancel';
424
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   100
	NOKIA.menu.setInnerRsk(NOKIA.menu.cancel);
402
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   101
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   102
	NOKIA.emulator.setMenuItemsStyle();
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   103
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   104
};
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   105
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   106
EmulatorMenu.prototype.selectMenu = function() {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   107
	try {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   108
		if (typeof NOKIA.menu.highlighted_item.onclick != 'undefined') {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   109
			eval(NOKIA.menu.highlighted_item.onclick)();
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   110
		}
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   111
	} catch (e) {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   112
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   113
	}
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   114
	// NOKIA.menu.cancel();
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   115
};
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   116
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   117
EmulatorMenu.prototype.cancel = function() {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   118
	if (NOKIA.menu.is_dimmed)
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   119
		return false;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   120
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   121
	NOKIA.menu.hideSoftKeys();
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   122
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   123
	NOKIA.menu.is_menu_visible = false;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   124
	$("#MenuItemsArea").hide();
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   125
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   126
	// Reset the "OPTION" label to LSK
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   127
	$("#LskLabel > a")[0].innerHTML = 'Options';
424
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   128
	NOKIA.menu.setInnerLsk(NOKIA.emulator.child.menu.show);
402
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   129
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   130
	// Change the label "CANCEL" to "EXIT" to RSK
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   131
	if (!NOKIA.menu.is_rsk_overridden) {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   132
		$("#RskLabel > a")[0].innerHTML = 'Exit';
424
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   133
		NOKIA.menu.setInnerRsk(NOKIA.menu.exit);
402
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   134
	} else {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   135
		$("#RskLabel > a")[0].innerHTML = NOKIA.menu.rsk_label;
424
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   136
		NOKIA.menu.setInnerRsk(NOKIA.menu.rsk_event);
402
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   137
	}
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   138
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   139
};
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   140
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   141
EmulatorMenu.prototype.exit = function() {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   142
	if (NOKIA.menu.is_dimmed)
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   143
		return false;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   144
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   145
	if (NOKIA.helper.setHomeScreen())
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   146
		return false;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   147
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   148
	// clear the Menu Settings
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   149
	NOKIA.menu.cancel();
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   150
	NOKIA.emulator.child.menu.setRightSoftkeyLabel('', null);
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   151
	NOKIA.emulator.child.menu.items = [];
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   152
	NOKIA.menu.softkeys_visibility = false;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   153
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   154
	// Hide Widget DIV
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   155
	NOKIA.menu.hideSoftKeys();
424
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   156
	NOKIA.menu.setInnerLsk(function() {
402
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   157
	});
424
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   158
	NOKIA.menu.setInnerRsk(function() {
402
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   159
	});
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   160
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   161
	$("#WidgetArea").hide();
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   162
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   163
	// Show Icon
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   164
	var style = NOKIA.deviceList[NOKIA.currentDevice][NOKIA.mode]['style'];
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   165
	$('#IconArea').css( {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   166
		'width' : '100%',
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   167
		'height' : style['widget']['height'] + 'px',
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   168
		'float' : style['widget']['float']
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   169
	});
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   170
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   171
	$('#IconArea')[0].className = NOKIA.mode + NOKIA.currentDevice;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   172
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   173
	var img = document.createElement('img');
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   174
	img.src = NOKIA.emulator.iconFile;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   175
	img.border = 0;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   176
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   177
	var div = document.createElement('div');
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   178
	var p = document.createElement('p');
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   179
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   180
	if (NOKIA.emulator.plist.DisplayName.length <= 12)
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   181
		p.innerHTML = NOKIA.emulator.plist.DisplayName;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   182
	else
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   183
		p.innerHTML = NOKIA.emulator.plist.DisplayName.substr(0, 11) + '...';
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   184
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   185
	div.className = 'IconFile';
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   186
	div.style.marginTop = parseInt(parseInt(style['widget']['height'] / 2) - 80)
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   187
			+ 'px';
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   188
	div.appendChild(img);
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   189
	img.onclick = function() {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   190
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   191
		// close the console DIV
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   192
		NOKIA.layout._console_enabled = false;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   193
		NOKIA.layout.render();
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   194
405
9ce576f05e7a Use Symbian themes with WRTkit - Bug 3134
Paul Beusterien <paulb@symbian.org>
parents: 402
diff changeset
   195
		$("#loaderDiv").html("Application is loading. Please wait...");
402
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   196
		$("#loaderDiv")[0].className = 'green';
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   197
		$("#loaderDiv").show();
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   198
		window.setTimeout(function() {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   199
			document.location = document.location;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   200
		}, 3000);
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   201
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   202
	};
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   203
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   204
	div.appendChild(p);
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   205
405
9ce576f05e7a Use Symbian themes with WRTkit - Bug 3134
Paul Beusterien <paulb@symbian.org>
parents: 402
diff changeset
   206
	$("#loaderDiv").html("Click on Icon to Launch Application");
402
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   207
	$("#loaderDiv").show();
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   208
	$("#loaderDiv")[0].className = 'yellow';
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   209
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   210
	$('#IconArea').append(div);
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   211
	$('#IconArea').show();
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   212
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   213
	NOKIA.menu.is_dimmed = true;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   214
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   215
};
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   216
424
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   217
EmulatorMenu.prototype.initLsk = function() {
402
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   218
	// for RSK
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   219
	$('#LskArea')[0].onclick = function() {
424
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   220
		NOKIA.menu.lsk();
402
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   221
	};
424
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   222
	
402
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   223
	$('#LskLabel > a')[0].onclick = function() {
424
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   224
		NOKIA.menu.lsk();
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   225
	};
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   226
	return true;
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   227
};
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   228
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   229
EmulatorMenu.prototype.initRsk = function() {
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   230
	// for RSK
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   231
	$('#RskArea')[0].onclick = function() {
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   232
		NOKIA.menu.rsk();
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   233
	};
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   234
	
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   235
	$('#RskLabel > a')[0].onclick = function() {
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   236
		NOKIA.menu.rsk();
402
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   237
	};
424
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   238
	return true;
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   239
};
402
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   240
424
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   241
EmulatorMenu.prototype.lsk = function() {
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   242
	if (!this.is_dimmed)
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   243
		if (this.lskCallback != null) {
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   244
			window.setTimeout(this.lskCallback, 10);
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   245
		} else {
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   246
			this.innerLskCallback();
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   247
		}
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   248
};
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   249
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   250
EmulatorMenu.prototype.rsk = function() {
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   251
	if (!this.is_dimmed)
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   252
		if (this.rskCallback != null) {
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   253
			window.setTimeout(this.rskCallback, 10);
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   254
		} else {
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   255
			this.innerRskCallback();
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   256
		}
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   257
};
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   258
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   259
EmulatorMenu.prototype.setInnerLsk = function(func) {
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   260
	this.innerLskCallback = func;
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   261
	this.initLsk();
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   262
	return true;
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   263
};
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   264
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   265
EmulatorMenu.prototype.setLsk = function(func) {
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   266
	this.lskCallback = func;
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   267
	return true;
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   268
};
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   269
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   270
EmulatorMenu.prototype.setInnerRsk = function(func) {
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   271
	this.innerRskCallback = func;
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   272
	this.initRsk();
402
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   273
	return true;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   274
};
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   275
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   276
EmulatorMenu.prototype.setRsk = function(func) {
424
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   277
	this.rskCallback = func;
402
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   278
	return true;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   279
};
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   280
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   281
EmulatorMenu.prototype.render = function() {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   282
	if (!NOKIA.menu.softkeys_visibility)
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   283
		NOKIA.menu.hideSoftKeys();
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   284
	else
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   285
		NOKIA.menu.showSoftKeys();
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   286
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   287
	NOKIA.emulator.setWidgetStyle();
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   288
};
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   289
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   290
EmulatorMenu.prototype.init = function() {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   291
	NOKIA.menu.render();
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   292
};
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   293
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   294
EmulatorMenu.prototype.createSFKArea = function() {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   295
	var a = $('#SoftKeys > a');
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   296
	a.html('');
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   297
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   298
	var preferences = NOKIA.deviceList[NOKIA.currentDevice][NOKIA.mode];
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   299
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   300
	var lsk = document.createElement('img');
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   301
	lsk.border = "0";
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   302
	lsk.id = "LskArea";
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   303
	lsk.name = "LskArea";
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   304
	lsk.src = "preview/images/TransperantImage.png";
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   305
	lsk.style.width = preferences.style.softkeysImg.width;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   306
	lsk.style.height = preferences.style.softkeysImg.height;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   307
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   308
	var rsk = document.createElement('img');
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   309
	rsk.border = 0;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   310
	rsk.id = "RskArea";
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   311
	rsk.name = "RskArea";
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   312
	rsk.src = "preview/images/TransperantImage.png";
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   313
	rsk.style.width = preferences.style.softkeysImg.width;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   314
	rsk.style.height = preferences.style.softkeysImg.height;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   315
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   316
	if (NOKIA.mode == 'portrait') {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   317
		lsk.onclick = function() {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   318
			$("#LskLabel > a").trigger('click');
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   319
		};
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   320
		a[0].appendChild(lsk);
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   321
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   322
		rsk.onclick = function() {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   323
			$("#RskLabel > a").trigger('click');
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   324
		};
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   325
		a[1].appendChild(rsk);
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   326
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   327
	} else {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   328
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   329
		rsk.onclick = function() {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   330
			$("#RskLabel > a").trigger('click');
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   331
		};
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   332
		a[0].appendChild(rsk);
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   333
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   334
		lsk.onclick = function() {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   335
			$("#LskLabel > a").trigger('click');
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   336
		};
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   337
		a[1].appendChild(lsk);
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   338
	}
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   339
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   340
};
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   341
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   342
EmulatorMenu.prototype.showSoftKeys = function() {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   343
	NOKIA.menu.is_softkeys_visible = true;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   344
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   345
	NOKIA.emulator.setWidgetStyle();
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   346
	$("#SoftKeysArea").show();
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   347
};
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   348
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   349
EmulatorMenu.prototype.hideSoftKeys = function() {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   350
	// Hide the SFK's If user hidden them from his code
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   351
	if (!NOKIA.menu.softkeys_visibility)
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   352
		$("#SoftKeysArea").hide();
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   353
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   354
	NOKIA.menu.is_softkeys_visible = false;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   355
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   356
	NOKIA.emulator.setWidgetStyle();
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   357
};