|
From: Raymond I. <xw...@us...> - 2003-03-26 02:22:34
|
Update of /cvsroot/dynapi/dynapi3x/src/api
In directory sc8-pr-cvs1:/tmp/cvs-serv6593/src/api
Modified Files:
dyndocument.js dynlayer_dom.js dynlayer_ie.js dynlayer_ns4.js
dynlayer_opera.js event.js
Added Files:
dynlayer_base.js
Log Message:
updated/added by raymond
--- NEW FILE ---
/*
DynAPI Distribution
DynLayer Base/Common Class
The DynAPI Distribution is distributed under the terms of the GNU LGPL license.
requires: dynapi.api.DynDocument
*/
var DynLayerBase = {}; // used by library
function DynLayer(html,x,y,w,h,color) {
this.DynElement = DynElement;
this.DynElement();
if (html && html.constructor==Object){
var args=html; // dictionary input
html=args.html;
x = args.x;
y = args.y;
w = args.w;
h = args.h;
color = args.color;
this.visible = (args.visible||true);
this.z = (args.zIndex||1);
this._saveAnchor = args.anchor;
this._textSelectable = (args.textSelectable||true);
if (args.id) this.setID(args.id,true);
}
else {
this.visible = true;
this.z = 1;
this._saveAnchor = false;
this._textSelectable = true;
}
this.html = html;
this.x = x;
this.y = y;
this.w = w;
this.h = h;
this.bgColor = color;
this.elm = null;
this.doc = null;
this.css = null;
};
var p = dynapi.setPrototype('DynLayer','DynElement');
p._destroy = function() {
for (var i=0;i<this.children.length;i++) {
this.children[i]._destroy();
}
this.removeAllEventListeners();
if (this.elm) this._remove();
DynObject.all[this.id] = null;
this.children = null;
this.frame = null;
this.bgImage = null;
this.bgColor = null;
this.html = null;
this.x = null;
this.y = null;
this.w = null;
this.h = null;
this.z = null;
this.doc = null;
this.css = null;
this._dyndoc = null;
this.parent = null;
};
p._remove = function() { //! Overwritten by NS4
if (this.elm) {
//this.elm.style.visibility = "hidden";
this.elm.innerHTML = "";
this.elm.outerHTML = "";
this.elm = null;
if (this.releaseMouseEvents) this.releaseMouseEvents();
if (this.releaseKeyEvents) this.releaseKeyEvents();
}
/*this.frame = null;
this.bgImage = null;
this.bgColor = null;
this.html = null;
this.z = null;
this.w = null;
this.h = null;
this.elm = null;
this.doc = null;
this.css = null;*/
};
p._createInserted = function(divs){
DynLayer._assignElement(this,null,divs); //! NS4 will ignore divs
DynElement._flagCreate(this);
};
p.getOuterHTML=function() { //! Overwritten by NS4
var s,clip='',bgimage=' background-image:none;';
if(this.bgImage!=null) bgimage=' background-image:url('+this.bgImage+');';
//else if (this.bgImage==null && this.html==null) bgimage=' background-image:none;';
if (this.clip) clip=' clip:rect('+this.clip[0]+'px '+this.clip[1]+'px '+this.clip[2]+'px '+this.clip[3]+'px);';
else if (this.w!=null && this.h!=null) clip=' clip:rect(0px '+this.w+'px '+this.h+'px 0px);';
return [
'\n<div id="'+this.id+'" style="',
' left:',(this.x!=null? this.x : 0),'px;',
' top:',(this.y!=null? this.y : 0),'px;',
((this.w!=null)? ' width:'+this.w+'px;':''),
((this.h!=null)? ' height:'+this.h+'px;':''),
((this.z)? ' z-index:'+this.z+';':''),
((this._cursor!=null)? ' cursor:'+this._cursor+';':''),
((this._overflow!=null)? ' overflow:'+this._overflow+';':''),
((this.bgColor!=null)? ' background-color:'+this.bgColor+';':''),
((this.visible==false)? ' visibility:hidden;':' visibility:inherit;'),
bgimage,
clip,
this._cssBorder,
' position:absolute;">',
this.getInnerHTML(),
'</div>'
].join('');
};
p.getInnerHTML=function() { //! Overwritten by NS4
var s = '';
var i,ch=this.children;
if (this.html!=null) s+=this.html;
for (i=0;i<ch.length;i++) s+=ch[i].getOuterHTML();
return s;
};
p.getPageX = function() {return (this.isChild)? this.parent.getPageX()+(this.x||0) : this.x||0}; //! Overwritten by NS4
p.getPageY = function() {return (this.isChild)? this.parent.getPageY()+(this.y||0) : this.y||0}; //! Overwritten by NS4
this._cssBorder='';
p.setBorder = function(w,c){ //! Overwritten by NS4
w = (w!=null)? w:0;
c = (c!=null)? c:'#000000';
if(!this.css) this._cssBorder='border-color:'+c+';border-width:'+w+';border-solid;';
else {
this.css.borderStyle="solid";
this.css.borderColor=c;
this.css.borderWidth=w+"px";
};
};
p.setVisible = function(b) { //! Overwritten by NS4
//if (b!=this.visible) {
this.visible = b;
if (this.css) this.css.visibility = b? "inherit" : "hidden";
//}
};
p.setSize = function(w,h) { //! Overwritten by NS4
if (this._useMinSize||this._useMaxSize){
if (this.minW && w<this.minW) w=this.minW;
if (this.minH && h<this.minH) h=this.minH;
if (this.maxW && w>this.maxW) w=this.maxW;
if (this.maxH && h>this.maxH) h=this.maxH;
}
var cw = (w!=null && w!=this.w);
var ch = (h!=null && h!=this.h);
if (cw) this.w = w<0? 0 : w;
if (ch) this.h = h<0? 0 : h;
if (cw||ch) {
if (this._updateAnchors) this._updateAnchors();
if (this.css) {
if (cw) this.css.width = this.w||0;
if (ch) this.css.height = this.h||0;
if (cw || ch) this.css.clip = 'rect(0px '+(this.w||0)+'px '+(this.h||0)+'px 0px)';
if (this.updateLayout) this.updateLayout();
}
}
if(this._hasResizeEvents) this.invokeEvent('resize');
return (cw||ch);
};
p.setMaximumSize = function(w,h){
this._maxW=w; this._maxH=h;
this._useMaxSize=(w!=h!=null);
w=(this.w>w)?w:this.w;
h=(this.h>h)? h:this.h;
this.setSize(this.w,this.h);
};
p.setMinimumSize = function(w,h){
this._minW=w; this._minH=h;
this._useMinSize=(w!=h!=null);
this.setSize(this.w,this.h);
};
p._overflow='hidden';
p.getOverflow = function(){return this._overflow};
p.setOverflow = function(s){
if(!s) s='default';
this._overflow=s;
if(this.css) this.css.overflow=s;
};
p.getAnchor = function(){
if(!this.parent) return this._saveAnchors;
else if (this.parent._childAnchors) {
return this.parent._childAnchors[this.id];
}
};
p.setAnchor = function(anchor) {
if (anchor == null) {
delete this._saveAnchor;
if (this.parent && this.parent._childAnchors && this.parent._childAnchors[this.is]) delete this.parent._childAnchors[this.is];
}
else if (this.parent) {
if (!this.parent._childAnchors) this.parent._childAnchors = {};
var a = this.parent._childAnchors;
a[this.id] = anchor;
this.parent._updateAnchor(this.id);
}
else this._saveAnchor = anchor;
};
p.setX=function(x) {this.setLocation(x,null)};
p.setY=function(y) {this.setLocation(null,y)};
p.getX=function() {return this.x||0};
p.getY=function() {return this.y||0};
p.setPageX = function(x) {this.setPageLocation(x,null)};
p.setPageY = function(y) {this.setPageLocation(null,y)};
p.getVisible=function() {return this.visible};
p.getZIndex=function() {return this.z};
p.setZIndex=function(z) {
if (typeof(z)=="object") {
if (z.above) this.z = z.above.z + 1;
else if (z.below) this.z = z.below.z - 1;
else if (z.topmost && this.parent) {
var topZ=10000,ch=this.parent.children;
for(var i=0;i<ch.length;i++) if (ch[i].z>topZ) topZ=ch[i].z;
this.parent._topZ = topZ+2;
this.z = this.parent._topZ;
}
}
else this.z = z;
if (this.css) this.css.zIndex = this.z;
};
p.getHTML = function() {return this.html};
p.setWidth=function(w) {this.setSize(w,null)};
p.setHeight=function(h) {this.setSize(null,h)};
p.getWidth=function() {return this.w||0};
p.getHeight=function() {return this.h||0};
p.getBgImage=function() {return this.bgImage};
p.getBgColor=function() {return this.bgColor};
p.setBgColor=function(c) { //! Overwritten by NS4
if (c==null) c = 'transparent';
this.bgColor = c;
if (this.css) this.css.backgroundColor = c;
};
p.setBgImage=function(path) { //! Overwritten by NS4
this.bgImage=path;
if (this.css) this.css.backgroundImage='url('+path+')';
};
p.setClip=function(clip) { //! Overwritten by NS4
var cc=this.getClip();
for (var i=0;i<clip.length;i++) if (clip[i]==null) clip[i]=cc[i];
this.clip=clip;
if (this.css==null) return;
var c=this.css.clip;
this.css.clip="rect("+clip[0]+"px "+clip[1]+"px "+clip[2]+"px "+clip[3]+"px)";
};
p.getClip=function() { //! Overwritten by NS4
if (this.css==null || !this.css.clip) return [0,0,0,0];
var c = this.css.clip;
if (c) {
if (c.indexOf("rect(")>-1) {
c=c.split("rect(")[1].split(")")[0].split("px");
for (var i=0;i<c.length;i++) c[i]=parseInt(c[i]);
return [c[0],c[1],c[2],c[3]];
}
else return [0,this.w,this.h,0];
}
};
Index: dyndocument.js
===================================================================
RCS file: /cvsroot/dynapi/dynapi3x/src/api/dyndocument.js,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** dyndocument.js 9 Mar 2003 22:21:46 -0000 1.5
--- dyndocument.js 26 Mar 2003 02:22:31 -0000 1.6
***************
*** 60,71 ****
this.doc.fgColor = color;
};
! p.insertChild = function(c) {
if (c && !c.isInline && c.parent == this) {
! DynElement._flagEvent(c,'precreate');
! this.doc.write(c.getOuterHTML());
! c._inserted = true;
}
};
! p.insertAllChildren = function() {
var i,c,str =[''];
var ch=this.children;
--- 60,74 ----
this.doc.fgColor = color;
};
! p.insertChild = function(c,usebp) { // Blueprint Enabled
if (c && !c.isInline && c.parent == this) {
! DynElement._flagPeCreate(c);
! if(useBlueprint) c.isInline=c._noInlineValues=true;
! else {
! this.doc.write(c.getOuterHTML());
! c._inserted = true;
! }
}
};
! p.insertAllChildren = function(usebp,bpSrc) { // Blueprint Enabled
var i,c,str =[''];
var ch=this.children;
***************
*** 73,84 ****
c = ch[i];
if(!c.isInline){
! DynElement._flagEvent(c,'precreate');
! str[i]=c.getOuterHTML();
! c._inserted = true;
}
}
! this.doc.write(str.join('\n'));
! this.doc.close();
};
p._create = function() {
var ua=dynapi.ua;
--- 76,96 ----
c = ch[i];
if(!c.isInline){
! DynElement._flagPreCreate(c);
! if(usebp) c.isInline=c._noInlineValues=true;
! else {
! str[i]=c.getOuterHTML();
! c._inserted = true;
! }
}
}
! if(usebp){
! if(bpSrc) dynapi.frame.document.write('<script type="text/javascript" language="JavaScript" src="'+bpSrc+'"><\/script>');
! }
! else {
! this.doc.write(str.join('\n'));
! this.doc.close();
! }
};
+
p._create = function() {
var ua=dynapi.ua;
***************
*** 103,107 ****
var divs;
// create divs object - speeds up DOM browsers on Win32. Linux & Mac?
! if (ua.win32 && (ua.ie||ua.dom)) {
divs={}
var dv,all=(ua.ie||ua.opera)? document.all.tags('div') : document.getElementsByTagName('div');
--- 115,119 ----
var divs;
// create divs object - speeds up DOM browsers on Win32. Linux & Mac?
! if (ua.ie||ua.dom) {
divs={}
var dv,all=(ua.ie||ua.opera)? document.all.tags('div') : document.getElementsByTagName('div');
Index: dynlayer_dom.js
===================================================================
RCS file: /cvsroot/dynapi/dynapi3x/src/api/dynlayer_dom.js,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** dynlayer_dom.js 9 Mar 2003 22:21:46 -0000 1.4
--- dynlayer_dom.js 26 Mar 2003 02:22:31 -0000 1.5
***************
*** 1,94 ****
/*
DynAPI Distribution
! DynLayer Class
The DynAPI Distribution is distributed under the terms of the GNU LGPL license.
! requires: dynapi.api.DynDocument
*/
! function DynLayer(html,x,y,w,h,color) {
! this.DynElement = DynElement;
! this.DynElement();
!
! if (html && html.constructor==Object){
! var args=html; // dictionary input
! html=args.html;
! x = args.x;
! y = args.y;
! w = args.w;
! h = args.h;
! color = args.color;
! this.visible = (args.visible||true);
! this.z = (args.zIndex||1);
! this._saveAnchor = args.anchor;
! this._textSelectable = (args.textSelectable||true);
! if (args.id) this.setID(args.id,true);
! }
! else {
! this.visible = true;
! this.z = 1;
! this._saveAnchor = false;
! this._textSelectable = true;
! }
!
! this.html = html;
! this.x = x;
! this.y = y;
! this.w = w;
! this.h = h;
! this.bgColor = color;
! this.elm = null;
! this.doc = null;
! this.css = null;
! };
! var p = dynapi.setPrototype('DynLayer','DynElement');
! p._destroy = function() {
! for (var i=0;i<this.children.length;i++) {
! this.children[i]._destroy();
! }
! this.removeAllEventListeners();
! if (this.elm) this._remove();
! DynObject.all[this.id] = null;
! this.children = null;
! this.frame = null;
!
! this.bgImage = null;
! this.bgColor = null;
! this.html = null;
! this.x = null;
! this.y = null;
! this.w = null;
! this.h = null;
! this.z = null;
! this.doc = null;
! this.css = null;
! this._dyndoc = null;
! this.parent = null;
! };
!
! p._remove = function() {
! if (this.elm) {
! //this.elm.style.visibility = "hidden";
! this.elm.innerHTML = "";
! this.elm.outerHTML = ""; // ??
! this.elm = null;
! if (this.releaseMouseEvents) this.releaseMouseEvents();
! if (this.releaseKeyEvents) this.releaseKeyEvents();
! }
! /*this.frame = null;
! this.bgImage = null;
! this.bgColor = null;
! this.html = null;
! this.z = null;
! this.w = null;
! this.h = null;
! this.elm = null;
! this.doc = null;
! this.css = null;*/
! };
p._create = function() {
if (this.parent && !this.elm) {
! DynElement._flagEvent(this,'precreate');
var elm, parentElement;
parentElement = this.parent.elm;
--- 1,15 ----
/*
DynAPI Distribution
! DynLayer DOM Specific Functions
The DynAPI Distribution is distributed under the terms of the GNU LGPL license.
! requires: dynapi.api.DynLayerBase
*/
! p = DynLayer.prototype;
p._create = function() {
if (this.parent && !this.elm) {
! DynElement._flagPreCreate(this);
var elm, parentElement;
parentElement = this.parent.elm;
***************
*** 102,115 ****
DynLayer._assignElement(this,elm);
! DynElement._flagEvent(this,'create');
}
};
- p._createInserted = function(divs){
- DynLayer._assignElement(this,null,divs);
- DynElement._flagEvent(this,'create');
- };
DynLayer._assignElement = function(dlyr,elm,divs) {
! if (!elm ) elm = (divs)? divs[dlyr.id] : dlyr.parent.doc.getElementById(dlyr.id);
! //if (!elm) elm = dlyr.parent.doc.getElementById(dlyr.id);
dlyr.elm = elm;
dlyr.css = elm.style;
--- 23,34 ----
DynLayer._assignElement(this,elm);
! DynElement._flagCreate(this);
}
};
DynLayer._assignElement = function(dlyr,elm,divs) {
! if (!elm ) {
! elm = (divs)? divs[dlyr.id] : dlyr.parent.doc.getElementById(dlyr.id);
! if (!elm) {dlyr._create();return}; // force create() for missing inline layer
! }
dlyr.elm = elm;
dlyr.css = elm.style;
***************
*** 134,169 ****
};
- p.getOuterHTML=function() {
- var s,bgimage='',clip='';
- if(this.bgImage!=null) bgimage=' background-image:url('+this.bgImage+');';
- if (this.clip) clip=' clip:rect('+this.clip[0]+'px '+this.clip[1]+'px '+this.clip[2]+'px '+this.clip[3]+'px);';
- else if (this.w!=null && this.h!=null) clip=' clip:rect(0px '+this.w+'px '+this.h+'px 0px);';
- s=[
- '<div id="'+this.id+'" style="',
- ' left:',(this.x!=null? this.x : 0),'px;',
- ' top:',(this.y!=null? this.y : 0),'px;',
- ((this.w!=null)? ' width:'+this.w+'px;':''),
- ((this.h!=null)? ' height:'+this.h+'px;':''),
- ((this.z)? ' z-index:'+this.z+';':''),
- ((this._cursor!=null)? ' cursor:'+this._cursor+';':''),
- ((this._overflow!=null)? ' overflow:hidden;':''),
- ((this.bgColor!=null)? ' background-color:'+this.bgColor+';':''),
- ((this.visible==false)? ' visibility:hidden;':' visibility:inherit;'),
- bgimage,
- clip,
- ' position:absolute;">',
- this.getInnerHTML(),
- '</div>\n'
- ];
- return s.join('');
- };
- p.getInnerHTML=function() {
- var s = '';
- var i,ch=this.children;
- if (this.html!=null) s+=this.html;
- for (i=0;i<ch.length;i++) s+=ch[i].getOuterHTML();
- return s;
- };
-
p.setLocation=function(x,y) {
var cx = (x!=null && x!=this.x);
--- 53,56 ----
***************
*** 184,211 ****
return this.setLocation(x,y);
};
- p.getPageX=function() {return (this.isChild)? this.parent.getPageX()+(this.x||0) : this.x||0};
- p.getPageY=function() {return (this.isChild)? this.parent.getPageY()+(this.y||0) : this.y||0};
- p.setVisible=function(b) {
- //if (b!=this.visible) {
- this.visible = b;
- if (this.css) this.css.visibility = b? "inherit" : "hidden";
- //}
- };
- p.setSize = function(w,h) {
- var cw = (w!=null && w!=this.w);
- var ch = (h!=null && h!=this.h);
- if (cw) this.w = w<0? 0 : w;
- if (ch) this.h = h<0? 0 : h;
- if (cw||ch) {
- if (this._updateAnchors) this._updateAnchors();
- if (this.css) {
- if (cw) this.css.width = this.w||0;
- if (ch) this.css.height = this.h||0;
- if (cw || ch) this.css.clip = 'rect(0px '+(this.w||0)+'px '+(this.h||0)+'px 0px)';
- if (this.updateLayout) this.updateLayout();
- }
- }
- return (cw||ch);
- };
p.setHTML = function(html) {
if (html!=this.html) {
--- 71,74 ----
***************
*** 221,245 ****
}
}
};
- p.getAnchor = function(){
- if(!this.parent) return this._saveAnchors;
- else if (this.parent._childAnchors) {
- return this.parent._childAnchors[this.id];
- }
- };
- p.setAnchor = function(anchor) {
- if (anchor == null) {
- delete this._saveAnchor;
- if (this.parent && this.parent._childAnchors && this.parent._childAnchors[this.is]) delete this.parent._childAnchors[this.is];
- }
- else if (this.parent) {
- if (!this.parent._childAnchors) this.parent._childAnchors = {};
- var a = this.parent._childAnchors;
- a[this.id] = anchor;
- this.parent._updateAnchor(this.id);
- }
- else this._saveAnchor = anchor;
- };
-
p.setTextSelectable=function(b) {
this._textSelectable = b
--- 84,89 ----
}
}
+ if(this._hasContentEvents) this.invokeEvent('contentchange');
};
p.setTextSelectable=function(b) {
this._textSelectable = b
***************
*** 247,282 ****
if (!b) this.setCursor('default');
};
-
- p.setX=function(x) {this.setLocation(x,null)};
- p.setY=function(y) {this.setLocation(null,y)};
- p.getX=function() {return this.x||0};
- p.getY=function() {return this.y||0};
- p.setPageX = function(x) {this.setPageLocation(x,null)};
- p.setPageY = function(y) {this.setPageLocation(null,y)};
-
- p.getVisible=function() {return this.visible};
-
- p.setZIndex=function(z) {
- if (typeof(z)=="object") {
- if (z.above) this.z = z.above.z + 1;
- else if (z.below) this.z = z.below.z - 1;
- else if (z.topmost && this.parent) {
- var topZ=10000,ch=this.parent.children;
- for(var i=0;i<ch.length;i++) if (ch[i].z>topZ) topZ=ch[i].z;
- this.parent._topZ = topZ+1;
- this.z = this.parent._topZ;
- }
- }
- else this.z = z;
- if (this.css) this.css.zIndex = this.z;
- };
- p.getZIndex=function() {return this.z};
- p.getHTML = function() {return this.html};
- p.setWidth=function(w) {this.setSize(w,null)};
- p.setHeight=function(h) {this.setSize(null,h)};
- p.getWidth=function() {return this.w||0};
- p.getHeight=function() {return this.h||0};
- p.getBgImage=function() {return this.bgImage};
- p.getBgColor=function() {return this.bgColor};
p.getCursor = function() {return (this._cursor=='pointer')? 'hand':this._cursor};
p.setCursor = function(c) {
--- 91,94 ----
***************
*** 289,301 ****
}
};
- p.setBgColor=function(c) {
- if (c==null) c = 'transparent';
- this.bgColor = c;
- if (this.css) this.css.backgroundColor = c;
- };
- p.setBgImage=function(path) {
- this.bgImage=path;
- if (this.css) this.css.backgroundImage='url('+path+')';
- };
p.getContentWidth=function() {
if (this.elm==null) return 0;
--- 101,104 ----
***************
*** 318,341 ****
}
};
! p.setClip=function(clip) {
! var cc=this.getClip();
! for (var i=0;i<clip.length;i++) if (clip[i]==null) clip[i]=cc[i];
! this.clip=clip;
! if (this.css==null) return;
! var c=this.css.clip;
! this.css.clip="rect("+clip[0]+"px "+clip[1]+"px "+clip[2]+"px "+clip[3]+"px)";
! };
! p.getClip=function() {
! if (this.css==null || !this.css.clip) return [0,0,0,0];
! var c = this.css.clip;
! if (c) {
! if (c.indexOf("rect(")>-1) {
! c=c.split("rect(")[1].split(")")[0].split("px");
! for (var i=0;i<c.length;i++) c[i]=parseInt(c[i]);
! return [c[0],c[1],c[2],c[3]];
! }
! else return [0,this.w,this.h,0];
! }
! };
p.slideTo = function(endx,endy,inc,speed) {
if (!this._slideActive) {
--- 121,125 ----
}
};
!
p.slideTo = function(endx,endy,inc,speed) {
if (!this._slideActive) {
Index: dynlayer_ie.js
===================================================================
RCS file: /cvsroot/dynapi/dynapi3x/src/api/dynlayer_ie.js,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** dynlayer_ie.js 9 Mar 2003 22:21:46 -0000 1.5
--- dynlayer_ie.js 26 Mar 2003 02:22:31 -0000 1.6
***************
*** 1,93 ****
/*
DynAPI Distribution
! DynLayer Class
The DynAPI Distribution is distributed under the terms of the GNU LGPL license.
! requires: dynapi.api.DynDocument
*/
! function DynLayer(html,x,y,w,h,color) {
! this.DynElement = DynElement;
! this.DynElement();
!
! if (html && html.constructor==Object){
! var args=html; // dictionary input
! html=args.html;
! x = args.x;
! y = args.y;
! w = args.w;
! h = args.h;
! color = args.color;
! this.visible = (args.visible||true);
! this.z = (args.zIndex||1);
! this._saveAnchor = args.anchor;
! this._textSelectable = (args.textSelectable||true);
! if (args.id) this.setID(args.id,true);
! }
! else {
! this.visible = true;
! this.z = 1;
! this._saveAnchor = false;
! this._textSelectable = true;
! }
!
! this.html = html;
! this.x = x;
! this.y = y;
! this.w = w;
! this.h = h;
! this.bgColor = color;
! this.elm = null;
! this.doc = null;
! this.css = null;
! };
! var p = dynapi.setPrototype('DynLayer','DynElement');
! p._destroy = function() {
! for (var i=0;i<this.children.length;i++) {
! this.children[i]._destroy();
! }
! this.removeAllEventListeners();
! if (this.elm) this._remove();
! DynObject.all[this.id] = null;
! this.children = null;
! this.frame = null;
!
! this.bgImage = null;
! this.bgColor = null;
! this.html = null;
! this.x = null;
! this.y = null;
! this.w = null;
! this.h = null;
! this.z = null;
! this.doc = null;
! this.css = null;
! this._dyndoc = null;
! this.parent = null;
! };
! p._remove = function() {
! if (this.elm) {
! //this.elm.style.visibility = "hidden";
! this.elm.innerHTML = "";
! this.elm.outerHTML = "";
! this.elm = null;
! if (this.releaseMouseEvents) this.releaseMouseEvents();
! if (this.releaseKeyEvents) this.releaseKeyEvents();
! }
! /*this.frame = null;
! this.bgImage = null;
! this.bgColor = null;
! this.html = null;
! this.z = null;
! this.w = null;
! this.h = null;
! this.elm = null;
! this.doc = null;
! this.css = null;*/
! };
p._create = function() {
if (this.parent && !this.elm) {
! DynElement._flagEvent(this,'precreate');
var elm, parentElement;
parentElement = this.parent.elm;
--- 1,15 ----
/*
DynAPI Distribution
! DynLayer IE Specific Functions
The DynAPI Distribution is distributed under the terms of the GNU LGPL license.
! requires: dynapi.api.DynLayerBase
*/
! p = DynLayer.prototype;
p._create = function() {
if (this.parent && !this.elm) {
! DynElement._flagPreCreate(this);
var elm, parentElement;
parentElement = this.parent.elm;
***************
*** 118,130 ****
}
DynLayer._assignElement(this,elm);
! DynElement._flagEvent(this,'create');
}
};
- p._createInserted = function(divs){
- DynLayer._assignElement(this,null,divs);
- DynElement._flagEvent(this,'create');
- };
DynLayer._assignElement = function(dlyr,elm,divs) {
! if (!elm ) elm = (divs)? divs[dlyr.id] : dlyr.parent.elm.all[dlyr.id];
dlyr.elm = elm;
dlyr.css = elm.style;
--- 40,51 ----
}
DynLayer._assignElement(this,elm);
! DynElement._flagCreate(this);
}
};
DynLayer._assignElement = function(dlyr,elm,divs) {
! if (!elm ) {
! elm = (divs)? divs[dlyr.id] : dlyr.parent.elm.all[dlyr.id];
! if (!elm) {dlyr._create();return}; // force create() for missing inline layer
! }
dlyr.elm = elm;
dlyr.css = elm.style;
***************
*** 152,186 ****
};
- p.getOuterHTML=function() {
- var s,bgimage='',clip='';
- if(this.bgImage!=null) bgimage=' background-image:url('+this.bgImage+');';
- else if (this.bgImage==null && this.html==null) bgimage=' background-image:none;';
- if (this.clip) clip=' clip:rect('+this.clip[0]+'px '+this.clip[1]+'px '+this.clip[2]+'px '+this.clip[3]+'px);';
- else if (this.w!=null && this.h!=null) clip=' clip:rect(0px '+this.w+'px '+this.h+'px 0px);';
- return [
- '<div id="'+this.id+'" style="',
- ' left:',(this.x!=null? this.x : 0),'px;',
- ' top:',(this.y!=null? this.y : 0),'px;',
- ((this.w!=null)? ' width:'+this.w+'px;':''),
- ((this.h!=null)? ' height:'+this.h+'px;':''),
- ((this.z)? ' z-index:'+this.z+';':''),
- ((this._cursor!=null)? ' cursor:'+this._cursor+';':''),
- ((this._overflow!=null)? ' overflow:hidden;':''),
- ((this.bgColor!=null)? ' background-color:'+this.bgColor+';':''),
- ((this.visible==false)? ' visibility:hidden;':' visibility:inherit;'),
- bgimage,
- clip,
- ' position:absolute;">',
- this.getInnerHTML(),
- '</div>\n'
- ].join('');
- };
- p.getInnerHTML=function() {
- var s = '';
- var i,ch=this.children;
- if (this.html!=null) s+=this.html;
- for (i=0;i<ch.length;i++) s+=ch[i].getOuterHTML();
- return s;
- };
p.setLocation=function(x,y) {
var cx = (x!=null && x!=this.x);
--- 73,76 ----
***************
*** 192,195 ****
--- 82,86 ----
if (cy) this.css.pixelTop = this.y;
}
+ if(this._hasLocationEvents) this.invokeEvent('locationchange');
return (cx||cy);
};
***************
*** 207,218 ****
return this.setLocation(x,y);
};
- p.getPageX=function() {return (this.isChild)? this.parent.getPageX()+(this.x||0) : this.x||0};
- p.getPageY=function() {return (this.isChild)? this.parent.getPageY()+(this.y||0) : this.y||0};
- p.setVisible=function(b) {
- //if (b!=this.visible) {
- this.visible = b;
- if (this.css) this.css.visibility = b? "inherit" : "hidden";
- //}
- };
p.setSize = function(w,h) {
var cw = (w!=null && w!=this.w);
--- 98,101 ----
***************
*** 236,258 ****
if (this.css) this.elm.innerHTML = html;
}
! };
! p.getAnchor = function(){
! if(!this.parent) return this._saveAnchors;
! else if (this.parent._childAnchors) {
! return this.parent._childAnchors[this.id];
! }
! };
! p.setAnchor = function(anchor) {
! if (anchor == null) {
! delete this._saveAnchor;
! if (this.parent && this.parent._childAnchors && this.parent._childAnchors[this.is]) delete this.parent._childAnchors[this.is];
! }
! else if (this.parent) {
! if (!this.parent._childAnchors) this.parent._childAnchors = {};
! var a = this.parent._childAnchors;
! a[this.id] = anchor;
! this.parent._updateAnchor(this.id);
! }
! else this._saveAnchor = anchor;
};
p.setTextSelectable=function(b) {
--- 119,123 ----
if (this.css) this.elm.innerHTML = html;
}
! if(this._hasContentEvents) this.invokeEvent('contentchange');
};
p.setTextSelectable=function(b) {
***************
*** 262,298 ****
// && this.captureMouseEvents && !this._hasMouseEvents) this.captureMouseEvents();
};
-
- p.setX=function(x) {this.setLocation(x,null)};
- p.setY=function(y) {this.setLocation(null,y)};
- p.getX=function() {return this.x||0};
- p.getY=function() {return this.y||0};
- p.setPageX = function(x) {this.setPageLocation(x,null)};
- p.setPageY = function(y) {this.setPageLocation(null,y)};
-
- p.getVisible=function() {return this.visible};
-
- p.setZIndex=function(z) {
- if (typeof(z)=="object") {
- if (z.above) this.z = z.above.z + 1;
- else if (z.below) this.z = z.below.z - 1;
- else if (z.topmost && this.parent) {
- var topZ=10000,ch=this.parent.children;
- for(var i=0;i<ch.length;i++) if (ch[i].z>topZ) topZ=ch[i].z;
- this.parent._topZ = topZ+1;
- this.z = this.parent._topZ;
- }
- }
- else this.z = z;
- if (this.css) this.css.zIndex = this.z;
- };
- p.getZIndex=function() {return this.z};
-
- p.getHTML = function() {return this.html};
- p.setWidth=function(w) {this.setSize(w,null)};
- p.setHeight=function(h) {this.setSize(null,h)};
- p.getWidth=function() {return this.w||0};
- p.getHeight=function() {return this.h||0};
- p.getBgImage=function() {return this.bgImage};
- p.getBgColor=function() {return this.bgColor};
p.getCursor = function() {return this._cursor};
p.setCursor = function(c) {
--- 127,130 ----
***************
*** 304,316 ****
}
};
- p.setBgColor=function(c) {
- if (c==null) c = 'transparent';
- this.bgColor = c;
- if (this.css) this.css.backgroundColor = c;
- };
- p.setBgImage=function(path) {
- this.bgImage=path;
- if (this.css) this.css.backgroundImage='url('+path+')';
- };
p.getContentWidth=function() {
if (this.elm==null) return 0;
--- 136,139 ----
***************
*** 325,348 ****
if (dynapi.ua.platform=="mac") return this.elm.offsetHeight;
return parseInt(this.elm.scrollHeight);
- }
- };
- p.setClip=function(clip) {
- var cc=this.getClip();
- for (var i=0;i<clip.length;i++) if (clip[i]==null) clip[i]=cc[i];
- this.clip=clip;
- if (this.css==null) return;
- var c=this.css.clip;
- this.css.clip="rect("+clip[0]+"px "+clip[1]+"px "+clip[2]+"px "+clip[3]+"px)";
- };
- p.getClip=function() {
- if (this.css==null || !this.css.clip) return [0,0,0,0];
- var c = this.css.clip;
- if (c) {
- if (c.indexOf("rect(")>-1) {
- c=c.split("rect(")[1].split(")")[0].split("px");
- for (var i=0;i<c.length;i++) c[i]=parseInt(c[i]);
- return [c[0],c[1],c[2],c[3]];
- }
- else return [0,this.w,this.h,0];
}
};
--- 148,151 ----
Index: dynlayer_ns4.js
===================================================================
RCS file: /cvsroot/dynapi/dynapi3x/src/api/dynlayer_ns4.js,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** dynlayer_ns4.js 9 Mar 2003 22:21:46 -0000 1.4
--- dynlayer_ns4.js 26 Mar 2003 02:22:31 -0000 1.5
***************
*** 1,70 ****
/*
DynAPI Distribution
! DynLayer Class
The DynAPI Distribution is distributed under the terms of the GNU LGPL license.
! requires: dynapi.api.DynDocument
*/
! function DynLayer(html,x,y,w,h,color) {
! this.DynElement = DynElement;
! this.DynElement();
!
! if (html && html.constructor==Object){
! var args=html; // dictionary input
! html=args.html;
! x = args.x;
! y = args.y;
! w = args.w;
! h = args.h;
! color = args.color;
! this.visible = (args.visible||true);
! this.z = (args.zIndex||1);
! this._saveAnchor = args.anchor;
! this._textSelectable = (args.textSelectable||true);
! if (args.id) this.setID(args.id,true);
! }
! else {
! this.visible = true;
! this.z = 1;
! this._saveAnchor = false;
! this._textSelectable = true;
! }
!
! this.html = html;
! this.x = x;
! this.y = y;
! this.w = w;
! this.h = h;
! this.bgColor = color;
! this.elm = null;
! this.doc = null;
! this.css = null;
! };
! var p = dynapi.setPrototype('DynLayer','DynElement');
! p._destroy = function() {
! for (var i=0;i<this.children.length;i++) {
! this.children[i]._destroy();
! }
! this.removeAllEventListeners();
! if (this.elm) this._remove();
! DynObject.all[this.id] = null;
! this.children = null;
! this.frame = null;
!
! this.bgImage = null;
! this.bgColor = null;
! this.html = null;
! this.x = null;
! this.y = null;
! this.w = null;
! this.h = null;
! this.z = null;
! this.doc = null;
! this.css = null;
! this._dyndoc = null;
! this.parent = null;
! };
p._remove = function() {
if (this.elm) {
--- 1,12 ----
/*
DynAPI Distribution
! DynLayer NS4 Specific Functions
The DynAPI Distribution is distributed under the terms of the GNU LGPL license.
! requires: dynapi.api.DynLayerBase
*/
! p = DynLayer.prototype;
p._remove = function() {
if (this.elm) {
***************
*** 89,93 ****
p._create = function() {
if (this.parent && !this.elm) {
! DynElement._flagEvent(this,'precreate');
var parentElement = this.parent.isClass('DynLayer')? this.parent.elm : this.parent.frame;
var elm = new Layer(this.w||0, parentElement);
--- 31,35 ----
p._create = function() {
if (this.parent && !this.elm) {
! DynElement._flagPreCreate(this);
var parentElement = this.parent.isClass('DynLayer')? this.parent.elm : this.parent.frame;
var elm = new Layer(this.w||0, parentElement);
***************
*** 110,122 ****
DynLayer._assignElement(this,elm);
//if (this.updateLayout) this.updateLayout();
! DynElement._flagEvent(this,'create');
}
};
- p._createInserted = function(){
- DynLayer._assignElement(this,null);
- DynElement._flagEvent(this,'create');
- };
DynLayer._assignElement = function(dlyr,elm) {
! if (!elm) elm = dlyr.parent.doc.layers[dlyr.id];
dlyr.elm = elm;
dlyr.css = elm;
--- 52,63 ----
DynLayer._assignElement(this,elm);
//if (this.updateLayout) this.updateLayout();
! DynElement._flagCreate(this);
}
};
DynLayer._assignElement = function(dlyr,elm) {
! if (!elm) {
! elm = dlyr.parent.doc.layers[dlyr.id];
! if (!elm) {dlyr._create();return}; // force create() for missing inline layer
! }
dlyr.elm = elm;
dlyr.css = elm;
***************
*** 150,156 ****
((this.w!=null)? ' width='+this.w:''),
((this.h!=null)? ' height='+this.h:''),
! ((this.z)? ' z-index:'+this.z:''), clip,
! ((this.bgColor!=null)? ' bgcolor="'+this.bgColor+'"':'')+'>',
! this.getInnerHTML(),'</layer>'
];
return s.join('');
--- 91,97 ----
((this.w!=null)? ' width='+this.w:''),
((this.h!=null)? ' height='+this.h:''),
! ((this.z)? ' z-index:'+this.z:''),
! ((this.bgColor!=null)? ' bgcolor="'+this.bgColor+'"':''),
! clip,'>',this.getInnerHTML(),'</layer>'
];
return s.join('');
***************
*** 175,178 ****
--- 116,120 ----
else if (cy) this.css.top = this.y;
}
+ if(this._hasLocationEvents) this.invokeEvent('locationchange');
return (cx||cy);
};
***************
*** 199,202 ****
--- 141,172 ----
p.getPageX = function() {return this.css? this.css.pageX : null};
p.getPageY = function() {return this.css? this.css.pageY : null};
+
+ p._bor_tp={h:1,anchor:{top:0,left:0,right:0}};
+ p._bor_rt={w:1,anchor:{top:0,right:0,bottom:0}};
+ p._bor_bm={h:1,anchor:{bottom:0,left:0,right:0}};
+ p._bor_lt={w:1,anchor:{top:0,left:0,bottom:0}};
+ p.setBorder = function(w,h){
+ w = (w!=null)? w:0;
+ c = (c!=null)? c:'#000000';
+ if(!this._borTp){
+ // create border layers
+ this.addChild(new DynLayer(this._bor_tp),'_borTp');//top
+ this.addChild(new DynLayer(this._bor_rt),'_borRt');//right
+ this.addChild(new DynLayer(this._bor_bm),'_borBm');//bottom
+ this.addChild(new DynLayer(this._bor_lt),'_borLt'); //left
+ }
+ // width
+ this._borTp.setHeight(w);
+ this._borRt.setWidth(w);
+ this._borBm.setHeight(w);
+ this._borLt.setWidth(w);
+ // color
+ this._borTp.setBgColor(c);
+ this._borRt.setBgColor(c);
+ this._borBm.setBgColor(c);
+ this._borLt.setBgColor(c);
+ // update anchors
+ if (this._updateAnchors) this._updateAnchors();
+ };
p.setVisible = function(b) {
if (b!=this.visible) {
***************
*** 206,209 ****
--- 176,185 ----
};
p.setSize = function(w,h) {
+ if (this._useMinSize||this._useMaxSize){
+ if (this.minW && w<this.minW) w=this.minW;
+ if (this.minH && h<this.minH) h=this.minH;
+ if (this.maxW && w>this.maxW) w=this.maxW;
+ if (this.maxH && h>this.maxH) h=this.maxH;
+ }
var cw = (w!=null && w!=this.w);
var ch = (h!=null && h!=this.h);
***************
*** 218,221 ****
--- 194,198 ----
}
}
+ if(this._hasResizeEvents) this.invokeEvent('resize');
return (cw||ch);
};
***************
*** 233,257 ****
}
}
};
- p.getAnchor = function(){
- if(!this.parent) return this._saveAnchors;
- else if (this.parent._childAnchors) {
- return this.parent._childAnchors[this.id];
- }
- };
- p.setAnchor = function(anchor) {
- if (anchor == null) {
- delete this._saveAnchor;
- if (this.parent && this.parent._childAnchors && this.parent._childAnchors[this.is]) delete this.parent._childAnchors[this.is];
- }
- else if (this.parent) {
- if (!this.parent._childAnchors) this.parent._childAnchors = {};
- var a = this.parent._childAnchors;
- a[this.id] = anchor;
- this.parent._updateAnchor(this.id);
- }
- else this._saveAnchor = anchor;
- };
-
p.setTextSelectable=function(b) {
this._textSelectable = b
--- 210,215 ----
}
}
+ if(this._hasContentEvents) this.invokeEvent('contentchange');
};
p.setTextSelectable=function(b) {
this._textSelectable = b
***************
*** 263,296 ****
// && this.captureMouseEvents && !this._hasMouseEvents) this.captureMouseEvents();
};
-
- p.setX=function(x) {this.setLocation(x,null)};
- p.setY=function(y) {this.setLocation(null,y)};
- p.getX=function() {return this.x||0};
- p.getY=function() {return this.y||0};
- p.setPageX = function(x) {this.setPageLocation(x,null)};
- p.setPageY = function(y) {this.setPageLocation(null,y)};
- p.getVisible=function() {return this.visible};
- p.setZIndex=function(z) {
- if (typeof(z)=="object") {
- if (z.above) this.z = z.above.z + 1;
- else if (z.below) this.z = z.below.z - 1;
- else if (z.topmost && this.parent) {
- var topZ=10000,ch=this.parent.children;
- for(var i=0;i<ch.length;i++) if (ch[i].z>topZ) topZ=ch[i].z;
- this.parent._topZ = topZ+1;
- this.z = this.parent._topZ;
- }
- }
- else this.z = z;
- if (this.css) this.css.zIndex = this.z;
- };
- p.getZIndex=function() {return this.z};
- p.getHTML = function() {return this.html};
- p.setWidth=function(w) {this.setSize(w,null)};
- p.setHeight=function(h) {this.setSize(null,h)};
- p.getWidth=function() {return this.w||0};
- p.getHeight=function() {return this.h||0};
- p.getBgImage=function() {return this.bgImage};
- p.getBgColor=function() {return this.bgColor};
p.getCursor = function() {return this._cursor};
p.setCursor = function(c) {
--- 221,224 ----
Index: dynlayer_opera.js
===================================================================
RCS file: /cvsroot/dynapi/dynapi3x/src/api/dynlayer_opera.js,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** dynlayer_opera.js 9 Mar 2003 22:21:46 -0000 1.4
--- dynlayer_opera.js 26 Mar 2003 02:22:31 -0000 1.5
***************
*** 1,9 ****
/*
DynAPI Distribution
! DynLayer Class
The DynAPI Distribution is distributed under the terms of the GNU LGPL license.
! requires: dynapi.api.DynDocument
*/
--- 1,9 ----
/*
DynAPI Distribution
! DynLayer Opera Specific Functions
The DynAPI Distribution is distributed under the terms of the GNU LGPL license.
! requires: dynapi.api.DynLayerBase
*/
***************
*** 16,101 ****
// the all[] collection is not available
! function DynLayer(html,x,y,w,h,color) {
! this.DynElement = DynElement;
! this.DynElement();
!
! if (html && html.constructor==Object){
! var args=html; // dictionary input
! html=args.html;
! x = args.x;
! y = args.y;
! w = args.w;
! h = args.h;
! color = args.color;
! this.visible = (args.visible||true);
! this.z = (args.zIndex||1);
! this._saveAnchor = args.anchor;
! this._textSelectable = (args.textSelectable||true);
! if (args.id) this.setID(args.id,true);
! }
! else {
! this.visible = true;
! this.z = 1;
! this._saveAnchor = false;
! this._textSelectable = true;
! }
!
! this.html = html;
! this.x = x;
! this.y = y;
! this.w = w;
! this.h = h;
! this.bgColor = color;
! this.elm = null;
! this.doc = null;
! this.css = null;
! };
! var p = dynapi.setPrototype('DynLayer','DynElement');
! p._destroy = function() {
! for (var i=0;i<this.children.length;i++) {
! this.children[i]._destroy();
! }
! this.removeAllEventListeners();
! if (this.elm) this._remove();
! DynObject.all[this.id] = null;
! this.children = null;
! this.frame = null;
!
! this.bgImage = null;
! this.bgColor = null;
! this.html = null;
! this.x = null;
! this.y = null;
! this.w = null;
! this.h = null;
! this.z = null;
! this.doc = null;
! this.css = null;
! this._dyndoc = null;
! this.parent = null;
! };
! p._remove = function() {
! if (this.elm) {
! //this.elm.style.visibility = "hidden";
! this.elm.innerHTML = "";
! this.elm.outerHTML = "";
! this.elm = null;
! if (this.releaseMouseEvents) this.releaseMouseEvents();
! if (this.releaseKeyEvents) this.releaseKeyEvents();
! }
! /*this.frame = null;
! this.bgImage = null;
! this.bgColor = null;
! this.html = null;
! this.z = null;
! this.w = null;
! this.h = null;
! this.elm = null;
! this.doc = null;
! this.css = null;*/
! };
p._create = function() {
if (this.parent && !this.elm) {
! DynElement._flagEvent(this,'precreate');
var elm, parentElement;
parentElement = this.parent.elm;
--- 16,23 ----
// the all[] collection is not available
! p = DynLayer.prototype;
p._create = function() {
if (this.parent && !this.elm) {
! DynElement._flagPreCreate(this);
var elm, parentElement;
parentElement = this.parent.elm;
***************
*** 106,119 ****
DynLayer._assignElement(this,elm);
! DynElement._flagEvent(this,'create');
}
};
- p._createInserted = function(divs){
- DynLayer._assignElement(this,null,divs);
- DynElement._flagEvent(this,'create');
- };
DynLayer._assignElement = function(dlyr,elm,divs) {
! if (!elm ) elm = (divs)? divs[dlyr.id] : dlyr.parent.doc.getElementById(dlyr.id);
! // if (!elm) elm = dlyr.parent.elm.all[dlyr.id];
dlyr.elm = elm;
dlyr.css = elm.style;
--- 28,39 ----
DynLayer._assignElement(this,elm);
! DynElement._flagCreate(this);
}
};
DynLayer._assignElement = function(dlyr,elm,divs) {
! if (!elm ) {
! elm = (divs)? divs[dlyr.id] : dlyr.parent.doc.getElementById(dlyr.id);
! if (!elm) {dlyr._create();return}; // force create() for missing inline layer
! }
dlyr.elm = elm;
dlyr.css = elm.style;
***************
*** 137,171 ****
if (dlyr._hasKeyEvents) dlyr.captureKeyEvents();
};
- p.getOuterHTML=function() {
- var s,bgimage='',clip='';
- if(this.bgImage!=null) bgimage=' background-image:url('+this.bgImage+');';
- else if (this.bgImage==null && this.html==null) bgimage=' background-image:none;';
- if (this.clip) clip=' clip:rect('+this.clip[0]+'px '+this.clip[1]+'px '+this.clip[2]+'px '+this.clip[3]+'px);';
- else if (this.w!=null && this.h!=null) clip=' clip:rect(0px '+this.w+'px '+this.h+'px 0px);';
- s=[
- '<div id="'+this.id+'" style="',
- ((this.visible==false)? ' visibility:hidden;':' visibility:inherit;'),
- ' left:',(this.x!=null? this.x : 0),'px;',
- ' top:',(this.y!=null? this.y : 0),'px;',
- ((this.w!=null)? ' width:'+this.w+'px;':''),
- ((this.h!=null)? ' height:'+this.h+'px;':''),
- ((this.z)? ' z-index:'+this.z+';':''),
- ((this._cursor!=null)? ' cursor:'+this._cursor+';':''),
- ((this._overflow!=null)? ' overflow:hidden;':''),
- ((this.bgColor!=null)? ' background-color:'+this.bgColor+';':''),
- bgimage,
- clip,
- ' position:absolute;">',
- this.getInnerHTML(),
- '</div>'
- ];
- return s.join('');
- };
- p.getInnerHTML=function() {
- var i,s = '';
- if (this.html!=null) s+=this.html;
- for (i=0;i<this.children.length;i++) s+=this.children[i].getOuterHTML();
- return s;
- };
p.setLocation=function(x,y) {
var cx = (x!=null && x!=this.x);
--- 57,60 ----
***************
*** 177,180 ****
--- 66,70 ----
if (cy) this.css.pixelTop = this.y;
}
+ if(this._hasLocationEvents) this.invokeEvent('locationchange');
return (cx||cy);
};
***************
*** 192,219 ****
return this.setLocation(x,y);
};
- p.getPageX=function() {return (this.isChild)? this.parent.getPageX()+(this.x||0) : this.x||0};
- p.getPageY=function() {return (this.isChild)? this.parent.getPageY()+(this.y||0) : this.y||0};
- p.setVisible=function(b) {
- //if (b!=this.visible) {
- this.visible = b;
- if (this.css) this.css.visibility = b? "inherit" : "hidden";
- //}
- };
- p.setSize = function(w,h) {
- var cw = (w!=null && w!=this.w);
- var ch = (h!=null && h!=this.h);
- if (cw) this.w = w<0? 0 : w;
- if (ch) this.h = h<0? 0 : h;
- if (cw||ch) {
- if (this._updateAnchors) this._updateAnchors();
- if (this.css) {
- if (cw) this.css.width = this.w||0;
- if (ch) this.css.height = this.h||0;
- if (cw || ch) this.css.clip = 'rect(0px '+(this.w||0)+'px '+(this.h||0)+'px 0px)';
- if (this.updateLayout) this.updateLayout();
- }
- }
- return (cw||ch);
- };
p.setHTML = function(html) {
if (html!=this.html) {
--- 82,85 ----
***************
*** 221,243 ****
if (this.css) this.elm.innerHTML = html;
}
! };
! p.getAnchor = function(){
! if(!this.parent) return this._saveAnchors;
! else if (this.parent._childAnchors) {
! return this.parent._childAnchors[this.id];
! }
! };
! p.setAnchor = function(anchor) {
! if (anchor == null) {
! delete this._saveAnchor;
! if (this.parent && this.parent._childAnchors && this.parent._childAnchors[this.is]) delete this.parent._childAnchors[this.is];
! }
! else if (this.parent) {
! if (!this.parent._childAnchors) this.parent._childAnchors = {};
! var a = this.parent._childAnchors;
! a[this.id] = anchor;
! this.parent._updateAnchor(this.id);
! }
! else this._saveAnchor = anchor;
};
p.setTextSelectable=function(b) {
--- 87,91 ----
if (this.css) this.elm.innerHTML = html;
}
! if(this._hasContentEvents) this.invokeEvent('contentchange');
};
p.setTextSelectable=function(b) {
***************
*** 247,282 ****
// && this.captureMouseEvents && !this._hasMouseEvents) this.captureMouseEvents();
};
-
- p.setX=function(x) {this.setLocation(x,null)};
- p.setY=function(y) {this.setLocation(null,y)};
- p.getX=function() {return this.x||0};
- p.getY=function() {return this.y||0};
- p.setPageX = function(x) {this.setPageLocation(x,null)};
- p.setPageY = function(y) {this.setPageLocation(null,y)};
-
- p.getVisible=function() {return this.visible};
-
- p.setZIndex=function(z) {
- if (typeof(z)=="object") {
- if (z.above) this.z = z.above.z + 1;
- else if (z.below) this.z = z.below.z - 1;
- else if (z.topmost && this.parent) {
- var topZ=10000,ch=this.parent.children;
- for(var i=0;i<ch.length;i++) if (ch[i].z>topZ) topZ=ch[i].z;
- this.parent._topZ = topZ+1;
- this.z = this.parent._topZ;
- }
- }
- else this.z = z;
- if (this.css) this.css.zIndex = this.z;
- };
- p.getZIndex=function() {return this.z};
- p.getHTML = function() {return this.html};
- p.setWidth=function(w) {this.setSize(w,null)};
- p.setHeight=function(h) {this.setSize(null,h)};
- p.getWidth=function() {return this.w||0};
- p.getHeight=function() {return this.h||0};
- p.getBgImage=function() {return this.bgImage};
- p.getBgColor=function() {return this.bgColor};
p.getCursor = function() {return this._cursor};
p.setCursor = function(c) {
--- 95,98 ----
***************
*** 288,300 ****
}
};
- p.setBgColor=function(c) {
- if (c==null) c = 'transparent';
- this.bgColor = c;
- if (this.css) this.css.backgroundColor = c;
- };
- p.setBgImage=function(path) {
- this.bgImage=path;
- if (this.css) this.css.backgroundImage='url('+path+')';
- };
p.getContentWidth=function() {
if (this.elm==null) return 0;
--- 104,107 ----
***************
*** 309,332 ****
if (dynapi.ua.platform=="mac") return this.elm.offsetHeight;
return parseInt(this.elm.scrollHeight);
- }
- };
- p.setClip=function(clip) {
- var cc=this.getClip();
- for (var i=0;i<clip.length;i++) if (clip[i]==null) clip[i]=cc[i];
- this.clip=clip;
- if (this.css==null) return;
- var c=this.css.clip;
- this.css.clip="rect("+clip[0]+"px "+clip[1]+"px "+clip[2]+"px "+clip[3]+"px)";
- };
- p.getClip=function() {
- if (this.css==null || !this.css.clip) return [0,0,0,0];
- var c = this.css.clip;
- if (c) {
- if (c.indexOf("rect(")>-1) {
- c=c.split("rect(")[1].split(")")[0].split("px");
- for (var i=0;i<c.length;i++) c[i]=parseInt(c[i]);
- return [c[0],c[1],c[2],c[3]];
- }
- else return [0,this.w,this.h,0];
}
};
--- 116,119 ----
Index: event.js
===================================================================
RCS file: /cvsroot/dynapi/dynapi3x/src/api/event.js,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** event.js 9 Mar 2003 22:21:46 -0000 1.4
--- event.js 26 Mar 2003 02:22:31 -0000 1.5
***************
*** 5,12 ****
The DynAPI Distribution is distributed under the terms of the GNU LGPL license.
*/
-
function DynEvent(type,src) {
- this.DynObject = DynObject;
- this.DynObject();
this.type = type;
this.src = src;
--- 5,9 ----
***************
*** 17,22 ****
this.defaultValue = true;
};
! var p = dynapi.setPrototype('DynEvent','DynObject');
!
p.getType = function() {return this.type};
p.getSource = function() {return this.src};
--- 14,18 ----
this.defaultValue = true;
};
! var p = DynEvent.prototype;
p.getType = function() {return this.type};
p.getSource = function() {return this.src};
***************
*** 39,48 ****
for (var i=0;i<this._listeners.length;i++) if (this._listeners[i]==el) return;
this._listeners[this._listeners.length] = el;
! // use onCreate() and onPrecreate() instead
! //this._hasCreateEvent=(el['oncreate'])? true:this._hasCreateEvent;
! //this._hasPrecreateEvent=(el['onprecreate'])? true:this._hasPrecreateEvent;
this._hasDragEvents=(el['ondragstart']||el['ondragmove']||
el['ondragend']||el['ondragdrop']||
! el['ondragover']||el['ondragout'])? true:this._hasDragEvents;
if (this.captureMouseEvents) {
--- 35,45 ----
for (var i=0;i<this._listeners.length;i++) if (this._listeners[i]==el) return;
this._listeners[this._listeners.length] = el;
! // Use onCreate() and onPrecreate() function for create events
! this._hasContentEvents=(el['oncontentchange'])? true:this._hasContentEvents;
! this._hasLocationEvents=(el['onlocationchange'])? true:this._hasLocationEvents;
! this._hasResizeEvents=(el['onresize'])? true:this._hasResizeEvents;
this._hasDragEvents=(el['ondragstart']||el['ondragmove']||
el['ondragend']||el['ondragdrop']||
! el['ondragover']||el['ondragout'])? true:this._hasDragEvents;
if (this.captureMouseEvents) {
***************
*** 113,129 ****
this._childAnchors = [];
};
DynElement._flagEvent = function(c,type) {
- if (type=="create") c._created = true;
- if (type=='precreate'||type=='create') {
- // Raise onCreate/onPreCreate callback Flag
- if (c._hasPCreateFn||c._hasCreateFn) c._flagCreateEvent(type);
- }else{
- // Raise other events;
- c.invokeEvent(type);
- }
var ch=c.children;
! for (var i=0; i<ch.length; i++) {
! DynElement._flagEvent(ch[i],type);
! }
};
p = dynapi.setPrototype('DynElement','EventObject');
--- 110,128 ----
this._childAnchors = [];
};
+ DynElement._flagCreate = function(c){ // much faster than using DynElemnt._flagEvent
+ var ch=c.children;
+ c._created = true;
+ if (c._hasCreateFn) c._flagCreateEvent('create');
+ for (var i=0; i<ch.length; i++) this._flagCreate(ch[i]);
+ };
+ DynElement._flagPreCreate = function(c){
+ var ch=c.children;
+ if (c._hasPCreateFn) c._flagCreateEvent('precreate');
+ for (var i=0; i<ch.length; i++) this._flagCreate(ch[i]);
+ };
DynElement._flagEvent = function(c,type) {
var ch=c.children;
! c.invokeEvent(type);
! for (var i=0; i<ch.length; i++) this._flagEvent(ch[i],type);
};
p = dynapi.setPrototype('DynElement','EventObject');
|