_Plugin.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. Copyright (c) 2004-2012, The Dojo Foundation All Rights Reserved.
  3. Available via Academic Free License >= 2.1 OR the modified BSD license.
  4. see: http://dojotoolkit.org/license for details
  5. */
  6. if(!dojo._hasResource["dojox.drawing.plugins._Plugin"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
  7. dojo._hasResource["dojox.drawing.plugins._Plugin"] = true;
  8. dojo.provide("dojox.drawing.plugins._Plugin");
  9. dojox.drawing.plugins._Plugin = dojox.drawing.util.oo.declare(
  10. // summary:
  11. // Base class for plugins.
  12. // description:
  13. // When creating a plugin, use this class as the
  14. // base to ensure full functionality.
  15. function(options){
  16. this._cons = [];
  17. dojo.mixin(this, options);
  18. if(this.button && this.onClick){
  19. this.connect(this.button, "onClick", this, "onClick")
  20. }
  21. },
  22. {
  23. util:null,
  24. keys:null,
  25. mouse:null,
  26. drawing:null,
  27. stencils:null,
  28. anchors:null,
  29. canvas:null,
  30. node:null,
  31. button:null,//gfx button
  32. type:"dojox.drawing.plugins._Plugin",
  33. connect: function(){
  34. this._cons.push(dojo.connect.apply(dojo, arguments));
  35. },
  36. disconnect: function(/*handle | Array*/handles){
  37. // summary:
  38. // Removes connections based on passed
  39. // handles arguments
  40. if(!handles){ return };
  41. if(!dojo.isArray(handles)){ handles=[handles]; }
  42. dojo.forEach(handles, dojo.disconnect, dojo);
  43. }
  44. }
  45. );
  46. }