/*
	Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
	Available via Academic Free License >= 2.1 OR the modified BSD license.
	see: http://dojotoolkit.org/license for details
*/


window[esri._dojoScopeName||"dojo"]._xdResourceLoaded(function(_1,_2,_3){return {depends:[["provide","dojox.sketch.Toolbar"],["require","dojox.sketch.Annotation"],["require","dijit.Toolbar"],["require","dijit.form.Button"]],defineResource:function(_4,_5,_6){if(!_4._hasResource["dojox.sketch.Toolbar"]){_4._hasResource["dojox.sketch.Toolbar"]=true;_4.provide("dojox.sketch.Toolbar");_4.require("dojox.sketch.Annotation");_4.require("dijit.Toolbar");_4.require("dijit.form.Button");_4.declare("dojox.sketch.ButtonGroup",null,{constructor:function(){this._childMaps={};this._children=[];},add:function(_7){this._childMaps[_7]=_7.connect(_7,"onActivate",_4.hitch(this,"_resetGroup",_7));this._children.push(_7);},_resetGroup:function(p){var cs=this._children;_4.forEach(cs,function(c){if(p!=c&&c["attr"]){c.attr("checked",false);}});}});_4.declare("dojox.sketch.Toolbar",_5.Toolbar,{figure:null,plugins:null,postCreate:function(){this.inherited(arguments);this.shapeGroup=new _6.sketch.ButtonGroup;if(!this.plugins){this.plugins=["Lead","SingleArrow","DoubleArrow","Underline","Preexisting","Slider"];}this._plugins=[];_4.forEach(this.plugins,function(_8){var _9=_4.isString(_8)?_8:_8.name;var p=new _6.sketch.tools[_9](_8.args||{});this._plugins.push(p);p.setToolbar(this);if(!this._defaultTool&&p.button){this._defaultTool=p;}},this);},setFigure:function(f){this.figure=f;this.connect(f,"onLoad","reset");_4.forEach(this._plugins,function(p){p.setFigure(f);});},destroy:function(){_4.forEach(this._plugins,function(p){p.destroy();});this.inherited(arguments);delete this._defaultTool;delete this._plugins;},addGroupItem:function(_a,_b){if(_b!="toolsGroup"){console.error("not supported group "+_b);return;}this.shapeGroup.add(_a);},reset:function(){this._defaultTool.activate();},_setShape:function(s){if(!this.figure.surface){return;}if(this.figure.hasSelections()){for(var i=0;i<this.figure.selected.length;i++){var _c=this.figure.selected[i].serialize();this.figure.convert(this.figure.selected[i],s);this.figure.history.add(_6.sketch.CommandTypes.Convert,this.figure.selected[i],_c);}}}});_6.sketch.makeToolbar=function(_d,_e){var _f=new _6.sketch.Toolbar();_f.setFigure(_e);_d.appendChild(_f.domNode);return _f;};}}};});