1 | /* |
---|
2 | * Ext JS Library 2.2.1 |
---|
3 | * Copyright(c) 2006-2009, Ext JS, LLC. |
---|
4 | * licensing@extjs.com |
---|
5 | * |
---|
6 | * http://extjs.com/license |
---|
7 | */ |
---|
8 | |
---|
9 | /** |
---|
10 | * @class Ext.layout.AbsoluteLayout |
---|
11 | * @extends Ext.layout.AnchorLayout |
---|
12 | * <p>Inherits the anchoring of {@link Ext.layout.AnchorLayout} and adds the ability for x/y positioning using the |
---|
13 | * standard x and y component config options.</p> |
---|
14 | */ |
---|
15 | Ext.layout.AbsoluteLayout = Ext.extend(Ext.layout.AnchorLayout, { |
---|
16 | /** |
---|
17 | * @cfg {String} extraCls |
---|
18 | * An optional extra CSS class that will be added to the container (defaults to 'x-abs-layout-item'). This can be useful for |
---|
19 | * adding customized styles to the container or any of its children using standard CSS rules. |
---|
20 | */ |
---|
21 | extraCls: 'x-abs-layout-item', |
---|
22 | isForm: false, |
---|
23 | // private |
---|
24 | setContainer : function(ct){ |
---|
25 | Ext.layout.AbsoluteLayout.superclass.setContainer.call(this, ct); |
---|
26 | if(ct.isXType('form')){ |
---|
27 | this.isForm = true; |
---|
28 | } |
---|
29 | }, |
---|
30 | |
---|
31 | onLayout : function(ct, target){ |
---|
32 | if(this.isForm){ ct.body.position(); } else { target.position(); } |
---|
33 | Ext.layout.AbsoluteLayout.superclass.onLayout.call(this, ct, target); |
---|
34 | }, |
---|
35 | |
---|
36 | // private |
---|
37 | getAnchorViewSize : function(ct, target){ |
---|
38 | return this.isForm ? ct.body.getStyleSize() : Ext.layout.AbsoluteLayout.superclass.getAnchorViewSize.call(this, ct, target); |
---|
39 | }, |
---|
40 | |
---|
41 | // private |
---|
42 | isValidParent : function(c, target){ |
---|
43 | return this.isForm ? true : Ext.layout.AbsoluteLayout.superclass.isValidParent.call(this, c, target); |
---|
44 | }, |
---|
45 | |
---|
46 | // private |
---|
47 | adjustWidthAnchor : function(value, comp){ |
---|
48 | return value ? value - comp.getPosition(true)[0] : value; |
---|
49 | }, |
---|
50 | |
---|
51 | // private |
---|
52 | adjustHeightAnchor : function(value, comp){ |
---|
53 | return value ? value - comp.getPosition(true)[1] : value; |
---|
54 | } |
---|
55 | /** |
---|
56 | * @property activeItem |
---|
57 | * @hide |
---|
58 | */ |
---|
59 | }); |
---|
60 | Ext.Container.LAYOUTS['absolute'] = Ext.layout.AbsoluteLayout; |
---|