org.symbian.tools.wrttools.previewer/preview/script/menu.js
author Eugene Ostroukhov <eugeneo@symbian.org>
Wed, 07 Jul 2010 10:16:21 -0700
changeset 424 ae2704ae87dc
parent 405 9ce576f05e7a
permissions -rw-r--r--
Bug 2555 - Changing screen orientation breaks application flow
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
402
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     1
function EmulatorMenu() {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     2
	this.is_menu_visible = false; // true/false
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     3
	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
     4
										// displayed
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     5
	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
     6
	this.is_dimmed = false;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     7
	this.is_rsk_overridden = false;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     8
	this.log_counter = 1;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     9
	this.enable_log = false;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    10
	this.rsk_label = '';
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    11
	this.rsk_event = false;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    12
	this.highlighted_item = null;
424
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
    13
	
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
    14
	this.lskCallback = null;
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
    15
	this.innerLskCallback = null;
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
    16
	this.rskCallback = null;
402
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    17
}
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    18
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    19
EmulatorMenu.prototype.hide = function() {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    20
	$("#MenuItemsArea").fadeIn("slow");
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    21
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    22
	// 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
    23
	if (NOKIA.menu.softkeys_visibility)
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    24
		$("#SoftKeysArea").fadeIn("slow");
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    25
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    26
	NOKIA.menu.is_softkeys_visible = false;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    27
};
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    28
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    29
EmulatorMenu.prototype.log = function(str) {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    30
	if (!this.enable_log)
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    31
		return false;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    32
	NOKIA.layout.log("log", NOKIA.menu.log_counter + ' ' + str);
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    33
	NOKIA.layout.log("log", 'is_rsk_overridden: '
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    34
			+ NOKIA.menu.is_rsk_overridden);
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    35
	NOKIA.layout.log("log", 'rsk_label: ' + NOKIA.menu.rsk_label);
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    36
	NOKIA.layout.log("log", 'rsk_event: ' + NOKIA.menu.rsk_event);
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    37
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    38
	NOKIA.menu.log_counter++;
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
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    41
EmulatorMenu.prototype.show = function() {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    42
	if (NOKIA.menu.is_dimmed)
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    43
		return false;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    44
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    45
	NOKIA.menu.showSoftKeys();
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
	NOKIA.menu.is_menu_visible = true;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    48
	$("#MenuItemsArea").show();
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    49
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    50
	NOKIA.menu.highlighted_item = $("#MenuItemsArea > ul > li")[0];
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    51
	NOKIA.menu.highlighted_item.className = 'active';
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    52
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    53
	$("#MenuItemsArea > ul > li").mouseover(function() {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    54
		if (NOKIA.menu.highlighted_item != null) {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    55
			NOKIA.menu.highlighted_item.className = '';
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    56
			NOKIA.menu.highlighted_item = null;
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
		NOKIA.menu.highlighted_item = this;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    60
		NOKIA.menu.highlighted_item.className = 'active';
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    61
	});
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
	$("#SoftKeysArea").mouseout(function() {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    64
		if (!NOKIA.menu.is_menu_visible) {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    65
			return false;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    66
		}
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
		if (NOKIA.helper.intervalId) {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    69
			clearInterval(NOKIA.helper.intervalId);
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
		NOKIA.helper.intervalId = setTimeout(function() {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    72
			NOKIA.menu.cancel();
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    73
		}, 500);
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    74
	});
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
	// Change the label "Options" to "Select" to LSK
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    77
	$("#LskLabel > a")[0].innerHTML = "Select";
424
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
    78
	NOKIA.menu.setInnerLsk(NOKIA.menu.selectMenu);
402
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
	// Change the label "Exit" to "Cancel" to RSK
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    81
	$("#RskLabel > a")[0].innerHTML = 'Cancel';
424
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
    82
	NOKIA.menu.setInnerRsk(NOKIA.menu.cancel);
402
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    83
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    84
	NOKIA.emulator.setMenuItemsStyle();
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
};
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    87
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    88
EmulatorMenu.prototype.selectMenu = function() {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    89
	try {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    90
		if (typeof NOKIA.menu.highlighted_item.onclick != 'undefined') {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    91
			eval(NOKIA.menu.highlighted_item.onclick)();
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
	} catch (e) {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    94
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    95
	}
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    96
	// NOKIA.menu.cancel();
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
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    99
EmulatorMenu.prototype.cancel = function() {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   100
	if (NOKIA.menu.is_dimmed)
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   101
		return false;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   102
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   103
	NOKIA.menu.hideSoftKeys();
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
	NOKIA.menu.is_menu_visible = false;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   106
	$("#MenuItemsArea").hide();
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   107
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   108
	// Reset the "OPTION" label to LSK
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   109
	$("#LskLabel > a")[0].innerHTML = 'Options';
424
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   110
	NOKIA.menu.setInnerLsk(NOKIA.emulator.child.menu.show);
402
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   111
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   112
	// Change the label "CANCEL" to "EXIT" to RSK
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   113
	if (!NOKIA.menu.is_rsk_overridden) {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   114
		$("#RskLabel > a")[0].innerHTML = 'Exit';
424
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   115
		NOKIA.menu.setInnerRsk(NOKIA.menu.exit);
402
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   116
	} else {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   117
		$("#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
   118
		NOKIA.menu.setInnerRsk(NOKIA.menu.rsk_event);
402
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   119
	}
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
};
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
EmulatorMenu.prototype.exit = function() {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   124
	if (NOKIA.menu.is_dimmed)
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   125
		return false;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   126
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   127
	if (NOKIA.helper.setHomeScreen())
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   128
		return false;
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
	// clear the Menu Settings
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   131
	NOKIA.menu.cancel();
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   132
	NOKIA.emulator.child.menu.setRightSoftkeyLabel('', null);
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   133
	NOKIA.emulator.child.menu.items = [];
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   134
	NOKIA.menu.softkeys_visibility = false;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   135
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   136
	// Hide Widget DIV
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   137
	NOKIA.menu.hideSoftKeys();
424
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   138
	NOKIA.menu.setInnerLsk(function() {
402
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   139
	});
424
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   140
	NOKIA.menu.setInnerRsk(function() {
402
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   141
	});
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   142
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   143
	$("#WidgetArea").hide();
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
	// Show Icon
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   146
	var style = NOKIA.deviceList[NOKIA.currentDevice][NOKIA.mode]['style'];
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   147
	$('#IconArea').css( {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   148
		'width' : '100%',
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   149
		'height' : style['widget']['height'] + 'px',
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   150
		'float' : style['widget']['float']
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   151
	});
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   152
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   153
	$('#IconArea')[0].className = NOKIA.mode + NOKIA.currentDevice;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   154
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   155
	var img = document.createElement('img');
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   156
	img.src = NOKIA.emulator.iconFile;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   157
	img.border = 0;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   158
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   159
	var div = document.createElement('div');
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   160
	var p = document.createElement('p');
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   161
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   162
	if (NOKIA.emulator.plist.DisplayName.length <= 12)
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   163
		p.innerHTML = NOKIA.emulator.plist.DisplayName;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   164
	else
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   165
		p.innerHTML = NOKIA.emulator.plist.DisplayName.substr(0, 11) + '...';
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   166
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   167
	div.className = 'IconFile';
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   168
	div.style.marginTop = parseInt(parseInt(style['widget']['height'] / 2) - 80)
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   169
			+ 'px';
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   170
	div.appendChild(img);
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   171
	img.onclick = function() {
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
		// close the console DIV
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   174
		NOKIA.layout._console_enabled = false;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   175
		NOKIA.layout.render();
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   176
405
9ce576f05e7a Use Symbian themes with WRTkit - Bug 3134
Paul Beusterien <paulb@symbian.org>
parents: 402
diff changeset
   177
		$("#loaderDiv").html("Application is loading. Please wait...");
402
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   178
		$("#loaderDiv")[0].className = 'green';
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   179
		$("#loaderDiv").show();
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   180
		window.setTimeout(function() {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   181
			document.location = document.location;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   182
		}, 3000);
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   183
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
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   186
	div.appendChild(p);
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   187
405
9ce576f05e7a Use Symbian themes with WRTkit - Bug 3134
Paul Beusterien <paulb@symbian.org>
parents: 402
diff changeset
   188
	$("#loaderDiv").html("Click on Icon to Launch Application");
402
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   189
	$("#loaderDiv").show();
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   190
	$("#loaderDiv")[0].className = 'yellow';
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   191
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   192
	$('#IconArea').append(div);
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   193
	$('#IconArea').show();
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   194
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   195
	NOKIA.menu.is_dimmed = true;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   196
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   197
};
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   198
424
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   199
EmulatorMenu.prototype.initLsk = function() {
402
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   200
	// for RSK
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   201
	$('#LskArea')[0].onclick = function() {
424
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   202
		NOKIA.menu.lsk();
402
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   203
	};
424
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   204
	
402
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   205
	$('#LskLabel > a')[0].onclick = function() {
424
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   206
		NOKIA.menu.lsk();
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   207
	};
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   208
	return true;
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   209
};
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   210
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   211
EmulatorMenu.prototype.initRsk = function() {
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   212
	// for RSK
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   213
	$('#RskArea')[0].onclick = function() {
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   214
		NOKIA.menu.rsk();
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   215
	};
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   216
	
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   217
	$('#RskLabel > a')[0].onclick = function() {
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   218
		NOKIA.menu.rsk();
402
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   219
	};
424
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   220
	return true;
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   221
};
402
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   222
424
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   223
EmulatorMenu.prototype.lsk = function() {
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   224
	if (!this.is_dimmed)
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   225
		if (this.lskCallback != null) {
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   226
			window.setTimeout(this.lskCallback, 10);
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   227
		} else {
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   228
			this.innerLskCallback();
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   229
		}
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   230
};
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   231
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   232
EmulatorMenu.prototype.rsk = function() {
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   233
	if (!this.is_dimmed)
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   234
		if (this.rskCallback != null) {
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   235
			window.setTimeout(this.rskCallback, 10);
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   236
		} else {
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   237
			this.innerRskCallback();
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   238
		}
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   239
};
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   240
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   241
EmulatorMenu.prototype.setInnerLsk = function(func) {
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   242
	this.innerLskCallback = func;
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   243
	this.initLsk();
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   244
	return true;
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   245
};
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   246
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   247
EmulatorMenu.prototype.setLsk = function(func) {
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   248
	this.lskCallback = func;
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   249
	return true;
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   250
};
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   251
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   252
EmulatorMenu.prototype.setInnerRsk = function(func) {
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   253
	this.innerRskCallback = func;
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   254
	this.initRsk();
402
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   255
	return true;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   256
};
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   257
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   258
EmulatorMenu.prototype.setRsk = function(func) {
424
ae2704ae87dc Bug 2555 - Changing screen orientation breaks application flow
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 405
diff changeset
   259
	this.rskCallback = func;
402
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   260
	return true;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   261
};
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   262
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   263
EmulatorMenu.prototype.render = function() {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   264
	if (!NOKIA.menu.softkeys_visibility)
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   265
		NOKIA.menu.hideSoftKeys();
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   266
	else
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   267
		NOKIA.menu.showSoftKeys();
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   268
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   269
	NOKIA.emulator.setWidgetStyle();
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   270
};
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   271
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   272
EmulatorMenu.prototype.init = function() {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   273
	NOKIA.menu.render();
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.createSFKArea = function() {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   277
	var a = $('#SoftKeys > a');
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   278
	a.html('');
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
	var preferences = NOKIA.deviceList[NOKIA.currentDevice][NOKIA.mode];
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   281
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   282
	var lsk = document.createElement('img');
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   283
	lsk.border = "0";
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   284
	lsk.id = "LskArea";
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   285
	lsk.name = "LskArea";
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   286
	lsk.src = "preview/images/TransperantImage.png";
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   287
	lsk.style.width = preferences.style.softkeysImg.width;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   288
	lsk.style.height = preferences.style.softkeysImg.height;
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
	var rsk = document.createElement('img');
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   291
	rsk.border = 0;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   292
	rsk.id = "RskArea";
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   293
	rsk.name = "RskArea";
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   294
	rsk.src = "preview/images/TransperantImage.png";
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   295
	rsk.style.width = preferences.style.softkeysImg.width;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   296
	rsk.style.height = preferences.style.softkeysImg.height;
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
	if (NOKIA.mode == 'portrait') {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   299
		lsk.onclick = function() {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   300
			$("#LskLabel > a").trigger('click');
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   301
		};
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   302
		a[0].appendChild(lsk);
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   303
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   304
		rsk.onclick = function() {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   305
			$("#RskLabel > a").trigger('click');
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   306
		};
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   307
		a[1].appendChild(rsk);
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   308
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   309
	} else {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   310
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   311
		rsk.onclick = function() {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   312
			$("#RskLabel > a").trigger('click');
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   313
		};
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   314
		a[0].appendChild(rsk);
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
		lsk.onclick = function() {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   317
			$("#LskLabel > a").trigger('click');
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   318
		};
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   319
		a[1].appendChild(lsk);
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   320
	}
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
};
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   323
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   324
EmulatorMenu.prototype.showSoftKeys = function() {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   325
	NOKIA.menu.is_softkeys_visible = true;
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
	NOKIA.emulator.setWidgetStyle();
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   328
	$("#SoftKeysArea").show();
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   329
};
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   330
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   331
EmulatorMenu.prototype.hideSoftKeys = function() {
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   332
	// 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
   333
	if (!NOKIA.menu.softkeys_visibility)
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   334
		$("#SoftKeysArea").hide();
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   335
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   336
	NOKIA.menu.is_softkeys_visible = false;
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   337
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   338
	NOKIA.emulator.setWidgetStyle();
f943a50b6689 Acceleration and orientation - initial cut
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
   339
};