8 this.log_counter = 1; |
8 this.log_counter = 1; |
9 this.enable_log = false; |
9 this.enable_log = false; |
10 this.rsk_label = ''; |
10 this.rsk_label = ''; |
11 this.rsk_event = false; |
11 this.rsk_event = false; |
12 this.highlighted_item = null; |
12 this.highlighted_item = null; |
|
13 |
|
14 this.lskCallback = null; |
|
15 this.innerLskCallback = null; |
|
16 this.rskCallback = null; |
13 } |
17 } |
14 |
18 |
15 EmulatorMenu.prototype.hide = function() { |
19 EmulatorMenu.prototype.hide = function() { |
16 $("#MenuItemsArea").fadeIn("slow"); |
20 $("#MenuItemsArea").fadeIn("slow"); |
17 |
21 |
69 }, 500); |
73 }, 500); |
70 }); |
74 }); |
71 |
75 |
72 // Change the label "Options" to "Select" to LSK |
76 // Change the label "Options" to "Select" to LSK |
73 $("#LskLabel > a")[0].innerHTML = "Select"; |
77 $("#LskLabel > a")[0].innerHTML = "Select"; |
74 NOKIA.menu.setLsk(NOKIA.menu.selectMenu); |
78 NOKIA.menu.setInnerLsk(NOKIA.menu.selectMenu); |
75 |
79 |
76 // Change the label "Exit" to "Cancel" to RSK |
80 // Change the label "Exit" to "Cancel" to RSK |
77 $("#RskLabel > a")[0].innerHTML = 'Cancel'; |
81 $("#RskLabel > a")[0].innerHTML = 'Cancel'; |
78 NOKIA.menu.setRsk(NOKIA.menu.cancel); |
82 NOKIA.menu.setInnerRsk(NOKIA.menu.cancel); |
79 |
83 |
80 NOKIA.emulator.setMenuItemsStyle(); |
84 NOKIA.emulator.setMenuItemsStyle(); |
81 |
85 |
82 }; |
86 }; |
83 |
87 |
101 NOKIA.menu.is_menu_visible = false; |
105 NOKIA.menu.is_menu_visible = false; |
102 $("#MenuItemsArea").hide(); |
106 $("#MenuItemsArea").hide(); |
103 |
107 |
104 // Reset the "OPTION" label to LSK |
108 // Reset the "OPTION" label to LSK |
105 $("#LskLabel > a")[0].innerHTML = 'Options'; |
109 $("#LskLabel > a")[0].innerHTML = 'Options'; |
106 NOKIA.menu.setLsk(NOKIA.emulator.child.menu.show); |
110 NOKIA.menu.setInnerLsk(NOKIA.emulator.child.menu.show); |
107 |
111 |
108 // Change the label "CANCEL" to "EXIT" to RSK |
112 // Change the label "CANCEL" to "EXIT" to RSK |
109 if (!NOKIA.menu.is_rsk_overridden) { |
113 if (!NOKIA.menu.is_rsk_overridden) { |
110 $("#RskLabel > a")[0].innerHTML = 'Exit'; |
114 $("#RskLabel > a")[0].innerHTML = 'Exit'; |
111 NOKIA.menu.setRsk(NOKIA.menu.exit); |
115 NOKIA.menu.setInnerRsk(NOKIA.menu.exit); |
112 } else { |
116 } else { |
113 $("#RskLabel > a")[0].innerHTML = NOKIA.menu.rsk_label; |
117 $("#RskLabel > a")[0].innerHTML = NOKIA.menu.rsk_label; |
114 NOKIA.menu.setRsk(NOKIA.menu.rsk_event); |
118 NOKIA.menu.setInnerRsk(NOKIA.menu.rsk_event); |
115 } |
119 } |
116 |
120 |
117 }; |
121 }; |
118 |
122 |
119 EmulatorMenu.prototype.exit = function() { |
123 EmulatorMenu.prototype.exit = function() { |
129 NOKIA.emulator.child.menu.items = []; |
133 NOKIA.emulator.child.menu.items = []; |
130 NOKIA.menu.softkeys_visibility = false; |
134 NOKIA.menu.softkeys_visibility = false; |
131 |
135 |
132 // Hide Widget DIV |
136 // Hide Widget DIV |
133 NOKIA.menu.hideSoftKeys(); |
137 NOKIA.menu.hideSoftKeys(); |
134 NOKIA.menu.setLsk(function() { |
138 NOKIA.menu.setInnerLsk(function() { |
135 }); |
139 }); |
136 NOKIA.menu.setRsk(function() { |
140 NOKIA.menu.setInnerRsk(function() { |
137 }); |
141 }); |
138 |
142 |
139 $("#WidgetArea").hide(); |
143 $("#WidgetArea").hide(); |
140 |
144 |
141 // Show Icon |
145 // Show Icon |
190 |
194 |
191 NOKIA.menu.is_dimmed = true; |
195 NOKIA.menu.is_dimmed = true; |
192 |
196 |
193 }; |
197 }; |
194 |
198 |
195 EmulatorMenu.prototype.setLsk = function(func) { |
199 EmulatorMenu.prototype.initLsk = function() { |
196 // for RSK |
200 // for RSK |
197 $('#LskArea')[0].onclick = function() { |
201 $('#LskArea')[0].onclick = function() { |
198 if (!NOKIA.menu.is_dimmed) |
202 NOKIA.menu.lsk(); |
199 func(); |
203 }; |
200 }; |
204 |
201 |
|
202 $('#LskLabel > a')[0].onclick = function() { |
205 $('#LskLabel > a')[0].onclick = function() { |
203 if (!NOKIA.menu.is_dimmed) |
206 NOKIA.menu.lsk(); |
204 func(); |
207 }; |
205 }; |
208 return true; |
206 |
209 }; |
207 return true; |
210 |
208 }; |
211 EmulatorMenu.prototype.initRsk = function() { |
209 |
|
210 EmulatorMenu.prototype.setRsk = function(func) { |
|
211 // for RSK |
212 // for RSK |
212 $('#RskArea')[0].onclick = function() { |
213 $('#RskArea')[0].onclick = function() { |
213 if (!NOKIA.menu.is_dimmed) |
214 NOKIA.menu.rsk(); |
214 func(); |
215 }; |
215 }; |
216 |
216 |
|
217 $('#RskLabel > a')[0].onclick = function() { |
217 $('#RskLabel > a')[0].onclick = function() { |
218 if (!NOKIA.menu.is_dimmed) |
218 NOKIA.menu.rsk(); |
219 func(); |
219 }; |
220 }; |
220 return true; |
221 |
221 }; |
222 return true; |
222 |
223 }; |
223 EmulatorMenu.prototype.lsk = function() { |
224 |
224 if (!this.is_dimmed) |
225 EmulatorMenu.prototype.triggerLsk = function(event) { |
225 if (this.lskCallback != null) { |
226 var callback; |
226 window.setTimeout(this.lskCallback, 10); |
227 if (NOKIA.mode == 'portrait') |
227 } else { |
228 callback = NOKIA.menu.lsk_event; |
228 this.innerLskCallback(); |
229 else if ((NOKIA.mode == 'landscape') && (event.id == 'LskLabel')) |
229 } |
230 callback = NOKIA.menu.lsk_event; |
230 }; |
231 else |
231 |
232 callback = NOKIA.menu.rsk_event; |
232 EmulatorMenu.prototype.rsk = function() { |
233 |
233 if (!this.is_dimmed) |
234 if (typeof callback == 'function' && !NOKIA.menu.is_dimmed) { |
234 if (this.rskCallback != null) { |
235 callback(); |
235 window.setTimeout(this.rskCallback, 10); |
236 } |
236 } else { |
237 }; |
237 this.innerRskCallback(); |
238 |
238 } |
239 EmulatorMenu.prototype.triggerRsk = function(event) { |
239 }; |
240 var callback; |
240 |
241 if (NOKIA.mode == 'portrait') |
241 EmulatorMenu.prototype.setInnerLsk = function(func) { |
242 callback = NOKIA.menu.rsk_event; |
242 this.innerLskCallback = func; |
243 else if ((NOKIA.mode == 'landscape') && (event.id == 'RskLabel')) |
243 this.initLsk(); |
244 callback = NOKIA.menu.rsk_event; |
244 return true; |
245 else |
245 }; |
246 callback = NOKIA.menu.lsk_event; |
246 |
247 |
247 EmulatorMenu.prototype.setLsk = function(func) { |
248 if (typeof callback == 'function') { |
248 this.lskCallback = func; |
249 if (!NOKIA.menu.is_dimmed) { |
249 return true; |
250 callback(); |
250 }; |
251 NOKIA.menu.cancel(); |
251 |
252 } |
252 EmulatorMenu.prototype.setInnerRsk = function(func) { |
253 } |
253 this.innerRskCallback = func; |
|
254 this.initRsk(); |
|
255 return true; |
|
256 }; |
|
257 |
|
258 EmulatorMenu.prototype.setRsk = function(func) { |
|
259 this.rskCallback = func; |
|
260 return true; |
254 }; |
261 }; |
255 |
262 |
256 EmulatorMenu.prototype.render = function() { |
263 EmulatorMenu.prototype.render = function() { |
257 if (!NOKIA.menu.softkeys_visibility) |
264 if (!NOKIA.menu.softkeys_visibility) |
258 NOKIA.menu.hideSoftKeys(); |
265 NOKIA.menu.hideSoftKeys(); |