try and get ctrl-enter to add a clear all
[roojs1] / Roo / CenterLayoutRegion.js
1 /*
2  * Based on:
3  * Ext JS Library 1.1.1
4  * Copyright(c) 2006-2007, Ext JS, LLC.
5  *
6  * Originally Released Under LGPL - original licence link has changed is not relivant.
7  *
8  * Fork - LGPL
9  * <script type="text/javascript">
10  */
11 /*
12  * These classes are private internal classes
13  */
14 Roo.CenterLayoutRegion = function(mgr, config){
15     Roo.LayoutRegion.call(this, mgr, config, "center");
16     this.visible = true;
17     this.minWidth = config.minWidth || 20;
18     this.minHeight = config.minHeight || 20;
19 };
20
21 Roo.extend(Roo.CenterLayoutRegion, Roo.LayoutRegion, {
22     hide : function(){
23         // center panel can't be hidden
24     },
25     
26     show : function(){
27         // center panel can't be hidden
28     },
29     
30     getMinWidth: function(){
31         return this.minWidth;
32     },
33     
34     getMinHeight: function(){
35         return this.minHeight;
36     }
37 });
38
39
40 Roo.NorthLayoutRegion = function(mgr, config){
41     Roo.LayoutRegion.call(this, mgr, config, "north", "n-resize");
42     if(this.split){
43         this.split.placement = Roo.SplitBar.TOP;
44         this.split.orientation = Roo.SplitBar.VERTICAL;
45         this.split.el.addClass("x-layout-split-v");
46     }
47     var size = config.initialSize || config.height;
48     if(typeof size != "undefined"){
49         this.el.setHeight(size);
50     }
51 };
52 Roo.extend(Roo.NorthLayoutRegion, Roo.SplitLayoutRegion, {
53     orientation: Roo.SplitBar.VERTICAL,
54     getBox : function(){
55         if(this.collapsed){
56             return this.collapsedEl.getBox();
57         }
58         var box = this.el.getBox();
59         if(this.split){
60             box.height += this.split.el.getHeight();
61         }
62         return box;
63     },
64     
65     updateBox : function(box){
66         if(this.split && !this.collapsed){
67             box.height -= this.split.el.getHeight();
68             this.split.el.setLeft(box.x);
69             this.split.el.setTop(box.y+box.height);
70             this.split.el.setWidth(box.width);
71         }
72         if(this.collapsed){
73             this.updateBody(box.width, null);
74         }
75         Roo.LayoutRegion.prototype.updateBox.call(this, box);
76     }
77 });
78
79 Roo.SouthLayoutRegion = function(mgr, config){
80     Roo.SplitLayoutRegion.call(this, mgr, config, "south", "s-resize");
81     if(this.split){
82         this.split.placement = Roo.SplitBar.BOTTOM;
83         this.split.orientation = Roo.SplitBar.VERTICAL;
84         this.split.el.addClass("x-layout-split-v");
85     }
86     var size = config.initialSize || config.height;
87     if(typeof size != "undefined"){
88         this.el.setHeight(size);
89     }
90 };
91 Roo.extend(Roo.SouthLayoutRegion, Roo.SplitLayoutRegion, {
92     orientation: Roo.SplitBar.VERTICAL,
93     getBox : function(){
94         if(this.collapsed){
95             return this.collapsedEl.getBox();
96         }
97         var box = this.el.getBox();
98         if(this.split){
99             var sh = this.split.el.getHeight();
100             box.height += sh;
101             box.y -= sh;
102         }
103         return box;
104     },
105     
106     updateBox : function(box){
107         if(this.split && !this.collapsed){
108             var sh = this.split.el.getHeight();
109             box.height -= sh;
110             box.y += sh;
111             this.split.el.setLeft(box.x);
112             this.split.el.setTop(box.y-sh);
113             this.split.el.setWidth(box.width);
114         }
115         if(this.collapsed){
116             this.updateBody(box.width, null);
117         }
118         Roo.LayoutRegion.prototype.updateBox.call(this, box);
119     }
120 });
121
122 Roo.EastLayoutRegion = function(mgr, config){
123     Roo.SplitLayoutRegion.call(this, mgr, config, "east", "e-resize");
124     if(this.split){
125         this.split.placement = Roo.SplitBar.RIGHT;
126         this.split.orientation = Roo.SplitBar.HORIZONTAL;
127         this.split.el.addClass("x-layout-split-h");
128     }
129     var size = config.initialSize || config.width;
130     if(typeof size != "undefined"){
131         this.el.setWidth(size);
132     }
133 };
134 Roo.extend(Roo.EastLayoutRegion, Roo.SplitLayoutRegion, {
135     orientation: Roo.SplitBar.HORIZONTAL,
136     getBox : function(){
137         if(this.collapsed){
138             return this.collapsedEl.getBox();
139         }
140         var box = this.el.getBox();
141         if(this.split){
142             var sw = this.split.el.getWidth();
143             box.width += sw;
144             box.x -= sw;
145         }
146         return box;
147     },
148
149     updateBox : function(box){
150         if(this.split && !this.collapsed){
151             var sw = this.split.el.getWidth();
152             box.width -= sw;
153             this.split.el.setLeft(box.x);
154             this.split.el.setTop(box.y);
155             this.split.el.setHeight(box.height);
156             box.x += sw;
157         }
158         if(this.collapsed){
159             this.updateBody(null, box.height);
160         }
161         Roo.LayoutRegion.prototype.updateBox.call(this, box);
162     }
163 });
164
165 Roo.WestLayoutRegion = function(mgr, config){
166     Roo.SplitLayoutRegion.call(this, mgr, config, "west", "w-resize");
167     if(this.split){
168         this.split.placement = Roo.SplitBar.LEFT;
169         this.split.orientation = Roo.SplitBar.HORIZONTAL;
170         this.split.el.addClass("x-layout-split-h");
171     }
172     var size = config.initialSize || config.width;
173     if(typeof size != "undefined"){
174         this.el.setWidth(size);
175     }
176 };
177 Roo.extend(Roo.WestLayoutRegion, Roo.SplitLayoutRegion, {
178     orientation: Roo.SplitBar.HORIZONTAL,
179     getBox : function(){
180         if(this.collapsed){
181             return this.collapsedEl.getBox();
182         }
183         var box = this.el.getBox();
184         if(this.split){
185             box.width += this.split.el.getWidth();
186         }
187         return box;
188     },
189     
190     updateBox : function(box){
191         if(this.split && !this.collapsed){
192             var sw = this.split.el.getWidth();
193             box.width -= sw;
194             this.split.el.setLeft(box.x+box.width);
195             this.split.el.setTop(box.y);
196             this.split.el.setHeight(box.height);
197         }
198         if(this.collapsed){
199             this.updateBody(null, box.height);
200         }
201         Roo.LayoutRegion.prototype.updateBox.call(this, box);
202     }
203 });