menuseparator.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Copyright 2007 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 class for representing menu separators.
  16. * @see goog.ui.Menu
  17. *
  18. * @author attila@google.com (Attila Bodis)
  19. */
  20. goog.provide('goog.ui.MenuSeparator');
  21. goog.require('goog.ui.MenuSeparatorRenderer');
  22. goog.require('goog.ui.Separator');
  23. goog.require('goog.ui.registry');
  24. /**
  25. * Class representing a menu separator. A menu separator extends {@link
  26. * goog.ui.Separator} by always setting its renderer to {@link
  27. * goog.ui.MenuSeparatorRenderer}.
  28. * @param {goog.dom.DomHelper=} opt_domHelper Optional DOM helper used for
  29. * document interactions.
  30. * @constructor
  31. * @extends {goog.ui.Separator}
  32. */
  33. goog.ui.MenuSeparator = function(opt_domHelper) {
  34. goog.ui.Separator.call(
  35. this, goog.ui.MenuSeparatorRenderer.getInstance(), opt_domHelper);
  36. };
  37. goog.inherits(goog.ui.MenuSeparator, goog.ui.Separator);
  38. // Register a decorator factory function for goog.ui.MenuSeparators.
  39. goog.ui.registry.setDecoratorByClassName(
  40. goog.ui.MenuSeparatorRenderer.CSS_CLASS, function() {
  41. // Separator defaults to using MenuSeparatorRenderer.
  42. return new goog.ui.Separator();
  43. });