Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
20 | reyssat | 1 | /* |
2 | DynAPI Distribution |
||
3 | Higlighter/Skin Class |
||
4 | |||
5 | The DynAPI Distribution is distributed under the terms of the GNU LGPL license. |
||
6 | |||
7 | requires: DynLayer |
||
8 | */ |
||
9 | function Highlighter(x,y,w,h,color,image){ |
||
10 | this.DynLayer=DynLayer; |
||
11 | if(x && x.constructor==Object) this.DynLayer(x); // use dictionary |
||
12 | else this.DynLayer(null,x||0,y||0,w||0,h||0,color,image); |
||
13 | }; |
||
14 | var p = dynapi.setPrototype('Highlighter','DynLayer'); |
||
15 | p.addChild=dynapi.functions.Null; |
||
16 | if (!dynapi.ua.ns4){ |
||
17 | p._hLight= [ |
||
18 | '\n<div id="',1,'" style="left:',3 ,'px; top:',5,'px; width:',7, |
||
19 | 'px; height:',9,'px; background-color:',11, |
||
20 | '; visibility:inherit; background-image:url(',13,'); position:absolute;"><!--IE?--></div>' |
||
21 | ]; // some versions of IE (e.g. 6.0) will not set the correct height if the layer hight is smaller than the font height. To fix this I added <!--IE?--> to the div |
||
22 | } |
||
23 | else{ |
||
24 | p._hLight= [ |
||
25 | '\n<layer id="',1,'" left="',3 ,'" top="',5,'" width="',7, |
||
26 | '" height="',9,'" bgcolor="',11,'" background="',13,'"></layer>' |
||
27 | ]; |
||
28 | }; |
||
29 | p.getOuterHTML = function(){ |
||
30 | var a=this._hLight; |
||
31 | a[1]=this.id; |
||
32 | a[3]=this.x; |
||
33 | a[5]=this.y; |
||
34 | a[7]=this.w; |
||
35 | a[9]=this.h; |
||
36 | a[11]=this.bgColor||this.parent.bgColor; |
||
37 | a[13]=this.bgImage||'none'; |
||
38 | return a.join(''); |
||
39 | }; |
||
40 | function Skin(p,a) { |
||
41 | this.base=Highlighter; |
||
42 | var w=a[0], h=a[1], d1=a[2], d2=a[3], c=a[4], i=a[5]; this.point=p; |
||
43 | if(p=='n') this.base({h:h,color:c,image:i,anchor:{top:0,right:d1,left:d2}}); |
||
44 | if(p=='ne') this.base({w:w,h:h,color:c,image:i,anchor:{top:0,right:0}}); |
||
45 | if(p=='e') this.base({w:w,color:c,image:i,anchor:{top:d1,right:0,bottom:d2}}); |
||
46 | if(p=='se') this.base({w:w,h:h,color:c,image:i,anchor:{right:0,bottom:0}}); |
||
47 | if(p=='s') this.base({h:h,color:c,image:i,anchor:{right:d1,bottom:0,left:d2}}); |
||
48 | if(p=='sw') this.base({w:w,h:h,color:c,image:i,anchor:{bottom:0,left:0}}); |
||
49 | if(p=='w') this.base({w:w,color:c,image:i,anchor:{top:d1,bottom:d2,left:0}}); |
||
50 | if(p=='nw') this.base({w:w,h:h,color:c,image:i,anchor:{top:0,left:0}}); |
||
51 | }; |
||
52 | Skin.prototype=new Highlighter(); |
||
53 | Skin.prototype.graft=function(a) { |
||
54 | var w=a[0], h=a[1], d1=a[2], d2=a[3], c=a[4], i=a[5], p=this.point; |
||
55 | this.setSize(w,h); this.setBgColor(c); this.setBgImage(i); |
||
56 | if(p=='n') this.setAnchor({top:0,right:d1,left:d2}) |
||
57 | if(p=='e') this.setAnchor({top:d1,right:0,bottom:d2}) |
||
58 | if(p=='s') this.setAnchor({right:d1,bottom:0,left:d2}) |
||
59 | if(p=='w') this.setAnchor({top:d1,bottom:d2,left:0}) |
||
60 | }; |