toolbarcolormenubutton.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // Copyright 2008 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 toolbar color menu button control.
  16. *
  17. * @author attila@google.com (Attila Bodis)
  18. */
  19. goog.provide('goog.ui.ToolbarColorMenuButton');
  20. goog.require('goog.ui.ColorMenuButton');
  21. goog.require('goog.ui.ToolbarColorMenuButtonRenderer');
  22. goog.require('goog.ui.registry');
  23. /**
  24. * A color menu button control for a toolbar.
  25. *
  26. * @param {goog.ui.ControlContent} content Text caption or existing DOM
  27. * structure to display as the button's caption.
  28. * @param {goog.ui.Menu=} opt_menu Menu to render under the button when clicked;
  29. * should contain at least one {@link goog.ui.ColorPalette} if present.
  30. * @param {goog.ui.ColorMenuButtonRenderer=} opt_renderer Optional
  31. * renderer used to render or decorate the button; defaults to
  32. * {@link goog.ui.ToolbarColorMenuButtonRenderer}.
  33. * @param {goog.dom.DomHelper=} opt_domHelper Optional DOM helper, used for
  34. * document interaction.
  35. * @constructor
  36. * @extends {goog.ui.ColorMenuButton}
  37. */
  38. goog.ui.ToolbarColorMenuButton = function(
  39. content, opt_menu, opt_renderer, opt_domHelper) {
  40. goog.ui.ColorMenuButton.call(
  41. this, content, opt_menu,
  42. opt_renderer || goog.ui.ToolbarColorMenuButtonRenderer.getInstance(),
  43. opt_domHelper);
  44. };
  45. goog.inherits(goog.ui.ToolbarColorMenuButton, goog.ui.ColorMenuButton);
  46. // Registers a decorator factory function for toolbar color menu buttons.
  47. goog.ui.registry.setDecoratorByClassName(
  48. goog.getCssName('goog-toolbar-color-menu-button'),
  49. function() { return new goog.ui.ToolbarColorMenuButton(null); });