/* ************************************************************************ qooxdoo - the new era of web development http://qooxdoo.org Copyright: 2004-2006 by 1&1 Internet AG, Germany, http://www.1and1.org License: LGPL 2.1: http://www.gnu.org/licenses/lgpl.html Authors: * Sebastian Werner (wpbasti) * Andreas Ecker (ecker) ************************************************************************ */ /* ************************************************************************ #module(ui_toolbar) ************************************************************************ */ qx.OO.defineClass("qx.ui.toolbar.ToolBar", qx.ui.layout.HorizontalBoxLayout, function() { qx.ui.layout.HorizontalBoxLayout.call(this); this.addEventListener("keypress", this._onkeypress); }); /* --------------------------------------------------------------------------- PROPERTIES --------------------------------------------------------------------------- */ qx.OO.addProperty({ name : "openMenu", type : "object", instance : "qx.ui.menu.Menu" }); /*! Appearance of the widget */ qx.OO.changeProperty({ name : "appearance", type : "string", defaultValue : "toolbar" }); /* --------------------------------------------------------------------------- UTILITIES --------------------------------------------------------------------------- */ qx.Proto.getAllButtons = function() { var vChildren = this.getChildren(); var vLength = vChildren.length; var vDeepChildren = []; var vCurrent; for (var i=0; i=0; i--) { vCurrent = vChildren[i]; if (vCurrent instanceof qx.ui.toolbar.MenuButton && vCurrent.getEnabled()) { vPrevButton = vCurrent; break; } } // If none found, try again from the begin (looping) if (!vPrevButton) { for (var i=vChildrenLength-1; i>vIndex; i--) { vCurrent = vChildren[i]; if (vCurrent instanceof qx.ui.toolbar.MenuButton && vCurrent.getEnabled()) { vPrevButton = vCurrent; break; } } } if (vPrevButton) { // hide other menus qx.manager.object.MenuManager.getInstance().update(); // show previous menu vPrevButton._showMenu(true); } } qx.Proto._onkeypress_right = function() { var vMenu = this.getOpenMenu(); if (!vMenu) { return; } var vOpener = vMenu.getOpener(); if (!vOpener) { return; } var vChildren = this.getAllButtons(); var vChildrenLength = vChildren.length; var vIndex = vChildren.indexOf(vOpener); var vCurrent; var vNextButton = null; for (var i=vIndex+1; i