Upgrade to ExtJS 3.1.0 - Released 12/16/2009
[extjs.git] / docs / source / AbsoluteLayout.html
1 <html>\r
2 <head>\r
3   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    \r
4   <title>The source code</title>\r
5     <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
6     <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
7 </head>\r
8 <body  onload="prettyPrint();">\r
9     <pre class="prettyprint lang-js"><div id="cls-Ext.layout.AbsoluteLayout"></div>/**\r
10  * @class Ext.layout.AbsoluteLayout\r
11  * @extends Ext.layout.AnchorLayout\r
12  * <p>This is a layout that inherits the anchoring of <b>{@link Ext.layout.AnchorLayout}</b> and adds the\r
13  * ability for x/y positioning using the standard x and y component config options.</p>\r
14  * <p>This class is intended to be extended or created via the <tt><b>{@link Ext.Container#layout layout}</b></tt>\r
15  * configuration property.  See <tt><b>{@link Ext.Container#layout}</b></tt> for additional details.</p>\r
16  * <p>Example usage:</p>\r
17  * <pre><code>\r
18 var form = new Ext.form.FormPanel({\r
19     title: 'Absolute Layout',\r
20     layout:'absolute',\r
21     layoutConfig: {\r
22         // layout-specific configs go here\r
23         extraCls: 'x-abs-layout-item',\r
24     },\r
25     baseCls: 'x-plain',\r
26     url:'save-form.php',\r
27     defaultType: 'textfield',\r
28     items: [{\r
29         x: 0,\r
30         y: 5,\r
31         xtype:'label',\r
32         text: 'Send To:'\r
33     },{\r
34         x: 60,\r
35         y: 0,\r
36         name: 'to',\r
37         anchor:'100%'  // anchor width by percentage\r
38     },{\r
39         x: 0,\r
40         y: 35,\r
41         xtype:'label',\r
42         text: 'Subject:'\r
43     },{\r
44         x: 60,\r
45         y: 30,\r
46         name: 'subject',\r
47         anchor: '100%'  // anchor width by percentage\r
48     },{\r
49         x:0,\r
50         y: 60,\r
51         xtype: 'textarea',\r
52         name: 'msg',\r
53         anchor: '100% 100%'  // anchor width and height\r
54     }]\r
55 });\r
56 </code></pre>\r
57  */\r
58 Ext.layout.AbsoluteLayout = Ext.extend(Ext.layout.AnchorLayout, {\r
59 \r
60     extraCls: 'x-abs-layout-item',\r
61 \r
62     onLayout : function(ct, target){\r
63         target.position();\r
64         this.paddingLeft = target.getPadding('l');\r
65         this.paddingTop = target.getPadding('t');\r
66 \r
67         Ext.layout.AbsoluteLayout.superclass.onLayout.call(this, ct, target);\r
68     },\r
69 \r
70     // private\r
71     adjustWidthAnchor : function(value, comp){\r
72         return value ? value - comp.getPosition(true)[0] + this.paddingLeft : value;\r
73     },\r
74 \r
75     // private\r
76     adjustHeightAnchor : function(value, comp){\r
77         return  value ? value - comp.getPosition(true)[1] + this.paddingTop : value;\r
78     }\r
79     <div id="prop-Ext.layout.AbsoluteLayout-activeItem"></div>/**\r
80      * @property activeItem\r
81      * @hide\r
82      */\r
83 });\r
84 Ext.Container.LAYOUTS['absolute'] = Ext.layout.AbsoluteLayout;
85 </pre>    \r
86 </body>\r
87 </html>