menubar.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright 2012 The Closure Library Authors. All Rights Reserved.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS-IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. /**
  15. * @fileoverview A base menu bar factory. Can be bound to an existing
  16. * HTML structure or can generate its own DOM.
  17. *
  18. * To decorate, the menu bar should be bound to an element containing children
  19. * with the classname 'goog-menu-button'. See menubar.html for example.
  20. *
  21. * @see ../demos/menubar.html
  22. */
  23. goog.provide('goog.ui.menuBar');
  24. goog.require('goog.ui.Container');
  25. goog.require('goog.ui.MenuBarRenderer');
  26. /**
  27. * The menuBar factory creates a new menu bar.
  28. * @param {goog.ui.ContainerRenderer=} opt_renderer Renderer used to render or
  29. * decorate the menu bar; defaults to {@link goog.ui.MenuBarRenderer}.
  30. * @param {goog.dom.DomHelper=} opt_domHelper DOM helper, used for document
  31. * interaction.
  32. * @return {!goog.ui.Container} The created menu bar.
  33. */
  34. goog.ui.menuBar.create = function(opt_renderer, opt_domHelper) {
  35. return new goog.ui.Container(
  36. null, opt_renderer ? opt_renderer : goog.ui.MenuBarRenderer.getInstance(),
  37. opt_domHelper);
  38. };