www-thermferm/jqwidgets/jqxdockpanel.js

changeset 511
2d1d43c3a2c2
parent 373
f6850e0b5d35
child 617
b216f9d4b917
equal deleted inserted replaced
510:2da3d3340403 511:2d1d43c3a2c2
1 /* 1 /*
2 jQWidgets v3.8.0 (2015-Apr) 2 jQWidgets v4.5.2 (2017-May)
3 Copyright (c) 2011-2015 jQWidgets. 3 Copyright (c) 2011-2017 jQWidgets.
4 License: http://jqwidgets.com/license/ 4 License: http://jqwidgets.com/license/
5 */ 5 */
6 !function(a){a.jqx.jqxWidget("jqxDockPanel","",{}),a.extend(a.jqx._jqxDockPanel.prototype,{defineInstance:function(){var b={width:null,height:null,lastchildfill:!0,disabled:!1,events:["layout"]};return this===a.jqx._jqxDockPanel.prototype?b:(a.extend(!0,this,b),b)},createInstance:function(b){var c=this;this.host.addClass(this.toThemeProperty("jqx-dockpanel")),this.host.addClass(this.toThemeProperty("jqx-rc-all")),this.childrenCount=a(this.host).children().length,this.host.wrapInner('<div style="overflow: hidden; width: 100%; height: 100%;" class="innerContainer"></div>'),this.$wrapper=this.host.find(".innerContainer"),this.$wrapper.css("position","relative"),this.sizeCache=new Array,this.performLayout(),a.jqx.utilities.resize(this.host,function(){c.refresh()})},render:function(){null!=this.width&&this.width.toString().indexOf("px")!=-1?this.host.width(this.width):void 0==this.width||isNaN(this.width)||this.host.width(this.width),null!=this.height&&this.height.toString().indexOf("px")!=-1?this.host.height(this.height):void 0==this.height||isNaN(this.height)||this.host.height(this.height),this.sizeCache=new Array,this.performLayout()},resize:function(a,b){this.width=a,this.height=b,this.render()},performLayout:function(){if(!this.disabled){var b=this.childrenCount,c=0,d=0,e=0,f=0,g=this,h={width:this.host.width(),height:this.host.height()};this.sizeCache.length<this.$wrapper.children().length&&a.each(this.$wrapper.children(),function(b){var c=a(this);c.css("position","absolute");var d={width:c.css("width"),height:c.css("height")};g.sizeCache[b]=d}),a.each(this.$wrapper.children(),function(i){var j=this.getAttribute("dock");void 0==j&&(j="left"),i==b-1&&g.lastchildfill&&(j="fill");var k=a(this);k.css("position","absolute"),k.css("width",g.sizeCache[i].width),k.css("height",g.sizeCache[i].height);var l={width:k.outerWidth(),height:k.outerHeight()},m={x:e,y:f,width:Math.max(0,h.width-(e+c)),height:Math.max(0,h.height-(f+d))};if(i<b)switch(j){case"left":e+=l.width,m.width=l.width;break;case"top":f+=l.height,m.height=l.height;break;case"right":c+=l.width,m.x=Math.max(0,h.width-c),m.width=l.width;break;case"bottom":d+=l.height,m.y=Math.max(0,h.height-d),m.height=l.height}k.css("left",m.x),k.css("top",m.y),k.css("width",m.width),k.css("height",m.height)}),this._raiseevent(0)}},destroy:function(){a.jqx.utilities.resize(this.host,null,!0),this.host.remove()},_raiseevent:function(b,c,d){if(void 0!=this.isInitialized&&1==this.isInitialized){var e=this.events[b],f=new a.Event(e);f.previousValue=c,f.currentValue=d,f.owner=this;var g=this.host.trigger(f);return g}},propertyChangedHandler:function(a,b,c,d){this.isInitialized&&a.render()},refresh:function(){this.render()}})}(jqxBaseFramework);
6 7
7 (function(a){a.jqx.jqxWidget("jqxDockPanel","",{});a.extend(a.jqx._jqxDockPanel.prototype,{defineInstance:function(){var b={width:null,height:null,lastchildfill:true,disabled:false,events:["layout"]};a.extend(true,this,b);return b},createInstance:function(c){var b=this;this.host.addClass(this.toThemeProperty("jqx-dockpanel"));this.host.addClass(this.toThemeProperty("jqx-rc-all"));this.childrenCount=a(this.host).children().length;this.host.wrapInner('<div style="overflow: hidden; width: 100%; height: 100%;" class="innerContainer"></div>');this.$wrapper=this.host.find(".innerContainer");this.$wrapper.css("position","relative");this.sizeCache=new Array();this.performLayout();a.jqx.utilities.resize(this.host,function(){b.refresh()})},render:function(){if(this.width!=null&&this.width.toString().indexOf("px")!=-1){this.host.width(this.width)}else{if(this.width!=undefined&&!isNaN(this.width)){this.host.width(this.width)}}if(this.height!=null&&this.height.toString().indexOf("px")!=-1){this.host.height(this.height)}else{if(this.height!=undefined&&!isNaN(this.height)){this.host.height(this.height)}}this.sizeCache=new Array();this.performLayout()},resize:function(c,b){this.width=c;this.height=b;this.render()},performLayout:function(){if(this.disabled){return}var e=this.childrenCount;var d=0;var c=0;var b=0;var h=0;var f=this;var g={width:this.host.width(),height:this.host.height()};if(this.sizeCache.length<this.$wrapper.children().length){a.each(this.$wrapper.children(),function(i){var k=a(this);k.css("position","absolute");var j={width:k.css("width"),height:k.css("height")};f.sizeCache[i]=j})}a.each(this.$wrapper.children(),function(j){var l=this.getAttribute("dock");if(l==undefined){l="left"}if(j==e-1&&f.lastchildfill){l="fill"}var k=a(this);k.css("position","absolute");k.css("width",f.sizeCache[j].width);k.css("height",f.sizeCache[j].height);var i={width:k.outerWidth(),height:k.outerHeight()};var m={x:b,y:h,width:Math.max(0,g.width-(b+d)),height:Math.max(0,g.height-(h+c))};if(j<e){switch(l){case"left":b+=i.width;m.width=i.width;break;case"top":h+=i.height;m.height=i.height;break;case"right":d+=i.width;m.x=Math.max(0,(g.width-d));m.width=i.width;break;case"bottom":c+=i.height;m.y=Math.max(0,(g.height-c));m.height=i.height;break}}k.css("left",m.x);k.css("top",m.y);k.css("width",m.width);k.css("height",m.height)});this._raiseevent(0)},destroy:function(){a.jqx.utilities.resize(this.host,null,true);this.host.remove()},_raiseevent:function(g,d,f){if(this.isInitialized!=undefined&&this.isInitialized==true){var c=this.events[g];var e=new a.Event(c);e.previousValue=d;e.currentValue=f;e.owner=this;var b=this.host.trigger(e);return b}},propertyChangedHandler:function(c,d,b,e){if(!this.isInitialized){return}c.render()},refresh:function(){this.render()}})})(jqxBaseFramework);

mercurial