Roo/bootstrap/Navbar.js
[roojs1] / Roo / bootstrap / Navbar.js
1 /*
2  * - LGPL
3  *
4  * navbar
5  * 
6  */
7
8 /**
9  * @class Roo.bootstrap.Navbar
10  * @extends Roo.bootstrap.Component
11  * Bootstrap Navbar class
12  * @cfg {String} position (fixed-top|fixed-bottom|static-top) position
13  * @cfg {String} brand what is brand
14  * @cfg {Boolean} inverse is inverted color
15  * @cfg {String} type (nav | pills | tabs)
16  * @cfg {Boolean} arrangement stacked | justified
17  * @cfg {String} align (left | right) alignment
18  * @cfg {String} brand_href href of the brand
19  * @cfg {Boolean} main (true|false) main nav bar? default false
20  * @cfg {Boolean} loadMask (true|false) loadMask on the bar
21  * @cfg {String} tag (header|footer|nav|div) default is nav 
22
23  * 
24  * @constructor
25  * Create a new Navbar
26  * @param {Object} config The config object
27  */
28
29
30 Roo.bootstrap.Navbar = function(config){
31     Roo.bootstrap.Navbar.superclass.constructor.call(this, config);
32     
33 };
34
35 Roo.extend(Roo.bootstrap.Navbar, Roo.bootstrap.Component,  {
36     
37     
38    
39     // private
40     navItems : false,
41     
42     getAutoCreate : function(){
43         
44         
45         throw { message : "nav bar is now a abstract base class - use SimpleBar / HeaderBar / SideBar etc..."};
46         
47     },
48     
49     initEvents :function ()
50     {
51         //Roo.log(this.el.select('.navbar-toggle',true));
52         this.el.select('.navbar-toggle',true).on('click', function() {
53            // Roo.log('click');
54             this.el.select('.navbar-collapse',true).toggleClass('in');                                 
55         }, this);
56         
57         var mark = {
58             tag: "div",
59             cls:"x-dlg-mask"
60         }
61         
62         this.maskEl = Roo.DomHelper.append(this.el, mark, true);
63         
64         var size = this.el.getSize();
65         this.maskEl.setSize(size.width, size.height);
66         this.maskEl.enableDisplayMode("block");
67         this.maskEl.hide();
68         
69         if(this.loadMask){
70             this.maskEl.show();
71         }
72     },
73     
74     
75     getChildContainer : function()
76     {
77         if (this.el.select('.collapse').getCount()) {
78             return this.el.select('.collapse',true).first();
79         }
80         
81         return this.el;
82     },
83     
84     mask : function()
85     {
86         this.maskEl.show();
87     },
88     
89     unmask : function()
90     {
91         this.maskEl.hide();
92     }
93     
94     
95     
96 });
97
98
99
100  
101
102