r20445: add README file indicating that the swat directory is no longer relevant
[sfrench/samba-autobuild/.git] / swat.obsolete / style / qooxdoo / widgets / widgets / QxImagePreloader.js
1 /* Copyright (c): 2002-2005 (Germany): United Internet, 1&1, GMX, Schlund+Partner, Alturo */
2 function QxImagePreloader(vSource){var m=new QxImagePreloaderManager();if(m.has(vSource)){return m.get(vSource);};QxTarget.call(this);this._h3=new Image();this._h3._QxImagePreloader=this;this._h3.onload=QxImagePreloader.__onload;this._h3.onerror=QxImagePreloader.__onerror;this._source=vSource;this._h3.src=vSource;if((new QxClient).isMshtml()){this._isPng = /\.png$/i.test(this._h3.nameProp);};m.add(this);};QxImagePreloader.extend(QxTarget,"QxImagePreloader");proto._source=null;proto._isLoaded=false;proto._isPng=false;proto.getUri=function(){return this._source;};proto.getSource=function(){return this._source;};if((new QxClient).isGecko()){proto.getWidth=function(){return this._h3.naturalWidth;};proto.getHeight=function(){return this._h3.naturalHeight;};proto.getIsLoaded=function(){return this._isLoaded=this._h3.complete;};}else if((new QxClient).isMshtml()){proto.getWidth=function(){return this._h3.width;};proto.getHeight=function(){return this._h3.height;};proto.getIsLoaded=function(){return this._h3.readyState=="complete";};proto.getIsPng=function(){return this._isPng;};}else {proto.getWidth=function(){return this._h3.width;};proto.getHeight=function(){return this._h3.height;};proto.getIsLoaded=function(){return this._isLoaded=this._h3.complete;};};QxImagePreloader.__onload=function(){this._QxImagePreloader._onload();};QxImagePreloader.__onerror=function(){this._QxImagePreloader._onerror();};proto._onload=function(){this._isLoaded=true;if(this.hasEventListeners("load")){this.dispatchEvent(new QxEvent("load"));};};proto._onerror=function(){this._isLoaded=false;if(this.hasEventListeners("error")){this.dispatchEvent(new QxEvent("error"));};};proto.dispose=function(){if(this.getDisposed()){return;};QxTarget.prototype.dispose.call(this);if(this._h3){this._h3.onload=this._h3.onerror=null;this._h3._QxImagePreloader=null;this._h3=null;};this._isLoaded=this._isPng=false;return true;};