rename swat => swat2, so that we don't conflict with samba3
[samba.git] / swat2 / style / qooxdoo / widgets / widgets / QxIframe.js
1 /* Copyright (c): 2002-2005 (Germany): United Internet, 1&1, GMX, Schlund+Partner, Alturo */
2 function QxIframe(vSrc){QxWidget.call(this);this.setTabIndex(0);var o=this;this.__onreadystatechange=function(e){return o._onreadystatechange(e);};this.__onload=function(e){return o._onload(e);};if(isValid(vSrc)){this.setSrc(vSrc);};};QxIframe.extend(QxWidget,"QxIframe");QxIframe.addProperty({name:"src",type:String,defaultValue:"javascript:void(0)"});proto._realFrame=null;proto._modifyElement=function(_b1,_b2,_b3,_b4){if(!this._realFrame){this._realFrame=QxIframe._h3.cloneNode(true);if((new QxClient).isMshtml()){this._realFrame.onreadystatechange=this.__onreadystatechange;}else{this._realFrame.onload=this.__onload;};};_b1.appendChild(this._realFrame);this._renderSrc();QxWidget.prototype._modifyElement.call(this,_b1,_b2,_b3,_b4);return true;};proto._modifySrc=function(_b1,_b2,_b3,_b4){if(this.isCreated()){this._renderSrc();};return true;};proto.getIframe=function(){return this._realFrame;};proto._renderSrc=function(){var currentSrc=this.getSrc();this._isLoaded=false;this._realFrame.src=isValid(currentSrc)?currentSrc:"javascript:void(0)";};proto._onreadystatechange=function(){if(this._realFrame.readyState=="complete"){this.dispatchEvent(new QxEvent("load"));};};proto._onload=function(){this._isLoaded=true;this.dispatchEvent(new QxEvent("load"));};if((new QxClient).isMshtml()){proto.getContentWindow=function(){if(this.isCreated()){try{return this.getElement().contentWindow;}catch(ex){};};return null;};proto.getContentDocument=function(){var win=this.getContentWindow();return win?win.document:null;};}else {proto.getContentWindow=function(){var doc=this.getContentDocument();return doc?doc.defaultView:null;};proto.getContentDocument=function(){if(this.isCreated()){try{return this.getElement().contentDocument;}catch(ex){};};return null;};};proto._isLoaded=false;if((new QxClient).isMshtml()){proto.isLoaded=function(){var doc=this.getContentDocument();return doc?doc.readyState=="complete":false;};}else {proto.isLoaded=function(){return this._isLoaded;};};proto.dispose=function(){if(this.getDisposed()){return;};if(this.isCreated()&&this._realFrame){this.getElement().removeChild(this._realFrame);};this._realFrame=null;QxWidget.prototype.dispose.call(this);};QxIframe.init=function(){var f=QxIframe._h3=document.createElement("iframe");f.frameBorder="0";f.frameSpacing="0";f.marginWidth="0";f.marginHeight="0";f.width="100%";f.height="100%";f.hspace="0";f.vspace="0";f.border="0";f.scrolling="auto";f.unselectable="on";f.src="javascript:void(0)";f.className="QxIframeFrame";f.allowTransparency="true";};QxIframe.init();