menubarrenderer.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 Renderer for {@link goog.ui.menuBar}.
  16. *
  17. */
  18. goog.provide('goog.ui.MenuBarRenderer');
  19. goog.require('goog.a11y.aria.Role');
  20. goog.require('goog.ui.Container');
  21. goog.require('goog.ui.ContainerRenderer');
  22. /**
  23. * Default renderer for {@link goog.ui.menuBar}s, based on {@link
  24. * goog.ui.ContainerRenderer}.
  25. * @constructor
  26. * @extends {goog.ui.ContainerRenderer}
  27. * @final
  28. */
  29. goog.ui.MenuBarRenderer = function() {
  30. goog.ui.MenuBarRenderer.base(
  31. this, 'constructor', goog.a11y.aria.Role.MENUBAR);
  32. };
  33. goog.inherits(goog.ui.MenuBarRenderer, goog.ui.ContainerRenderer);
  34. goog.addSingletonGetter(goog.ui.MenuBarRenderer);
  35. /**
  36. * Default CSS class to be applied to the root element of elements rendered
  37. * by this renderer.
  38. * @type {string}
  39. */
  40. goog.ui.MenuBarRenderer.CSS_CLASS = goog.getCssName('goog-menubar');
  41. /**
  42. * @override
  43. */
  44. goog.ui.MenuBarRenderer.prototype.getCssClass = function() {
  45. return goog.ui.MenuBarRenderer.CSS_CLASS;
  46. };
  47. /**
  48. * Returns the default orientation of containers rendered or decorated by this
  49. * renderer. This implementation returns {@code HORIZONTAL}.
  50. * @return {goog.ui.Container.Orientation} Default orientation for containers
  51. * created or decorated by this renderer.
  52. * @override
  53. */
  54. goog.ui.MenuBarRenderer.prototype.getDefaultOrientation = function() {
  55. return goog.ui.Container.Orientation.HORIZONTAL;
  56. };