1 jls.loader.provide('jls.gui.Layout'); 2 3 /* 4 The WPF layout engine uses a recursive two-phase system. 5 * First is the measure phase, where every element in the UI tree is queried for its desired size. 6 * Second is the arrange phase, where each element is instructed as to its actual size and location. 7 WPF ships with a handful of layout panels (StackPanel, WrapPanel, Canvas, UniformGrid, Grid, DockPanel) with each panel specializing in a particular type of layout. 8 */ 9 jls.gui.Layout = jls.lang.Class.create( /** @lends jls.gui.Layout.prototype */ 10 { 11 /** 12 * Creates an layout. 13 * 14 * @param {jls.gui.Panel} element The panel element. 15 * @constructs 16 * @see jls.gui.BorderLayout 17 * @see jls.gui.CardLayout 18 * @see jls.gui.FlowLayout 19 * @class Provides basic layout for Panel. 20 */ 21 initialize : function(element) { 22 this._element = null; 23 this.setElement(element); 24 }, 25 getElement : function() { 26 return this._element; 27 }, 28 setElement : function(element) { 29 this._element = element; 30 }, 31 onAddChild : function(child) { 32 this._element.update(); 33 }, 34 onRemoveChild : function(child) { 35 this._element.update(); 36 }, 37 // TODO onLayout ? 38 onUpdate : jls.lang.Class.emptyFunction, 39 onCreate : jls.lang.Class.emptyFunction 40 }); 41