diff -r 000000000000 -r 54498df70f5d Symbian.org/preview/script/lib/menu.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian.org/preview/script/lib/menu.js Fri Jun 05 16:18:05 2009 +0100 @@ -0,0 +1,492 @@ +/* + Function : menu() + Argument : Void + Returns : Void + Description : Constructor Function creates a Menu object to the WINDOW +*/ + +function Menu() +{ + this.items = Array(); + this.index = null; + this.isDimmed = false; + + // Event triggers + this.onShow = null; + this.onRightSoftKeySelect = null; + + // Flag for Menu softkeys disabled to show + this.is_sfk_disabled = false; +} + + +/* + Function : menu.append() + Argument : MenuItem Object + Returns : Void + Description : Function appends MenuItem to a Menu Object +*/ +Menu.prototype.append = function(MenuItem) +{ + if(this.allowedTypeOf(MenuItem)) + { + var i; + var flag = true; + try{ + for(i=0; i 1) + menuItemsPane.style.overflowY = 'scroll'; + else + menuItemsPane.style.overflowY = 'hidden'; + } + else + { + menuItemsPane.style.overflowY = 'hidden'; + ul.appendChild(createExitMenuElement()); + } + menuItemsPane.innerHTML = ''; + /* + * Set the MenuKeys DIV style.top + */ + childToParent_Reference.Emulator.showDeviceSoftKeys(); + } + catch(e) + { + alert('showMenu: '+e); + } +} + +Menu.prototype.triggeLeftSoftKeyEvent = function() +{ + if(typeof(window.menu.onShow) == 'function') + { + window.menu.onShow(); + } + childToParent_Reference.$('softKeysPane').style.display = 'block'; + this.showMenu(); +} + +Menu.prototype.triggeEvent = function(MenuItemId) +{ + try{ + var menuItemRef = menuItemExhistsById(this, MenuItemId, 0); + if(menuItemRef != null) + { + if(typeof menuItemRef.onSelect == 'function') + menuItemRef.onSelect(MenuItemId); + + if(menuItemRef.items.length) + this.showMenu(MenuItemId); + else + this.cancel(); + } + } + catch(e) + { + alert('triggeEvent: '+MenuItemId+' >> '+e); + } +} + +Menu.prototype.hasChild = function(parentId) +{ + for(var i=0; i