root / trunk / web / dojo / dojox / sketch / _Plugin.js
History | View | Annotate | Download (1.58 KB)
1 |
/*
|
---|---|
2 |
Copyright (c) 2004-2010, 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 |
|
7 |
|
8 |
if(!dojo._hasResource["dojox.sketch._Plugin"]){ |
9 |
dojo._hasResource["dojox.sketch._Plugin"]=true; |
10 |
dojo.provide("dojox.sketch._Plugin");
|
11 |
dojo.require("dijit.form.Button");
|
12 |
dojo.declare("dojox.sketch._Plugin",null,{constructor:function(_1){ |
13 |
if(_1){
|
14 |
dojo.mixin(this,_1);
|
15 |
} |
16 |
this._connects=[];
|
17 |
},figure:null,iconClassPrefix:"dojoxSketchIcon",itemGroup:"toolsGroup",button:null,queryCommand:null,shape:"",useDefaultCommand:true,buttonClass:dijit.form.ToggleButton,_initButton:function(){ |
18 |
if(this.shape.length){ |
19 |
var _2=this.iconClassPrefix+" "+this.iconClassPrefix+this.shape.charAt(0).toUpperCase()+this.shape.substr(1); |
20 |
if(!this.button){ |
21 |
var _3={label:this.shape,showLabel:false,iconClass:_2,dropDown:this.dropDown,tabIndex:"-1"}; |
22 |
this.button=new this.buttonClass(_3); |
23 |
this.connect(this.button,"onClick","activate"); |
24 |
} |
25 |
} |
26 |
},attr:function(_4,_5){ |
27 |
return this.button.attr(_4,_5); |
28 |
},onActivate:function(){ |
29 |
},activate:function(e){ |
30 |
this.onActivate();
|
31 |
this.figure.setTool(this); |
32 |
this.attr("checked",true); |
33 |
},onMouseDown:function(e){ |
34 |
},onMouseMove:function(e){ |
35 |
},onMouseUp:function(e){ |
36 |
},destroy:function(f){ |
37 |
dojo.forEach(this._connects,dojo.disconnect);
|
38 |
},connect:function(o,f,tf){ |
39 |
this._connects.push(dojo.connect(o,f,this,tf)); |
40 |
},setFigure:function(_6){ |
41 |
this.figure=_6;
|
42 |
},setToolbar:function(_7){ |
43 |
this._initButton();
|
44 |
if(this.button){ |
45 |
_7.addChild(this.button);
|
46 |
} |
47 |
if(this.itemGroup){ |
48 |
_7.addGroupItem(this,this.itemGroup); |
49 |
} |
50 |
}}); |
51 |
} |