sync
[roojs1] / Roo / bootstrap / panel / Content.js
index 02d4bd8..e6c589b 100644 (file)
@@ -28,6 +28,8 @@
  * @cfg {Boolean} loadOnce      When used with {@link #url}, calls {@link #setUrl} with this value
  * @cfg {String}    content        Raw content to fill content panel with (uses setContent on construction.)
  * @cfg {Boolean} badges render the badges
+ * @cfg {String} cls  extra classes to use  
+ * @cfg {String} background (primary|secondary|success|info|warning|danger|light|dark)
 
  * @constructor
  * Create a new ContentPanel.
@@ -55,10 +57,13 @@ Roo.bootstrap.panel.Content = function( config){
             this.el = Roo.DomHelper.append(document.body,
                         config.autoCreate, true);
         }else{
-            var elcfg =  {   tag: "div",
-                            cls: "roo-layout-inactive-content",
-                            id: config.id||el
-                            };
+            var elcfg =  {
+                tag: "div",
+                cls: (config.cls || '') +
+                    (config.background ? ' bg-' + config.background : '') +
+                    " roo-layout-inactive-content",
+                id: config.id||el
+            };
             if (config.html) {
                 elcfg.html = config.html;
                 
@@ -194,6 +199,9 @@ Roo.bootstrap.panel.Content = function( config){
 
 Roo.extend(Roo.bootstrap.panel.Content, Roo.bootstrap.Component, {
     
+    cls : '',
+    background : '',
+    
     tabTip : '',
     
     setRegion : function(region){
@@ -226,10 +234,13 @@ Roo.extend(Roo.bootstrap.panel.Content, Roo.bootstrap.Component, {
         this.active = active;
         this.setActiveClass(active);
         if(!active){
-            this.fireEvent("deactivate", this);
-        }else{
-            this.fireEvent("activate", this);
+            if(this.fireEvent("deactivate", this) === false){
+                return false;
+            }
+            return true;
         }
+        this.fireEvent("activate", this);
+        return true;
     },
     /**
      * Updates this panel's element
@@ -333,33 +344,22 @@ panel.load({
     adjustForComponents : function(width, height)
     {
         //Roo.log('adjustForComponents ');
-        if(this.title == 'Log Grid'){
-            Roo.log('adjustForComponents ');
-            Roo.log(this.resizeEl);
-            Roo.log(this.el);
-            Roo.log(this.adjustments);
-            Roo.log([width, height]);
-        }
         if(this.resizeEl != this.el){
             width -= this.el.getFrameWidth('lr');
             height -= this.el.getFrameWidth('tb');
         }
         if(this.toolbar){
             var te = this.toolbar.getEl();
-            Roo.log(te);
-            Roo.log('tool bar height!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1');
-            Roo.log(te.getHeight(true));
-            height -= te.getHeight();
             te.setWidth(width);
+            height -= te.getHeight();
         }
         if(this.footer){
             var te = this.footer.getEl();
-            Roo.log("footer:" + te.getHeight());
-            
-            height -= te.getHeight();
             te.setWidth(width);
+            height -= te.getHeight();
         }
         
+        
         if(this.adjustments){
             width += this.adjustments[0];
             height += this.adjustments[1];