Button.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /* Copyright (c) 2006-2011 by OpenLayers Contributors (see authors.txt for
  2. * full list of contributors). Published under the Clear BSD license.
  3. * See http://svn.openlayers.org/trunk/openlayers/license.txt for the
  4. * full text of the license. */
  5. /**
  6. * @requires OpenLayers/Control.js
  7. */
  8. /**
  9. * Class: OpenLayers.Control.Button
  10. * The Button control is a very simple push-button, for use with
  11. * <OpenLayers.Control.Panel>.
  12. * When clicked, the function trigger() is executed.
  13. *
  14. * Inherits from:
  15. * - <OpenLayers.Control>
  16. *
  17. * Use:
  18. * (code)
  19. * var button = new OpenLayers.Control.Button({
  20. * displayClass: "MyButton", trigger: myFunction
  21. * });
  22. * panel.addControls([button]);
  23. * (end)
  24. *
  25. * Will create a button with CSS class MyButtonItemInactive, that
  26. * will call the function MyFunction() when clicked.
  27. */
  28. OpenLayers.Control.Button = OpenLayers.Class(OpenLayers.Control, {
  29. /**
  30. * Property: type
  31. * {Integer} OpenLayers.Control.TYPE_BUTTON.
  32. */
  33. type: OpenLayers.Control.TYPE_BUTTON,
  34. /**
  35. * Method: trigger
  36. * Called by a control panel when the button is clicked.
  37. */
  38. trigger: function() {},
  39. CLASS_NAME: "OpenLayers.Control.Button"
  40. });