summaryrefslogtreecommitdiff
path: root/swat.obsolete/style/qooxdoo/widgets/widgets/QxButton.js
blob: 4c4c8def0733f1bd60e9a8a89869e93d2268e297 (plain)
1
2
/* Copyright (c): 2002-2005 (Germany): United Internet, 1&1, GMX, Schlund+Partner, Alturo */
function QxButton(vText,vIcon){QxAtom.call(this,vText,vIcon);this.setCanSelect(false);this.setTabIndex(1);this.setBorder(QxBorder.presets.outset);this.addEventListener("mouseover",this._onmouseover,this);this.addEventListener("mouseout",this._onmouseout,this);this.addEventListener("mousedown",this._g1,this);this.addEventListener("mouseup",this._g2,this);this.addEventListener("keydown",this._g4,this);this.addEventListener("click",this._g3,this);};QxButton.extend(QxAtom,"QxButton");proto._onmouseover=function(e){if(e.getActiveTarget()!=this){return;};this.setState(this._pressed?"pressed":"hover");e.stopPropagation();};proto._onmouseout=function(e){if(e.getActiveTarget()!=this){return;};this.setState(null);e.stopPropagation();};proto._g1=function(e){this._pressed=true;this.setCapture(true);this.setState("pressed");};proto._g2=function(e){delete this._pressed;this.setCapture(false);this.setState(null);e.stopPropagation();};proto._g4=function(e){if(e.getKeyCode()==QxKeyEvent.keys.enter){this.execute();};};proto._g3=function(e){this.execute();};proto._modifyState=function(_b1,_b2,_b3,_b4){switch(_b1){case "pressed":this.setBorder(QxBorder.presets.inset);break;case "hover":break;default:this.setBorder(QxBorder.presets.outset);};return QxAtom.prototype._modifyState.call(this,_b1,_b2,_b3,_b4);};proto.dispose=function(){if(this.getDisposed()){return;};this.removeEventListener("mouseover",this._onmouseover,this);this.removeEventListener("mouseout",this._onmouseout,this);this.removeEventListener("mousedown",this._g1,this);this.removeEventListener("mouseup",this._g2,this);return QxAtom.prototype.dispose.call(this);};