X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/0494b8d9b9bb03ab6c22b34dae81261e3cd7e3e6..7a654f8d43fdb43d78b63d90528bed6e86b608cc:/examples/desktop/js/FitAllLayout.js diff --git a/examples/desktop/js/FitAllLayout.js b/examples/desktop/js/FitAllLayout.js new file mode 100644 index 00000000..c1ccf463 --- /dev/null +++ b/examples/desktop/js/FitAllLayout.js @@ -0,0 +1,48 @@ +/*! + * Ext JS Library 4.0 + * Copyright(c) 2006-2011 Sencha Inc. + * licensing@sencha.com + * http://www.sencha.com/license + */ + +/** + * @class Ext.ux.desktop.FitAllLayout + * @extends Ext.layout.container.AbstractFit + *

This layout applies a "fit" layout to all items, overlaying them on top of each + * other.

+ */ +Ext.define('Ext.ux.desktop.FitAllLayout', { + extend: 'Ext.layout.container.AbstractFit', + alias: 'layout.fitall', + + // @private + onLayout : function() { + var me = this; + me.callParent(); + + var size = me.getLayoutTargetSize(); + + me.owner.items.each(function (item) { + me.setItemBox(item, size); + }); + }, + + getTargetBox : function() { + return this.getLayoutTargetSize(); + }, + + setItemBox : function(item, box) { + var me = this; + if (item && box.height > 0) { + if (me.isManaged('width') === true) { + box.width = undefined; + } + if (me.isManaged('height') === true) { + box.height = undefined; + } + + item.getEl().position('absolute', null, 0, 0); + me.setItemSize(item, box.width, box.height); + } + } +});