d4ccacf984b4dc1e287495ea541b7021b242f09b
[roojs1] / Roo / bootstrap / layout / West.js
1
2 Roo.bootstrap.layout.West = function(config){
3     config.region = "west";
4     config.cursor = "w-resize";
5     
6     Roo.bootstrap.layout.Split.call(this, config);
7     if(this.split){
8         this.split.placement = Roo.bootstrap.SplitBar.LEFT;
9         this.split.orientation = Roo.bootstrap.SplitBar.HORIZONTAL;
10         this.split.el.addClass("roo-layout-split-h");
11     }
12     
13 };
14 Roo.extend(Roo.bootstrap.layout.West, Roo.bootstrap.layout.Split, {
15     orientation: Roo.bootstrap.SplitBar.HORIZONTAL,
16     
17     onRender: function(ctr, pos)
18     {
19         Roo.bootstrap.layout.West.superclass.onRender.call(this, ctr,pos);
20         var size = this.config.initialSize || this.config.width;
21         if(typeof size != "undefined"){
22             this.el.setWidth(size);
23         }
24     },
25     
26     getBox : function(){
27         if(this.collapsed){
28             return this.collapsedEl.getBox();
29         }
30         var box = this.el.getBox();
31         if(this.split){
32             box.width += this.split.el.getWidth();
33         }
34         return box;
35     },
36     
37     updateBox : function(box){
38         if(this.split && !this.collapsed){
39             var sw = this.split.el.getWidth();
40             box.width -= sw;
41             this.split.el.setLeft(box.x+box.width);
42             this.split.el.setTop(box.y);
43             this.split.el.setHeight(box.height);
44         }
45         if(this.collapsed){
46             this.updateBody(null, box.height);
47         }
48         Roo.bootstrap.layout.Region.prototype.updateBox.call(this, box);
49     }
50 });