dojo.provide("parus.customIconsPalette");dojo.require("dijit.dijit");dojo.require("dijit._Widget");dojo.require("dijit._Templated");dojo.require("dijit._PaletteMixin");dojo.require("dijit.form.DropDownButton");dojo.require("parus.parus8");if(!parus){parus={}}dojo.declare("parus.customIconsPalette",[dijit._Widget,dijit._Templated,dijit._PaletteMixin],{definition:"",templateString:dojo.cache("dijit","templates/ColorPalette.html"),baseClass:"dijitColorPalette",dyeClass:"parus.customIconsPaletteItem",_definition:null,_default:null,buildRendering:function(){this.inherited(arguments);if(!this._definition){this._definition=dojo.fromJson(this.definition)}var d=[];var c=[];var b={};for(var a in this._definition){if(!a.match(/^\..+/)){if(!this._default){this._default=a}c.push(a);b[a]="";if(c.length==this._definition[".perrow"]){d.push(c);c=[]}}}this._preparePalette(d,b);this.onRendered()},onRendered:function(){}});dojo.declare("parus.customIconsPaletteItem",null,{template:'<span class="dijitInline dijitPaletteImg"><img src="${blankGif}" class="${iconClass}" /></span>',_value:null,constructor:function(c,b,a){this._value=c},getValue:function(){return this._value},fillCell:function(b,a){dojo.place(dojo.string.substitute(this.template,{iconClass:this._value,blankGif:a}),b)}});dojo.declare("parus.customIconsEditor",[dijit.form.DropDownButton],{definition:"",value:"",showLabel:false,label:"<b>(Нет)</b>",_palette:null,attributeMap:dojo.delegate(dijit._WidgetBase,{value:""}),paletteClass:"parus.customIconsPalette",_setValueAttr:function(a){this.value=a;if(this.domNode){this.attr("iconClass",a)}this.attr("showLabel",!a);this.onChange()},postMixInProperties:function(){if(!this._palette){this._palette=new (dojo.getObject(this.paletteClass))({definition:this.definition,onRendered:this.__paletteRendered,onChange:dojo.hitch(this,this._paletteChange)})}this.dropDown=this._palette;this._setValueAttr(this.value||this._palette._default);this.inherited(arguments)},_paletteChange:function(){this.attr("value",this._palette.value)},__paletteRendered:function(){var e=this.gridNode.insertRow(0);var d=e.insertCell(-1);d.colSpan=this._definition[".perrow"];d.align="center";var c=dojo.marginBox(e).w;if(!c){var b=this.gridNode.parentNode;document.body.appendChild(this.gridNode);c=dojo.coords(e).w;b.appendChild(this.gridNode)}var a=new dijit.form.Button({label:"<b>(Нет)</b>",style:"width:"+c+"px",onClick:dojo.hitch(this,function(){this.attr("value","")})},dojo.place("<span></span>",d,"only"));a.domNode.firstChild.style.width="100%"},onChange:function(){}});