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