3 * $Revision: 1.2 $ $Date: 2003/02/07 16:04:22 $
\r
6 /* ***** BEGIN LICENSE BLOCK *****
\r
7 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
\r
9 * The contents of this file are subject to the Mozilla Public License Version
\r
10 * 1.1 (the "License"); you may not use this file except in compliance with
\r
11 * the License. You may obtain a copy of the License at
\r
12 * http://www.mozilla.org/MPL/
\r
14 * Software distributed under the License is distributed on an "AS IS" basis,
\r
15 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
\r
16 * for the specific language governing rights and limitations under the
\r
19 * The Original Code is Netscape code.
\r
21 * The Initial Developer of the Original Code is
\r
22 * Netscape Corporation.
\r
23 * Portions created by the Initial Developer are Copyright (C) 2001
\r
24 * the Initial Developer. All Rights Reserved.
\r
26 * Contributor(s): Bob Clary <bclary@netscape.com>
\r
28 * ***** END LICENSE BLOCK ***** */
\r
30 /////////////////////////////////////////////////////////////
\r
31 // xbStyle.getClip()
\r
33 function nsxbStyleGetClip()
\r
35 var clip = this.styleObj.clip;
\r
36 var rect = new xbClipRect(clip.top, clip.right, clip.bottom, clip.left);
\r
37 return rect.toString();
\r
40 /////////////////////////////////////////////////////////////
\r
41 // xbStyle.setClip()
\r
43 function nsxbStyleSetClip(sClipString)
\r
45 var rect = new xbClipRect(sClipString);
\r
46 this.styleObj.clip.top = rect.top;
\r
47 this.styleObj.clip.right = rect.right;
\r
48 this.styleObj.clip.bottom = rect.bottom;
\r
49 this.styleObj.clip.left = rect.left;
\r
52 /////////////////////////////////////////////////////////////
\r
53 // xbStyle.getClipTop()
\r
55 function nsxbStyleGetClipTop()
\r
57 return this.styleObj.clip.top;
\r
60 /////////////////////////////////////////////////////////////
\r
61 // xbStyle.setClipTop()
\r
63 function nsxbStyleSetClipTop(top)
\r
65 return this.styleObj.clip.top = top;
\r
68 /////////////////////////////////////////////////////////////
\r
69 // xbStyle.getClipRight()
\r
71 function nsxbStyleGetClipRight()
\r
73 return this.styleObj.clip.right;
\r
76 /////////////////////////////////////////////////////////////
\r
77 // xbStyle.setClipRight()
\r
79 function nsxbStyleSetClipRight(right)
\r
81 return this.styleObj.clip.right = right;
\r
84 /////////////////////////////////////////////////////////////
\r
85 // xbStyle.getClipBottom()
\r
87 function nsxbStyleGetClipBottom()
\r
89 return this.styleObj.clip.bottom;
\r
92 /////////////////////////////////////////////////////////////
\r
93 // xbStyle.setClipBottom()
\r
95 function nsxbStyleSetClipBottom(bottom)
\r
97 return this.styleObj.clip.bottom = bottom;
\r
100 /////////////////////////////////////////////////////////////
\r
101 // xbStyle.getClipLeft()
\r
103 function nsxbStyleGetClipLeft()
\r
105 return this.styleObj.clip.left;
\r
108 /////////////////////////////////////////////////////////////
\r
109 // xbStyle.setClipLeft()
\r
111 function nsxbStyleSetClipLeft(left)
\r
113 return this.styleObj.clip.left = left;
\r
116 /////////////////////////////////////////////////////////////
\r
117 // xbStyle.getClipWidth()
\r
119 function nsxbStyleGetClipWidth()
\r
121 return this.styleObj.clip.width;
\r
124 /////////////////////////////////////////////////////////////
\r
125 // xbStyle.setClipWidth()
\r
127 function nsxbStyleSetClipWidth(width)
\r
129 return this.styleObj.clip.width = width;
\r
132 /////////////////////////////////////////////////////////////
\r
133 // xbStyle.getClipHeight()
\r
135 function nsxbStyleGetClipHeight()
\r
137 return this.styleObj.clip.height;
\r
140 /////////////////////////////////////////////////////////////
\r
141 // xbStyle.setClipHeight()
\r
143 function nsxbStyleSetClipHeight(height)
\r
145 return this.styleObj.clip.height = height;
\r
148 /////////////////////////////////////////////////////////////////////////////
\r
149 // xbStyle.getLeft()
\r
151 function nsxbStyleGetLeft()
\r
153 return this.styleObj.left;
\r
156 /////////////////////////////////////////////////////////////////////////////
\r
157 // xbStyle.setLeft()
\r
159 function nsxbStyleSetLeft(left)
\r
161 this.styleObj.left = left;
\r
164 /////////////////////////////////////////////////////////////////////////////
\r
165 // xbStyle.getTop()
\r
167 function nsxbStyleGetTop()
\r
169 return this.styleObj.top;
\r
172 /////////////////////////////////////////////////////////////////////////////
\r
173 // xbStyle.setTop()
\r
175 function nsxbStyleSetTop(top)
\r
177 this.styleObj.top = top;
\r
181 /////////////////////////////////////////////////////////////////////////////
\r
182 // xbStyle.getPageX()
\r
184 function nsxbStyleGetPageX()
\r
186 return this.styleObj.pageX;
\r
189 /////////////////////////////////////////////////////////////////////////////
\r
190 // xbStyle.setPageX()
\r
192 function nsxbStyleSetPageX(x)
\r
194 this.styleObj.x = this.styleObj.x + x - this.styleObj.pageX;
\r
197 /////////////////////////////////////////////////////////////////////////////
\r
198 // xbStyle.getPageY()
\r
201 function nsxbStyleGetPageY()
\r
203 return this.styleObj.pageY;
\r
206 /////////////////////////////////////////////////////////////////////////////
\r
207 // xbStyle.setPageY()
\r
209 function nsxbStyleSetPageY(y)
\r
211 this.styleObj.y = this.styleObj.y + y - this.styleObj.pageY;
\r
214 /////////////////////////////////////////////////////////////////////////////
\r
215 // xbStyle.getHeight()
\r
217 function nsxbStyleGetHeight()
\r
219 //if (this.styleObj.document && this.styleObj.document.height)
\r
220 // return this.styleObj.document.height;
\r
222 return this.styleObj.clip.height;
\r
225 /////////////////////////////////////////////////////////////////////////////
\r
226 // xbStyle.setHeight()
\r
228 function nsxbStyleSetHeight(height)
\r
230 this.styleObj.clip.height = height;
\r
233 /////////////////////////////////////////////////////////////////////////////
\r
234 // xbStyle.getWidth()
\r
236 function nsxbStyleGetWidth()
\r
238 //if (this.styleObj.document && this.styleObj.document.width)
\r
239 // return this.styleObj.document.width;
\r
241 return this.styleObj.clip.width;
\r
244 /////////////////////////////////////////////////////////////////////////////
\r
245 // xbStyle.setWidth()
\r
247 // netscape will not dynamically change the width of a
\r
248 // layer. It will only happen upon a refresh.
\r
249 function nsxbStyleSetWidth(width)
\r
251 this.styleObj.clip.width = width;
\r
254 /////////////////////////////////////////////////////////////////////////////
\r
256 /////////////////////////////////////////////////////////////////////////////
\r
257 // xbStyle.getVisibility()
\r
259 function nsxbStyleGetVisibility()
\r
261 switch(this.styleObj.visibility)
\r
271 /////////////////////////////////////////////////////////////////////////////
\r
272 // xbStyle.setVisibility()
\r
274 function nsxbStyleSetVisibility(visibility)
\r
279 visibility = 'hide';
\r
282 visibility = 'show';
\r
287 visibility = 'show';
\r
290 this.styleObj.visibility = visibility;
\r
293 /////////////////////////////////////////////////////////////////////////////
\r
294 // xbStyle.getzIndex()
\r
296 function nsxbStyleGetzIndex()
\r
298 return this.styleObj.zIndex;
\r
301 /////////////////////////////////////////////////////////////////////////////
\r
302 // xbStyle.setzIndex()
\r
304 function nsxbStyleSetzIndex(zIndex)
\r
306 this.styleObj.zIndex = zIndex;
\r
309 /////////////////////////////////////////////////////////////////////////////
\r
310 // xbStyle.getBackgroundColor()
\r
312 function nsxbStyleGetBackgroundColor()
\r
314 return this.styleObj.bgColor;
\r
317 /////////////////////////////////////////////////////////////////////////////
\r
318 // xbStyle.setBackgroundColor()
\r
320 function nsxbStyleSetBackgroundColor(color)
\r
324 this.styleObj.bgColor = color;
\r
325 this.object.document.bgColor = color;
\r
326 this.resizeTo(this.getWidth(), this.getHeight());
\r
330 /////////////////////////////////////////////////////////////////////////////
\r
331 // xbStyle.getColor()
\r
333 function nsxbStyleGetColor()
\r
338 /////////////////////////////////////////////////////////////////////////////
\r
339 // xbStyle.setColor()
\r
341 function nsxbStyleSetColor(color)
\r
343 this.object.document.fgColor = color;
\r
347 /////////////////////////////////////////////////////////////////////////////
\r
348 // xbStyle.moveAbove()
\r
350 function xbStyleMoveAbove(cont)
\r
352 this.setzIndex(cont.getzIndex()+1);
\r
355 /////////////////////////////////////////////////////////////////////////////
\r
356 // xbStyle.moveBelow()
\r
358 function xbStyleMoveBelow(cont)
\r
360 var zindex = cont.getzIndex() - 1;
\r
362 this.setzIndex(zindex);
\r
365 /////////////////////////////////////////////////////////////////////////////
\r
366 // xbStyle.moveBy()
\r
368 function xbStyleMoveBy(deltaX, deltaY)
\r
370 this.moveTo(this.getLeft() + deltaX, this.getTop() + deltaY);
\r
373 /////////////////////////////////////////////////////////////////////////////
\r
374 // xbStyle.moveTo()
\r
376 function xbStyleMoveTo(x, y)
\r
382 /////////////////////////////////////////////////////////////////////////////
\r
383 // xbStyle.moveToAbsolute()
\r
385 function xbStyleMoveToAbsolute(x, y)
\r
391 /////////////////////////////////////////////////////////////////////////////
\r
392 // xbStyle.resizeBy()
\r
394 function xbStyleResizeBy(deltaX, deltaY)
\r
396 this.setWidth( this.getWidth() + deltaX );
\r
397 this.setHeight( this.getHeight() + deltaY );
\r
400 /////////////////////////////////////////////////////////////////////////////
\r
401 // xbStyle.resizeTo()
\r
403 function xbStyleResizeTo(x, y)
\r
409 ////////////////////////////////////////////////////////////////////////
\r
410 // Navigator 4.x resizing...
\r
412 function nsxbStyleOnresize()
\r
414 if (saveInnerWidth != xbGetWindowWidth() || saveInnerHeight != xbGetWindowHeight())
\r
420 /////////////////////////////////////////////////////////////////////////////
\r
421 // xbStyle.setInnerHTML()
\r
423 function nsxbSetInnerHTML(str)
\r
425 this.object.document.open('text/html');
\r
426 this.object.document.write(str);
\r
427 this.object.document.close();
\r
430 xbStyle.prototype.getClip = nsxbStyleGetClip;
\r
431 xbStyle.prototype.setClip = nsxbStyleSetClip;
\r
432 xbStyle.prototype.getClipTop = nsxbStyleGetClipTop;
\r
433 xbStyle.prototype.setClipTop = nsxbStyleSetClipTop;
\r
434 xbStyle.prototype.getClipRight = nsxbStyleGetClipRight;
\r
435 xbStyle.prototype.setClipRight = nsxbStyleSetClipRight;
\r
436 xbStyle.prototype.getClipBottom = nsxbStyleGetClipBottom;
\r
437 xbStyle.prototype.setClipBottom = nsxbStyleSetClipBottom;
\r
438 xbStyle.prototype.getClipLeft = nsxbStyleGetClipLeft;
\r
439 xbStyle.prototype.setClipLeft = nsxbStyleSetClipLeft;
\r
440 xbStyle.prototype.getClipWidth = nsxbStyleGetClipWidth;
\r
441 xbStyle.prototype.setClipWidth = nsxbStyleSetClipWidth;
\r
442 xbStyle.prototype.getClipHeight = nsxbStyleGetClipHeight;
\r
443 xbStyle.prototype.setClipHeight = nsxbStyleSetClipHeight;
\r
444 xbStyle.prototype.getLeft = nsxbStyleGetLeft;
\r
445 xbStyle.prototype.setLeft = nsxbStyleSetLeft;
\r
446 xbStyle.prototype.getTop = nsxbStyleGetTop;
\r
447 xbStyle.prototype.setTop = nsxbStyleSetTop;
\r
448 xbStyle.prototype.getPageX = nsxbStyleGetPageX;
\r
449 xbStyle.prototype.setPageX = nsxbStyleSetPageX;
\r
450 xbStyle.prototype.getPageY = nsxbStyleGetPageY;
\r
451 xbStyle.prototype.setPageY = nsxbStyleSetPageY;
\r
452 xbStyle.prototype.getVisibility = nsxbStyleGetVisibility;
\r
453 xbStyle.prototype.setVisibility = nsxbStyleSetVisibility;
\r
454 xbStyle.prototype.getzIndex = nsxbStyleGetzIndex;
\r
455 xbStyle.prototype.setzIndex = nsxbStyleSetzIndex;
\r
456 xbStyle.prototype.getHeight = nsxbStyleGetHeight;
\r
457 xbStyle.prototype.setHeight = nsxbStyleSetHeight;
\r
458 xbStyle.prototype.getWidth = nsxbStyleGetWidth;
\r
459 xbStyle.prototype.setWidth = nsxbStyleSetWidth;
\r
460 xbStyle.prototype.getBackgroundColor = nsxbStyleGetBackgroundColor;
\r
461 xbStyle.prototype.setBackgroundColor = nsxbStyleSetBackgroundColor;
\r
462 xbStyle.prototype.getColor = nsxbStyleGetColor;
\r
463 xbStyle.prototype.setColor = nsxbStyleSetColor;
\r
464 xbStyle.prototype.setInnerHTML = nsxbSetInnerHTML;
\r
465 xbStyle.prototype.getBorderTopWidth = xbStyleNotSupported;
\r
466 xbStyle.prototype.getBorderRightWidth = xbStyleNotSupported;
\r
467 xbStyle.prototype.getBorderBottomWidth = xbStyleNotSupported;
\r
468 xbStyle.prototype.getBorderLeftWidth = xbStyleNotSupported;
\r
469 xbStyle.prototype.getMarginLeft = xbStyleNotSupported;
\r
470 xbStyle.prototype.getMarginTop = xbStyleNotSupported;
\r
471 xbStyle.prototype.getMarginRight = xbStyleNotSupported;
\r
472 xbStyle.prototype.getMarginBottom = xbStyleNotSupported;
\r
473 xbStyle.prototype.getMarginLeft = xbStyleNotSupported;
\r
474 xbStyle.prototype.getPaddingTop = xbStyleNotSupported;
\r
475 xbStyle.prototype.getPaddingRight = xbStyleNotSupported;
\r
476 xbStyle.prototype.getPaddingBottom = xbStyleNotSupported;
\r
477 xbStyle.prototype.getPaddingLeft = xbStyleNotSupported;
\r
478 xbStyle.prototype.getClientWidth = xbStyleNotSupported;
\r
479 xbStyle.prototype.getClientHeight = xbStyleNotSupported;
\r
481 window.saveInnerWidth = window.innerWidth;
\r
482 window.saveInnerHeight = window.innerHeight;
\r
484 window.onresize = nsxbStyleOnresize;
\r