//>>built
define("dojox/drawing/ui/dom/Toolbar",["dojo","../../util/common"],function(a,h){a.deprecated("dojox.drawing.ui.dom.Toolbar","It may not even make it to the 1.4 release.",1.4);return a.declare("dojox.drawing.ui.dom.Toolbar",[],{baseClass:"drawingToolbar",buttonClass:"drawingButton",iconClass:"icon",constructor:function(b,d){a.addOnLoad(this,function(){this.domNode=a.byId(d);a.addClass(this.domNode,this.baseClass);this.parse()})},createIcon:function(b,d){var c=d&&d.setup?d.setup:{};if(c.iconClass){var f=
c.iconClass?c.iconClass:"iconNone";c=a.create("div",{title:c.tooltip?c.tooltip:"Tool"},b);a.addClass(c,this.iconClass);a.addClass(c,f);a.connect(b,"mouseup",function(e){a.stopEvent(e);a.removeClass(b,"active")});a.connect(b,"mouseover",function(e){a.stopEvent(e);a.addClass(b,"hover")});a.connect(b,"mousedown",this,function(e){a.stopEvent(e);a.addClass(b,"active")});a.connect(b,"mouseout",this,function(e){a.stopEvent(e);a.removeClass(b,"hover")})}},createTool:function(b){b.innerHTML="";var d=a.attr(b,
"tool");this.toolNodes[d]=b;a.attr(b,"tabIndex",1);var c=a.getObject(d);this.createIcon(b,c);this.drawing.registerTool(d,c);a.connect(b,"mouseup",this,function(f){a.stopEvent(f);a.removeClass(b,"active");this.onClick(d)});a.connect(b,"mouseover",function(f){a.stopEvent(f);a.addClass(b,"hover")});a.connect(b,"mousedown",this,function(f){a.stopEvent(f);a.addClass(b,"active")});a.connect(b,"mouseout",this,function(f){a.stopEvent(f);a.removeClass(b,"hover")})},parse:function(){var b=a.attr(this.domNode,
"drawingId");this.drawing=h.byId(b);this.toolNodes={};var d;a.forEach(this.domNode.childNodes,function(c,f){if(1===c.nodeType){c.className=this.buttonClass;var e=a.attr(c,"tool");a.attr(c,"action");var g=a.attr(c,"plugin");if(e){if(0==f||"true"==a.attr(c,"selected"))d=e;this.createTool(c)}else if(g){e={name:g,options:{}};if(g=a.attr(c,"options"))e.options=eval("("+g+")");e.options.node=c;c.innerHTML="";this.drawing.addPlugin(e);this.createIcon(c,a.getObject(a.attr(c,"plugin")))}}},this);this.drawing.initPlugins();
a.connect(this.drawing,"setTool",this,"onSetTool");this.drawing.setTool(d)},onClick:function(b){this.drawing.setTool(b)},onSetTool:function(b){for(var d in this.toolNodes)d==b?(a.addClass(this.toolNodes[b],"selected"),this.toolNodes[b].blur()):a.removeClass(this.toolNodes[d],"selected")}})});