From: Alan Date: Tue, 15 Mar 2022 07:22:21 +0000 (+0800) Subject: roojs-ui.js X-Git-Url: http://git.roojs.org/?p=roojs1;a=commitdiff_plain;h=4294972a798885995317bc389614f5bb4ee708d7 roojs-ui.js roojs-ui-debug.js roojs-all.js roojs-debug.js Roo/Button.js --- diff --git a/Roo/Button.js b/Roo/Button.js index c3cc8d6ee8..9bcd179fee 100644 --- a/Roo/Button.js +++ b/Roo/Button.js @@ -375,8 +375,7 @@ Roo.extend(Roo.Button, Roo.util.Observable, { */ setPressed : function(state) { - - if(state != this.pressed){ + if(state != this.pressed){ if(state){ this.el.addClass("x-btn-pressed"); this.pressed = true; @@ -385,7 +384,7 @@ Roo.extend(Roo.Button, Roo.util.Observable, { this.pressed = false; } } - } + }, /** * If a state it passed, it becomes the pressed state otherwise the current state is toggled. diff --git a/roojs-all.js b/roojs-all.js index 935e36c06c..b86dbfabf1 100644 --- a/roojs-all.js +++ b/roojs-all.js @@ -1213,14 +1213,15 @@ B.on("mousedown",this.onMouseDown,this);}B.on(this.clickEvent,this.onClick,this) if(Roo.isIE7&&Roo.isStrict){var ib=this.el.child('button');if(ib&&ib.getWidth()>20){ib.clip();ib.setWidth(Roo.util.TextMetrics.measure(ib,this.text).width+ib.getFrameWidth('lr'));}}if(this.minWidth){if(this.hidden){this.el.beginMeasure();}if(this.el.getWidth()','','',"
 
",'','',"
 
"); var C=B.append(A,[this.text,this.type],true);var D=C.child("button");if(this.cls){C.addClass(this.cls);}if(this.icon){D.setStyle('background-image','url('+this.icon+')');}if(this.iconCls){D.addClass(this.iconCls);if(!this.cls){C.addClass(this.text?'x-btn-text-icon':'x-btn-icon'); diff --git a/roojs-debug.js b/roojs-debug.js index f8171da4eb..2a3a5af4e6 100644 --- a/roojs-debug.js +++ b/roojs-debug.js @@ -31134,7 +31134,23 @@ Roo.extend(Roo.Button, Roo.util.Observable, { this.hide(); } }, - + /** + * Similar to toggle, but does not trigger event. + * @param {Boolean} state [required] Force a particular state + */ + setPressed : function(state) + { + if(state != this.pressed){ + if(state){ + this.el.addClass("x-btn-pressed"); + this.pressed = true; + }else{ + this.el.removeClass("x-btn-pressed"); + this.pressed = false; + } + } + } + /** * If a state it passed, it becomes the pressed state otherwise the current state is toggled. * @param {Boolean} state (optional) Force a particular state @@ -31157,6 +31173,8 @@ Roo.extend(Roo.Button, Roo.util.Observable, { } }, + + /** * Focus the button */ diff --git a/roojs-ui-debug.js b/roojs-ui-debug.js index 4accc54a53..62eacbf414 100644 --- a/roojs-ui-debug.js +++ b/roojs-ui-debug.js @@ -6642,7 +6642,23 @@ Roo.extend(Roo.Button, Roo.util.Observable, { this.hide(); } }, - + /** + * Similar to toggle, but does not trigger event. + * @param {Boolean} state [required] Force a particular state + */ + setPressed : function(state) + { + if(state != this.pressed){ + if(state){ + this.el.addClass("x-btn-pressed"); + this.pressed = true; + }else{ + this.el.removeClass("x-btn-pressed"); + this.pressed = false; + } + } + } + /** * If a state it passed, it becomes the pressed state otherwise the current state is toggled. * @param {Boolean} state (optional) Force a particular state @@ -6665,6 +6681,8 @@ Roo.extend(Roo.Button, Roo.util.Observable, { } }, + + /** * Focus the button */ diff --git a/roojs-ui.js b/roojs-ui.js index 337071f55b..a48c35d5b2 100644 --- a/roojs-ui.js +++ b/roojs-ui.js @@ -267,14 +267,15 @@ B.on("mousedown",this.onMouseDown,this);}B.on(this.clickEvent,this.onClick,this) if(Roo.isIE7&&Roo.isStrict){var ib=this.el.child('button');if(ib&&ib.getWidth()>20){ib.clip();ib.setWidth(Roo.util.TextMetrics.measure(ib,this.text).width+ib.getFrameWidth('lr'));}}if(this.minWidth){if(this.hidden){this.el.beginMeasure();}if(this.el.getWidth()','','',"
 
",'','',"
 
"); var C=B.append(A,[this.text,this.type],true);var D=C.child("button");if(this.cls){C.addClass(this.cls);}if(this.icon){D.setStyle('background-image','url('+this.icon+')');}if(this.iconCls){D.addClass(this.iconCls);if(!this.cls){C.addClass(this.text?'x-btn-text-icon':'x-btn-icon');