/* See license.txt for terms of usage */ define("domplate/toolbar",["domplate/domplate","core/lib","core/trace","domplate/popupMenu"],function(Domplate,Lib,Trace,Menu){with(Domplate){var ToolbarTempl=domplate({tag:DIV({"class":"toolbar",onclick:"$onClick"}),buttonTag:SPAN({"class":"$button|getClassName toolbarButton",title:"$button.tooltiptext",$text:"$button|hasLabel",onclick:"$button|getCommand"},"$button|getLabel"),dropDownTag:SPAN({"class":"$button|getClassName toolbarButton dropDown",_repObject:"$button",title:"$button.tooltiptext",$text:"$button|hasLabel",onclick:"$onDropDown"},"$button|getLabel",SPAN({"class":"arrow"})),separatorTag:SPAN({"class":"toolbarSeparator",style:"color: gray;"},"|"),hasLabel:function(e){return e.label?!0:!1},getLabel:function(e){return e.label?e.label:""},getClassName:function(e){return e.className?e.className:""},getCommand:function(e){return e.command?e.command:function(){}},onClick:function(e){var t=$.event.fix(e||window.event);Lib.cancelEvent(t)},onDropDown:function(e){var t=$.event.fix(e||window.event),n=t.target,r=Lib.getAncestorByClass(n,"toolbarButton"),i=r.repObject.items,s=new Menu({id:"toolbarContextMenu",items:i});s.showPopup(r)}});function Toolbar(){this.buttons=[]}return Toolbar.prototype={addButton:function(e){e.tooltiptext||(tooltiptext=""),this.buttons.push(e)},removeButton:function(e){for(var t=0;t