Upgrade to ExtJS 4.0.0 - Released 04/26/2011
[extjs.git] / src / layout / container / HBox.js
1 /**
2  * @class Ext.layout.container.HBox
3  * @extends Ext.layout.container.Box
4  * <p>A layout that arranges items horizontally across a Container. This layout optionally divides available horizontal
5  * space between child items containing a numeric <code>flex</code> configuration.</p>
6  * This layout may also be used to set the heights of child items by configuring it with the {@link #align} option.
7  * {@img Ext.layout.container.HBox/Ext.layout.container.HBox.png Ext.layout.container.HBox container layout}
8  * Example usage:
9     Ext.create('Ext.Panel', {
10         width: 500,
11         height: 300,
12         title: "HBoxLayout Panel",
13         layout: {
14             type: 'hbox',
15             align: 'stretch'
16         },
17         renderTo: document.body,
18         items: [{
19             xtype: 'panel',
20             title: 'Inner Panel One',
21             flex: 2
22         },{
23             xtype: 'panel',
24             title: 'Inner Panel Two',
25             flex: 1
26         },{
27             xtype: 'panel',
28             title: 'Inner Panel Three',
29             flex: 1
30         }]
31     });
32  */
33 Ext.define('Ext.layout.container.HBox', {
34
35     /* Begin Definitions */
36
37     alias: ['layout.hbox'],
38     extend: 'Ext.layout.container.Box',
39     alternateClassName: 'Ext.layout.HBoxLayout',
40     
41     /* End Definitions */
42
43     /**
44      * @cfg {String} align
45      * Controls how the child items of the container are aligned. Acceptable configuration values for this
46      * property are:
47      * <div class="mdetail-params"><ul>
48      * <li><b><tt>top</tt></b> : <b>Default</b><div class="sub-desc">child items are aligned vertically
49      * at the <b>top</b> of the container</div></li>
50      * <li><b><tt>middle</tt></b> : <div class="sub-desc">child items are aligned vertically in the
51      * <b>middle</b> of the container</div></li>
52      * <li><b><tt>stretch</tt></b> : <div class="sub-desc">child items are stretched vertically to fill
53      * the height of the container</div></li>
54      * <li><b><tt>stretchmax</tt></b> : <div class="sub-desc">child items are stretched vertically to
55      * the height of the largest item.</div></li>
56      * </ul></div>
57      */
58     align: 'top', // top, middle, stretch, strechmax
59
60     //@private
61     alignCenteringString: 'middle',
62
63     type : 'hbox',
64
65     direction: 'horizontal',
66
67     // When creating an argument list to setSize, use this order
68     parallelSizeIndex: 0,
69     perpendicularSizeIndex: 1,
70
71     parallelPrefix: 'width',
72     parallelPrefixCap: 'Width',
73     parallelLT: 'l',
74     parallelRB: 'r',
75     parallelBefore: 'left',
76     parallelBeforeCap: 'Left',
77     parallelAfter: 'right',
78     parallelPosition: 'x',
79
80     perpendicularPrefix: 'height',
81     perpendicularPrefixCap: 'Height',
82     perpendicularLT: 't',
83     perpendicularRB: 'b',
84     perpendicularLeftTop: 'top',
85     perpendicularRightBottom: 'bottom',
86     perpendicularPosition: 'y'
87 });