1 /* 2 * Copyright (C) 2008 WaveMaker Software, Inc. 3 * 4 * This file is part of WaveMaker Studio. 5 * 6 * WaveMaker Studio is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU Affero General Public License as published by 8 * the Free Software Foundation, version 3 of the License, only. 9 * 10 * WaveMaker Studio is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Affero General Public License for more details. 14 * 15 * You should have received a copy of the GNU Affero General Public License 16 * along with WaveMaker Studio. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 dojo.provide("wm.base.widget.Box"); 19 dojo.require("wm.base.Widget"); 20 21 /** 22 Adds box layout features to Widget. 23 @name wm.Box 24 @class 25 @extends wm.Widget 26 */ 27 dojo.declare("wm.Box", wm.Widget, { 28 /** @lends wm.Widget.prototype */ 29 width: "96px", 30 height: "48px", 31 autoSize: false, 32 setDomNode: function(inDomNode) { 33 var n = inDomNode; 34 if (!n) return; 35 if (this.autoSize) 36 this.width = this.height = ""; 37 // the domNode might already have box and flex ... 38 this.box && (n.box = this.box); 39 this.flex && (n.flex = this.flex); 40 this.boxPosition && (n.boxPosition = this.boxPosition); 41 this.inherited(arguments); 42 dojo.addClass(this.domNode, "wmbox"); 43 }, 44 setBox: function(inBox) { 45 this.domNode.box = this.box = inBox; 46 this.reflowParent(); 47 }, 48 setBoxPosition: function(inPosition) { 49 this.boxPosition = this.domNode.boxPosition = inPosition; 50 this.reflowParent(); 51 } 52 }); 53