Path: blob/trunk/third_party/closure/goog/ui/toolbar.js
4073 views
/**1* @license2* Copyright The Closure Library Authors.3* SPDX-License-Identifier: Apache-2.04*/56/**7* @fileoverview A toolbar class that hosts {@link goog.ui.Control}s such as8* buttons and menus, along with toolbar-specific renderers of those controls.9*10* @see ../demos/toolbar.html11*/1213goog.provide('goog.ui.Toolbar');1415goog.require('goog.ui.Container');16goog.require('goog.ui.ToolbarRenderer');17goog.requireType('goog.dom.DomHelper');18192021/**22* A toolbar class, implemented as a {@link goog.ui.Container} that defaults to23* having a horizontal orientation and {@link goog.ui.ToolbarRenderer} as its24* renderer.25* @param {goog.ui.ToolbarRenderer=} opt_renderer Renderer used to render or26* decorate the toolbar; defaults to {@link goog.ui.ToolbarRenderer}.27* @param {?goog.ui.Container.Orientation=} opt_orientation Toolbar orientation;28* defaults to `HORIZONTAL`.29* @param {goog.dom.DomHelper=} opt_domHelper Optional DOM helper.30* @constructor31* @extends {goog.ui.Container}32*/33goog.ui.Toolbar = function(opt_renderer, opt_orientation, opt_domHelper) {34'use strict';35goog.ui.Container.call(36this, opt_orientation,37opt_renderer || goog.ui.ToolbarRenderer.getInstance(), opt_domHelper);38};39goog.inherits(goog.ui.Toolbar, goog.ui.Container);404142/** @override */43goog.ui.Toolbar.prototype.handleFocus = function(e) {44'use strict';45goog.ui.Toolbar.base(this, 'handleFocus', e);46// Highlight the first highlightable item on focus via the keyboard for ARIA47// spec compliance. Do not highlight the item if the mouse button is pressed,48// since this method is also called from handleMouseDown when a toolbar button49// is clicked.50if (!this.isMouseButtonPressed()) {51this.highlightFirst();52}53};545556