Roo/bootstrap/Button.js
[roojs1] / Roo / bootstrap / Button.js
index a890663..4b2d5b9 100644 (file)
@@ -95,9 +95,9 @@ Roo.extend(Roo.bootstrap.Button, Roo.bootstrap.Component,  {
         } else {
             cfg.tag = this.tag;
         }
-        cfg.html = this.html || cfg.html;
+        cfg.html = '<span class="roo-button-text">' + (this.html || cfg.html) + '</span>';
         
-        if (this.toggle === true) {
+        if (this.toggle == true) {
             cfg={
                 tag: 'div',
                 cls: 'slider-frame roo-button',
@@ -292,22 +292,49 @@ Roo.extend(Roo.bootstrap.Button, Roo.bootstrap.Component,  {
         
         this.fireEvent('click', this, e);
     },
+    
+    /**
+     * Enables this button
+     */
     enable : function()
     {
         this.disabled = false;
         this.el.removeClass('disabled');
     },
+    
+    /**
+     * Disable this button
+     */
     disable : function()
     {
         this.disabled = true;
         this.el.addClass('disabled');
     },
-    setDisabled : function(v) {
-        
-        this[v ? 'disable' : 'enable']();
+     /**
+     * sets the active state on/off, 
+     * @param {Boolean} state (optional) Force a particular state
+     */
+    setActive : function(v) {
         
+        this.el[v ? 'addClass' : 'removeClass']('active');
+    },
+     /**
+     * toggles the current active state 
+     */
+    toggleActive : function()
+    {
+       var active = this.el.hasClass('active');
+       this.setActive(!active);
+       
         
+    },
+    setText : function(str)
+    {
+        this.el.select('.roo-button-text',true).first().dom.innerHTML = str;
     }
+    
+    
+    
 });
 
  
\ No newline at end of file