summaryrefslogtreecommitdiff
path: root/frontend/beta/js/YUI-extensions/layout/BorderLayoutRegions.js
Unidiff
Diffstat (limited to 'frontend/beta/js/YUI-extensions/layout/BorderLayoutRegions.js') (more/less context) (show whitespace changes)
-rw-r--r--frontend/beta/js/YUI-extensions/layout/BorderLayoutRegions.js207
1 files changed, 207 insertions, 0 deletions
diff --git a/frontend/beta/js/YUI-extensions/layout/BorderLayoutRegions.js b/frontend/beta/js/YUI-extensions/layout/BorderLayoutRegions.js
new file mode 100644
index 0000000..9b4a09f
--- a/dev/null
+++ b/frontend/beta/js/YUI-extensions/layout/BorderLayoutRegions.js
@@ -0,0 +1,207 @@
1/*
2 * These classes are private internal classes
3 */
4YAHOO.ext.CenterLayoutRegion = function(mgr, config){
5 YAHOO.ext.CenterLayoutRegion.superclass.constructor.call(this, mgr, config, 'center');
6 this.visible = true;
7 this.minWidth = config.minWidth || 20;
8 this.minHeight = config.minHeight || 20;
9};
10
11YAHOO.extendX(YAHOO.ext.CenterLayoutRegion, YAHOO.ext.LayoutRegion, {
12 hide : function(){
13 // center panel can't be hidden
14 },
15
16 show : function(){
17 // center panel can't be hidden
18 },
19
20 getMinWidth: function(){
21 return this.minWidth;
22 },
23
24 getMinHeight: function(){
25 return this.minHeight;
26 }
27});
28
29
30YAHOO.ext.NorthLayoutRegion = function(mgr, config){
31 YAHOO.ext.NorthLayoutRegion.superclass.constructor.call(this, mgr, config, 'north', 'n-resize');
32 if(this.split){
33 this.split.placement = YAHOO.ext.SplitBar.TOP;
34 this.split.orientation = YAHOO.ext.SplitBar.VERTICAL;
35 this.split.el.addClass('ylayout-split-v');
36 }
37 if(typeof config.initialSize != 'undefined'){
38 this.el.setHeight(config.initialSize);
39 }
40};
41YAHOO.extendX(YAHOO.ext.NorthLayoutRegion, YAHOO.ext.SplitLayoutRegion, {
42 getBox : function(){
43 if(this.collapsed){
44 return this.collapsedEl.getBox();
45 }
46 var box = this.el.getBox();
47 if(this.split){
48 box.height += this.split.el.getHeight();
49 }
50 return box;
51 },
52
53 updateBox : function(box){
54 if(this.split && !this.collapsed){
55 box.height -= this.split.el.getHeight();
56 this.split.el.setLeft(box.x);
57 this.split.el.setTop(box.y+box.height);
58 this.split.el.setWidth(box.width);
59 }
60 if(this.collapsed){
61 this.el.setWidth(box.width);
62 var bodyWidth = box.width - this.el.getBorderWidth('rl');
63 this.bodyEl.setWidth(bodyWidth);
64 if(this.activePanel && this.panelSize){
65 this.activePanel.setSize(bodyWidth, this.panelSize.height);
66 }
67 }
68 YAHOO.ext.NorthLayoutRegion.superclass.updateBox.call(this, box);
69 }
70});
71
72YAHOO.ext.SouthLayoutRegion = function(mgr, config){
73 YAHOO.ext.SouthLayoutRegion.superclass.constructor.call(this, mgr, config, 'south', 's-resize');
74 if(this.split){
75 this.split.placement = YAHOO.ext.SplitBar.BOTTOM;
76 this.split.orientation = YAHOO.ext.SplitBar.VERTICAL;
77 this.split.el.addClass('ylayout-split-v');
78 }
79 if(typeof config.initialSize != 'undefined'){
80 this.el.setHeight(config.initialSize);
81 }
82};
83YAHOO.extendX(YAHOO.ext.SouthLayoutRegion, YAHOO.ext.SplitLayoutRegion, {
84 getBox : function(){
85 if(this.collapsed){
86 return this.collapsedEl.getBox();
87 }
88 var box = this.el.getBox();
89 if(this.split){
90 var sh = this.split.el.getHeight();
91 box.height += sh;
92 box.y -= sh;
93 }
94 return box;
95 },
96
97 updateBox : function(box){
98 if(this.split && !this.collapsed){
99 var sh = this.split.el.getHeight();
100 box.height -= sh;
101 box.y += sh;
102 this.split.el.setLeft(box.x);
103 this.split.el.setTop(box.y-sh);
104 this.split.el.setWidth(box.width);
105 }
106 if(this.collapsed){
107 this.el.setWidth(box.width);
108 var bodyWidth = box.width - this.el.getBorderWidth('rl');
109 this.bodyEl.setWidth(bodyWidth);
110 if(this.activePanel && this.panelSize){
111 this.activePanel.setSize(bodyWidth, this.panelSize.height);
112 }
113 }
114 YAHOO.ext.SouthLayoutRegion.superclass.updateBox.call(this, box);
115 }
116});
117
118YAHOO.ext.EastLayoutRegion = function(mgr, config){
119 YAHOO.ext.EastLayoutRegion.superclass.constructor.call(this, mgr, config, 'east', 'e-resize');
120 if(this.split){
121 this.split.placement = YAHOO.ext.SplitBar.RIGHT;
122 this.split.orientation = YAHOO.ext.SplitBar.HORIZONTAL;
123 this.split.el.addClass('ylayout-split-h');
124 }
125 if(typeof config.initialSize != 'undefined'){
126 this.el.setWidth(config.initialSize);
127 }
128};
129YAHOO.extendX(YAHOO.ext.EastLayoutRegion, YAHOO.ext.SplitLayoutRegion, {
130 getBox : function(){
131 if(this.collapsed){
132 return this.collapsedEl.getBox();
133 }
134 var box = this.el.getBox();
135 if(this.split){
136 var sw = this.split.el.getWidth();
137 box.width += sw;
138 box.x -= sw;
139 }
140 return box;
141 },
142
143 updateBox : function(box){
144 if(this.split && !this.collapsed){
145 var sw = this.split.el.getWidth();
146 box.width -= sw;
147 this.split.el.setLeft(box.x);
148 this.split.el.setTop(box.y);
149 this.split.el.setHeight(box.height);
150 box.x += sw;
151 }
152 if(this.collapsed){
153 this.el.setHeight(box.height);
154 var bodyHeight = this.config.titlebar ? box.height - (this.titleEl.getHeight()||0) : box.height;
155 bodyHeight -= this.el.getBorderWidth('tb');
156 this.bodyEl.setHeight(bodyHeight);
157 if(this.activePanel && this.panelSize){
158 this.activePanel.setSize(this.panelSize.width, bodyHeight);
159 }
160 }
161 YAHOO.ext.EastLayoutRegion.superclass.updateBox.call(this, box);
162 }
163});
164
165YAHOO.ext.WestLayoutRegion = function(mgr, config){
166 YAHOO.ext.WestLayoutRegion.superclass.constructor.call(this, mgr, config, 'west', 'w-resize');
167 if(this.split){
168 this.split.placement = YAHOO.ext.SplitBar.LEFT;
169 this.split.orientation = YAHOO.ext.SplitBar.HORIZONTAL;
170 this.split.el.addClass('ylayout-split-h');
171 }
172 if(typeof config.initialSize != 'undefined'){
173 this.el.setWidth(config.initialSize);
174 }
175};
176YAHOO.extendX(YAHOO.ext.WestLayoutRegion, YAHOO.ext.SplitLayoutRegion, {
177 getBox : function(){
178 if(this.collapsed){
179 return this.collapsedEl.getBox();
180 }
181 var box = this.el.getBox();
182 if(this.split){
183 box.width += this.split.el.getWidth();
184 }
185 return box;
186 },
187
188 updateBox : function(box){
189 if(this.split && !this.collapsed){
190 var sw = this.split.el.getWidth();
191 box.width -= sw;
192 this.split.el.setLeft(box.x+box.width);
193 this.split.el.setTop(box.y);
194 this.split.el.setHeight(box.height);
195 }
196 if(this.collapsed){
197 this.el.setHeight(box.height);
198 var bodyHeight = this.config.titlebar ? box.height - (this.titleEl.getHeight()||0) : box.height;
199 bodyHeight -= this.el.getBorderWidth('tb');
200 this.bodyEl.setHeight(bodyHeight);
201 if(this.activePanel && this.panelSize){
202 this.activePanel.setSize(this.panelSize.width, bodyHeight);
203 }
204 }
205 YAHOO.ext.WestLayoutRegion.superclass.updateBox.call(this, box);
206 }
207});