From 13acff5ed259e7b5859fd2324ea7740b8f9e5fd7 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 7 Sep 2007 03:08:44 +0000 Subject: r24985: Start to revert us back to the old-style SWAT, while trying not to loose some of the fixes in the meantime. Andrew Bartlett --- swat/style/qooxdoo/widgets/widgets/QxTextField.js | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 swat/style/qooxdoo/widgets/widgets/QxTextField.js (limited to 'swat/style/qooxdoo/widgets/widgets/QxTextField.js') diff --git a/swat/style/qooxdoo/widgets/widgets/QxTextField.js b/swat/style/qooxdoo/widgets/widgets/QxTextField.js new file mode 100644 index 00000000000..82a0571c972 --- /dev/null +++ b/swat/style/qooxdoo/widgets/widgets/QxTextField.js @@ -0,0 +1,2 @@ +/* Copyright (c): 2002-2005 (Germany): United Internet, 1&1, GMX, Schlund+Partner, Alturo */ +function QxTextField(vText){QxWidget.call(this);if(isValid(vText)){this.setText(vText);};this.setHtmlProperty("type","text");this.setTabIndex(1);this.setCanSelect(true);this.setTagName("INPUT");this.setTextAlign("left");this.addEventListener("blur",this._onblur);this.addEventListener("focus",this._onfocus);};QxTextField.extend(QxWidget,"QxTextField");QxTextField.addProperty({name:"text",type:String,defaultValue:""});QxTextField.addProperty({name:"maxLength",type:Number});QxTextField.addProperty({name:"readOnly",type:Boolean});QxTextField.addProperty({name:"selectionStart",type:Number});QxTextField.addProperty({name:"selectionLength",type:Number});QxTextField.addProperty({name:"selectionText",type:String});proto._clonePropertyIgnoreList+=",selectionStart,selectionLength,selectionText";proto._checkText=function(_b1,_b2,_b3,_b4){return typeof _b1=="string"?_b1:"";};proto._modifyText=function(_b1,_b2,_b3,_b4){return this.setHtmlProperty("value",_b1);};proto._modifyMaxLength=function(_b1,_b2,_b3,_b4){return this.setHtmlProperty("maxLength",_b1);};proto._modifyReadOnly=function(_b1,_b2,_b3,_b4){return this.setHtmlProperty("readOnly",_b1);};if((new QxClient).isGecko()){proto._visualizeFocus=function(){this.setCssClassName(this.getCssClassName().add("QxFocused"," ").add(this.classname+"-Focused"," "));try{this.getElement().readOnly=true;this.getElement().focus();this.getElement().readOnly=this.getReadOnly();}catch(ex){};return true;};proto._addInlineEvents=function(el){el.addEventListener("input",QxWidget.__oninlineevent,false);return QxWidget.prototype._addInlineEvents.call(this,el);};proto._removeInlineEvents=function(el){el.removeEventListener("input",QxWidget.__oninlineevent,false);return QxWidget.prototype._removeInlineEvents.call(this,el);};};proto.getPreferredWidth=function(){var el=this.getElement();if(el){var w=el.style.width;el.style.width="";var o=el.offsetWidth;el.style.width=isValid(w)?w:"";return o;};return 0;};proto.getPreferredHeight=function(){var el=this.getElement();if(el){var h=el.style.height;el.style.height="";var o=el.offsetHeight;el.style.height=isValid(h)?h:"";return o;};return 0;};proto._textOnFocus=null;proto._ontabfocus=function(e){this.selectAll();};proto._onfocus=function(e){this._textOnFocus=this.getElement().value;};proto._onblur=function(e){if(this._textOnFocus!=this.getElement().value){this.setText(this.getElement().value);};this.setSelectionLength(0);};proto._oninlineevent=function(e){if(!e){e=this.getTopLevelWidget().getDocumentElement().parentWindow.event;};switch(e.type){case "input":if(this.hasEventListeners("input")){this.dispatchEvent(new QxDataEvent("input",this.getElement().value));};return true;case "propertychange":if(e.propertyName=="value"){if(this.hasEventListeners("input")){this.dispatchEvent(new QxDataEvent("input",this.getElement().value));};return true;};break;};return QxWidget.prototype._oninlineevent.call(this,e);};if((new QxClient).isMshtml()){proto._getRange=function(){this._visualPropertyCheck();return this.getElement().createTextRange();};proto._getSelectionRange=function(){this._visualPropertyCheck();return this.getTopLevelWidget().getDocumentElement().selection.createRange();};proto.setSelectionStart=function(vStart){this._visualPropertyCheck();var vText=this.getElement().value;var i=0;while(i