]> git.stg.codes - stg.git/blob - doc/xslt/slides/browser/xbStyle-nn4.js
Set output encoding to utf-8.
[stg.git] / doc / xslt / slides / browser / xbStyle-nn4.js
1 /*
2  * xbStyle-nn4.js
3  * $Revision: 1.2 $ $Date: 2003/02/07 16:04:22 $
4  */
5
6 /* ***** BEGIN LICENSE BLOCK *****
7  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
8  *
9  * The contents of this file are subject to the Mozilla Public License Version
10  * 1.1 (the "License"); you may not use this file except in compliance with
11  * the License. You may obtain a copy of the License at
12  * http://www.mozilla.org/MPL/
13  *
14  * Software distributed under the License is distributed on an "AS IS" basis,
15  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
16  * for the specific language governing rights and limitations under the
17  * License.
18  *
19  * The Original Code is Netscape code.
20  *
21  * The Initial Developer of the Original Code is
22  * Netscape Corporation.
23  * Portions created by the Initial Developer are Copyright (C) 2001
24  * the Initial Developer. All Rights Reserved.
25  *
26  * Contributor(s): Bob Clary <bclary@netscape.com>
27  *
28  * ***** END LICENSE BLOCK ***** */
29
30 /////////////////////////////////////////////////////////////
31 // xbStyle.getClip()
32
33 function nsxbStyleGetClip()
34 {
35   var clip = this.styleObj.clip;
36   var rect = new xbClipRect(clip.top, clip.right, clip.bottom, clip.left);
37   return rect.toString();
38 }
39
40 /////////////////////////////////////////////////////////////
41 // xbStyle.setClip()
42
43 function nsxbStyleSetClip(sClipString)
44 {
45   var rect          = new xbClipRect(sClipString);
46   this.styleObj.clip.top    = rect.top;
47   this.styleObj.clip.right  = rect.right;
48   this.styleObj.clip.bottom  = rect.bottom;
49   this.styleObj.clip.left    = rect.left;
50 }
51
52 /////////////////////////////////////////////////////////////
53 // xbStyle.getClipTop()
54
55 function nsxbStyleGetClipTop()
56 {
57   return this.styleObj.clip.top;
58 }
59
60 /////////////////////////////////////////////////////////////
61 // xbStyle.setClipTop()
62
63 function nsxbStyleSetClipTop(top)
64 {
65   return this.styleObj.clip.top = top;
66 }
67
68 /////////////////////////////////////////////////////////////
69 // xbStyle.getClipRight()
70
71 function nsxbStyleGetClipRight()
72 {
73   return this.styleObj.clip.right;
74 }
75
76 /////////////////////////////////////////////////////////////
77 // xbStyle.setClipRight()
78
79 function nsxbStyleSetClipRight(right)
80 {
81   return this.styleObj.clip.right = right;
82 }
83
84 /////////////////////////////////////////////////////////////
85 // xbStyle.getClipBottom()
86
87 function nsxbStyleGetClipBottom()
88 {
89   return this.styleObj.clip.bottom;
90 }
91
92 /////////////////////////////////////////////////////////////
93 // xbStyle.setClipBottom()
94
95 function nsxbStyleSetClipBottom(bottom)
96 {
97   return this.styleObj.clip.bottom = bottom;
98 }
99
100 /////////////////////////////////////////////////////////////
101 // xbStyle.getClipLeft()
102
103 function nsxbStyleGetClipLeft()
104 {
105   return this.styleObj.clip.left;
106 }
107
108 /////////////////////////////////////////////////////////////
109 // xbStyle.setClipLeft()
110
111 function nsxbStyleSetClipLeft(left)
112 {
113   return this.styleObj.clip.left = left;
114 }
115
116 /////////////////////////////////////////////////////////////
117 // xbStyle.getClipWidth()
118
119 function nsxbStyleGetClipWidth()
120 {
121   return this.styleObj.clip.width;
122 }
123
124 /////////////////////////////////////////////////////////////
125 // xbStyle.setClipWidth()
126
127 function nsxbStyleSetClipWidth(width)
128 {
129   return this.styleObj.clip.width = width;
130 }
131
132 /////////////////////////////////////////////////////////////
133 // xbStyle.getClipHeight()
134
135 function nsxbStyleGetClipHeight()
136 {
137   return this.styleObj.clip.height;
138 }
139
140 /////////////////////////////////////////////////////////////
141 // xbStyle.setClipHeight()
142
143 function nsxbStyleSetClipHeight(height)
144 {
145   return this.styleObj.clip.height = height;
146 }
147
148 /////////////////////////////////////////////////////////////////////////////
149 // xbStyle.getLeft()
150
151 function nsxbStyleGetLeft()
152 {
153   return this.styleObj.left;
154 }
155
156 /////////////////////////////////////////////////////////////////////////////
157 // xbStyle.setLeft()
158
159 function nsxbStyleSetLeft(left)
160 {
161   this.styleObj.left = left;
162 }
163
164 /////////////////////////////////////////////////////////////////////////////
165 // xbStyle.getTop()
166
167 function nsxbStyleGetTop()
168 {
169   return this.styleObj.top;
170 }
171
172 /////////////////////////////////////////////////////////////////////////////
173 // xbStyle.setTop()
174
175 function nsxbStyleSetTop(top)
176 {
177   this.styleObj.top = top;
178 }
179
180
181 /////////////////////////////////////////////////////////////////////////////
182 // xbStyle.getPageX()
183
184 function nsxbStyleGetPageX()
185 {
186   return this.styleObj.pageX;
187 }
188
189 /////////////////////////////////////////////////////////////////////////////
190 // xbStyle.setPageX()
191
192 function nsxbStyleSetPageX(x)
193 {
194   this.styleObj.x = this.styleObj.x  + x - this.styleObj.pageX;
195 }
196
197 /////////////////////////////////////////////////////////////////////////////
198 // xbStyle.getPageY()
199
200
201 function nsxbStyleGetPageY()
202 {
203   return this.styleObj.pageY;
204 }
205
206 /////////////////////////////////////////////////////////////////////////////
207 // xbStyle.setPageY()
208
209 function nsxbStyleSetPageY(y)
210 {
211   this.styleObj.y = this.styleObj.y  + y - this.styleObj.pageY;
212 }
213
214 /////////////////////////////////////////////////////////////////////////////
215 // xbStyle.getHeight()
216
217 function nsxbStyleGetHeight()
218 {
219   //if (this.styleObj.document && this.styleObj.document.height)
220   //  return this.styleObj.document.height;
221     
222   return this.styleObj.clip.height;
223 }
224
225 /////////////////////////////////////////////////////////////////////////////
226 // xbStyle.setHeight()
227
228 function nsxbStyleSetHeight(height)
229 {
230   this.styleObj.clip.height = height;
231 }
232
233 /////////////////////////////////////////////////////////////////////////////
234 // xbStyle.getWidth()
235
236 function nsxbStyleGetWidth()
237 {
238   //if (this.styleObj.document && this.styleObj.document.width)
239   //  return this.styleObj.document.width;
240     
241   return this.styleObj.clip.width;
242 }
243
244 /////////////////////////////////////////////////////////////////////////////
245 // xbStyle.setWidth()
246
247 // netscape will not dynamically change the width of a 
248 // layer. It will only happen upon a refresh.
249 function nsxbStyleSetWidth(width)
250 {
251   this.styleObj.clip.width = width;
252 }
253
254 /////////////////////////////////////////////////////////////////////////////
255
256 /////////////////////////////////////////////////////////////////////////////
257 // xbStyle.getVisibility()
258
259 function nsxbStyleGetVisibility()
260 {
261   switch(this.styleObj.visibility)
262   {
263   case 'hide':
264     return 'hidden';
265   case 'show':
266     return 'visible';
267   }
268   return '';
269 }
270
271 /////////////////////////////////////////////////////////////////////////////
272 // xbStyle.setVisibility()
273
274 function nsxbStyleSetVisibility(visibility)
275 {
276   switch(visibility)
277   {
278   case 'hidden':
279     visibility = 'hide';
280     break;
281   case 'visible':
282     visibility = 'show';
283     break;
284   case 'inherit':
285     break;
286   default:
287     visibility = 'show';
288     break;
289   }
290   this.styleObj.visibility = visibility;
291 }
292
293 /////////////////////////////////////////////////////////////////////////////
294 // xbStyle.getzIndex()
295
296 function nsxbStyleGetzIndex()
297 {
298   return this.styleObj.zIndex;
299 }
300
301 /////////////////////////////////////////////////////////////////////////////
302 // xbStyle.setzIndex()
303
304 function nsxbStyleSetzIndex(zIndex)
305 {
306   this.styleObj.zIndex = zIndex;
307 }
308
309 /////////////////////////////////////////////////////////////////////////////
310 // xbStyle.getBackgroundColor()
311
312 function nsxbStyleGetBackgroundColor()
313 {
314   return this.styleObj.bgColor;
315 }
316
317 /////////////////////////////////////////////////////////////////////////////
318 // xbStyle.setBackgroundColor()
319
320 function nsxbStyleSetBackgroundColor(color)
321 {
322   if (color)
323   {
324     this.styleObj.bgColor = color;
325     this.object.document.bgColor = color;
326     this.resizeTo(this.getWidth(), this.getHeight());
327   }
328 }
329
330 /////////////////////////////////////////////////////////////////////////////
331 // xbStyle.getColor()
332
333 function nsxbStyleGetColor()
334 {
335   return '#ffffff';
336 }
337
338 /////////////////////////////////////////////////////////////////////////////
339 // xbStyle.setColor()
340
341 function nsxbStyleSetColor(color)
342 {
343   this.object.document.fgColor = color;
344 }
345
346
347 /////////////////////////////////////////////////////////////////////////////
348 // xbStyle.moveAbove()
349
350 function xbStyleMoveAbove(cont)
351 {
352   this.setzIndex(cont.getzIndex()+1);
353 }
354
355 /////////////////////////////////////////////////////////////////////////////
356 // xbStyle.moveBelow()
357
358 function xbStyleMoveBelow(cont)
359 {
360   var zindex = cont.getzIndex() - 1;
361             
362   this.setzIndex(zindex);
363 }
364
365 /////////////////////////////////////////////////////////////////////////////
366 // xbStyle.moveBy()
367
368 function xbStyleMoveBy(deltaX, deltaY)
369 {
370   this.moveTo(this.getLeft() + deltaX, this.getTop() + deltaY);
371 }
372
373 /////////////////////////////////////////////////////////////////////////////
374 // xbStyle.moveTo()
375
376 function xbStyleMoveTo(x, y)
377 {
378   this.setLeft(x);
379   this.setTop(y);
380 }
381
382 /////////////////////////////////////////////////////////////////////////////
383 // xbStyle.moveToAbsolute()
384
385 function xbStyleMoveToAbsolute(x, y)
386 {
387   this.setPageX(x);
388   this.setPageY(y);
389 }
390
391 /////////////////////////////////////////////////////////////////////////////
392 // xbStyle.resizeBy()
393
394 function xbStyleResizeBy(deltaX, deltaY)
395 {
396   this.setWidth( this.getWidth() + deltaX );
397   this.setHeight( this.getHeight() + deltaY );
398 }
399
400 /////////////////////////////////////////////////////////////////////////////
401 // xbStyle.resizeTo()
402
403 function xbStyleResizeTo(x, y)
404 {
405   this.setWidth(x);
406   this.setHeight(y);
407 }
408
409 ////////////////////////////////////////////////////////////////////////
410 // Navigator 4.x resizing...
411
412 function nsxbStyleOnresize()
413 {
414     if (saveInnerWidth != xbGetWindowWidth() || saveInnerHeight != xbGetWindowHeight())
415     location.reload();
416
417   return false;
418 }
419
420 /////////////////////////////////////////////////////////////////////////////
421 // xbStyle.setInnerHTML()
422
423 function nsxbSetInnerHTML(str)
424 {
425   this.object.document.open('text/html');
426   this.object.document.write(str);
427   this.object.document.close();
428 }
429
430 xbStyle.prototype.getClip            = nsxbStyleGetClip;
431 xbStyle.prototype.setClip            = nsxbStyleSetClip;  
432 xbStyle.prototype.getClipTop         = nsxbStyleGetClipTop;
433 xbStyle.prototype.setClipTop         = nsxbStyleSetClipTop;  
434 xbStyle.prototype.getClipRight       = nsxbStyleGetClipRight;
435 xbStyle.prototype.setClipRight       = nsxbStyleSetClipRight;  
436 xbStyle.prototype.getClipBottom      = nsxbStyleGetClipBottom;
437 xbStyle.prototype.setClipBottom      = nsxbStyleSetClipBottom;  
438 xbStyle.prototype.getClipLeft        = nsxbStyleGetClipLeft;
439 xbStyle.prototype.setClipLeft        = nsxbStyleSetClipLeft;  
440 xbStyle.prototype.getClipWidth       = nsxbStyleGetClipWidth;
441 xbStyle.prototype.setClipWidth       = nsxbStyleSetClipWidth;  
442 xbStyle.prototype.getClipHeight      = nsxbStyleGetClipHeight;
443 xbStyle.prototype.setClipHeight      = nsxbStyleSetClipHeight;  
444 xbStyle.prototype.getLeft            = nsxbStyleGetLeft;
445 xbStyle.prototype.setLeft            = nsxbStyleSetLeft;
446 xbStyle.prototype.getTop             = nsxbStyleGetTop;
447 xbStyle.prototype.setTop             = nsxbStyleSetTop;
448 xbStyle.prototype.getPageX           = nsxbStyleGetPageX;
449 xbStyle.prototype.setPageX           = nsxbStyleSetPageX;
450 xbStyle.prototype.getPageY           = nsxbStyleGetPageY;
451 xbStyle.prototype.setPageY           = nsxbStyleSetPageY;
452 xbStyle.prototype.getVisibility      = nsxbStyleGetVisibility;
453 xbStyle.prototype.setVisibility      = nsxbStyleSetVisibility;
454 xbStyle.prototype.getzIndex          = nsxbStyleGetzIndex;
455 xbStyle.prototype.setzIndex          = nsxbStyleSetzIndex;            
456 xbStyle.prototype.getHeight          = nsxbStyleGetHeight;
457 xbStyle.prototype.setHeight          = nsxbStyleSetHeight;
458 xbStyle.prototype.getWidth           = nsxbStyleGetWidth;
459 xbStyle.prototype.setWidth           = nsxbStyleSetWidth;
460 xbStyle.prototype.getBackgroundColor = nsxbStyleGetBackgroundColor;
461 xbStyle.prototype.setBackgroundColor = nsxbStyleSetBackgroundColor;
462 xbStyle.prototype.getColor           = nsxbStyleGetColor;
463 xbStyle.prototype.setColor           = nsxbStyleSetColor;
464 xbStyle.prototype.setInnerHTML       = nsxbSetInnerHTML;
465 xbStyle.prototype.getBorderTopWidth    = xbStyleNotSupported;
466 xbStyle.prototype.getBorderRightWidth  = xbStyleNotSupported;
467 xbStyle.prototype.getBorderBottomWidth = xbStyleNotSupported;
468 xbStyle.prototype.getBorderLeftWidth   = xbStyleNotSupported;
469 xbStyle.prototype.getMarginLeft        = xbStyleNotSupported;
470 xbStyle.prototype.getMarginTop         = xbStyleNotSupported;
471 xbStyle.prototype.getMarginRight       = xbStyleNotSupported;
472 xbStyle.prototype.getMarginBottom      = xbStyleNotSupported;
473 xbStyle.prototype.getMarginLeft        = xbStyleNotSupported;
474 xbStyle.prototype.getPaddingTop        = xbStyleNotSupported;
475 xbStyle.prototype.getPaddingRight      = xbStyleNotSupported;
476 xbStyle.prototype.getPaddingBottom     = xbStyleNotSupported;
477 xbStyle.prototype.getPaddingLeft       = xbStyleNotSupported;
478 xbStyle.prototype.getClientWidth       = xbStyleNotSupported;
479 xbStyle.prototype.getClientHeight      = xbStyleNotSupported;
480
481 window.saveInnerWidth = window.innerWidth;
482 window.saveInnerHeight = window.innerHeight;
483
484 window.onresize = nsxbStyleOnresize;
485