3  * $Revision: 1.2 $ $Date: 2003/02/07 16:04:22 $
 
   6 /* ***** BEGIN LICENSE BLOCK *****
 
   7  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 
   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/
 
  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
 
  19  * The Original Code is Netscape code.
 
  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.
 
  26  * Contributor(s): Bob Clary <bclary@netscape.com>
 
  28  * ***** END LICENSE BLOCK ***** */
 
  30 /////////////////////////////////////////////////////////////
 
  33 function nsxbStyleGetClip()
 
  35   var clip = this.styleObj.clip;
 
  36   var rect = new xbClipRect(clip.top, clip.right, clip.bottom, clip.left);
 
  37   return rect.toString();
 
  40 /////////////////////////////////////////////////////////////
 
  43 function nsxbStyleSetClip(sClipString)
 
  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;
 
  52 /////////////////////////////////////////////////////////////
 
  53 // xbStyle.getClipTop()
 
  55 function nsxbStyleGetClipTop()
 
  57   return this.styleObj.clip.top;
 
  60 /////////////////////////////////////////////////////////////
 
  61 // xbStyle.setClipTop()
 
  63 function nsxbStyleSetClipTop(top)
 
  65   return this.styleObj.clip.top = top;
 
  68 /////////////////////////////////////////////////////////////
 
  69 // xbStyle.getClipRight()
 
  71 function nsxbStyleGetClipRight()
 
  73   return this.styleObj.clip.right;
 
  76 /////////////////////////////////////////////////////////////
 
  77 // xbStyle.setClipRight()
 
  79 function nsxbStyleSetClipRight(right)
 
  81   return this.styleObj.clip.right = right;
 
  84 /////////////////////////////////////////////////////////////
 
  85 // xbStyle.getClipBottom()
 
  87 function nsxbStyleGetClipBottom()
 
  89   return this.styleObj.clip.bottom;
 
  92 /////////////////////////////////////////////////////////////
 
  93 // xbStyle.setClipBottom()
 
  95 function nsxbStyleSetClipBottom(bottom)
 
  97   return this.styleObj.clip.bottom = bottom;
 
 100 /////////////////////////////////////////////////////////////
 
 101 // xbStyle.getClipLeft()
 
 103 function nsxbStyleGetClipLeft()
 
 105   return this.styleObj.clip.left;
 
 108 /////////////////////////////////////////////////////////////
 
 109 // xbStyle.setClipLeft()
 
 111 function nsxbStyleSetClipLeft(left)
 
 113   return this.styleObj.clip.left = left;
 
 116 /////////////////////////////////////////////////////////////
 
 117 // xbStyle.getClipWidth()
 
 119 function nsxbStyleGetClipWidth()
 
 121   return this.styleObj.clip.width;
 
 124 /////////////////////////////////////////////////////////////
 
 125 // xbStyle.setClipWidth()
 
 127 function nsxbStyleSetClipWidth(width)
 
 129   return this.styleObj.clip.width = width;
 
 132 /////////////////////////////////////////////////////////////
 
 133 // xbStyle.getClipHeight()
 
 135 function nsxbStyleGetClipHeight()
 
 137   return this.styleObj.clip.height;
 
 140 /////////////////////////////////////////////////////////////
 
 141 // xbStyle.setClipHeight()
 
 143 function nsxbStyleSetClipHeight(height)
 
 145   return this.styleObj.clip.height = height;
 
 148 /////////////////////////////////////////////////////////////////////////////
 
 151 function nsxbStyleGetLeft()
 
 153   return this.styleObj.left;
 
 156 /////////////////////////////////////////////////////////////////////////////
 
 159 function nsxbStyleSetLeft(left)
 
 161   this.styleObj.left = left;
 
 164 /////////////////////////////////////////////////////////////////////////////
 
 167 function nsxbStyleGetTop()
 
 169   return this.styleObj.top;
 
 172 /////////////////////////////////////////////////////////////////////////////
 
 175 function nsxbStyleSetTop(top)
 
 177   this.styleObj.top = top;
 
 181 /////////////////////////////////////////////////////////////////////////////
 
 182 // xbStyle.getPageX()
 
 184 function nsxbStyleGetPageX()
 
 186   return this.styleObj.pageX;
 
 189 /////////////////////////////////////////////////////////////////////////////
 
 190 // xbStyle.setPageX()
 
 192 function nsxbStyleSetPageX(x)
 
 194   this.styleObj.x = this.styleObj.x  + x - this.styleObj.pageX;
 
 197 /////////////////////////////////////////////////////////////////////////////
 
 198 // xbStyle.getPageY()
 
 201 function nsxbStyleGetPageY()
 
 203   return this.styleObj.pageY;
 
 206 /////////////////////////////////////////////////////////////////////////////
 
 207 // xbStyle.setPageY()
 
 209 function nsxbStyleSetPageY(y)
 
 211   this.styleObj.y = this.styleObj.y  + y - this.styleObj.pageY;
 
 214 /////////////////////////////////////////////////////////////////////////////
 
 215 // xbStyle.getHeight()
 
 217 function nsxbStyleGetHeight()
 
 219   //if (this.styleObj.document && this.styleObj.document.height)
 
 220   //  return this.styleObj.document.height;
 
 222   return this.styleObj.clip.height;
 
 225 /////////////////////////////////////////////////////////////////////////////
 
 226 // xbStyle.setHeight()
 
 228 function nsxbStyleSetHeight(height)
 
 230   this.styleObj.clip.height = height;
 
 233 /////////////////////////////////////////////////////////////////////////////
 
 234 // xbStyle.getWidth()
 
 236 function nsxbStyleGetWidth()
 
 238   //if (this.styleObj.document && this.styleObj.document.width)
 
 239   //  return this.styleObj.document.width;
 
 241   return this.styleObj.clip.width;
 
 244 /////////////////////////////////////////////////////////////////////////////
 
 245 // xbStyle.setWidth()
 
 247 // netscape will not dynamically change the width of a 
 
 248 // layer. It will only happen upon a refresh.
 
 249 function nsxbStyleSetWidth(width)
 
 251   this.styleObj.clip.width = width;
 
 254 /////////////////////////////////////////////////////////////////////////////
 
 256 /////////////////////////////////////////////////////////////////////////////
 
 257 // xbStyle.getVisibility()
 
 259 function nsxbStyleGetVisibility()
 
 261   switch(this.styleObj.visibility)
 
 271 /////////////////////////////////////////////////////////////////////////////
 
 272 // xbStyle.setVisibility()
 
 274 function nsxbStyleSetVisibility(visibility)
 
 290   this.styleObj.visibility = visibility;
 
 293 /////////////////////////////////////////////////////////////////////////////
 
 294 // xbStyle.getzIndex()
 
 296 function nsxbStyleGetzIndex()
 
 298   return this.styleObj.zIndex;
 
 301 /////////////////////////////////////////////////////////////////////////////
 
 302 // xbStyle.setzIndex()
 
 304 function nsxbStyleSetzIndex(zIndex)
 
 306   this.styleObj.zIndex = zIndex;
 
 309 /////////////////////////////////////////////////////////////////////////////
 
 310 // xbStyle.getBackgroundColor()
 
 312 function nsxbStyleGetBackgroundColor()
 
 314   return this.styleObj.bgColor;
 
 317 /////////////////////////////////////////////////////////////////////////////
 
 318 // xbStyle.setBackgroundColor()
 
 320 function nsxbStyleSetBackgroundColor(color)
 
 324     this.styleObj.bgColor = color;
 
 325     this.object.document.bgColor = color;
 
 326     this.resizeTo(this.getWidth(), this.getHeight());
 
 330 /////////////////////////////////////////////////////////////////////////////
 
 331 // xbStyle.getColor()
 
 333 function nsxbStyleGetColor()
 
 338 /////////////////////////////////////////////////////////////////////////////
 
 339 // xbStyle.setColor()
 
 341 function nsxbStyleSetColor(color)
 
 343   this.object.document.fgColor = color;
 
 347 /////////////////////////////////////////////////////////////////////////////
 
 348 // xbStyle.moveAbove()
 
 350 function xbStyleMoveAbove(cont)
 
 352   this.setzIndex(cont.getzIndex()+1);
 
 355 /////////////////////////////////////////////////////////////////////////////
 
 356 // xbStyle.moveBelow()
 
 358 function xbStyleMoveBelow(cont)
 
 360   var zindex = cont.getzIndex() - 1;
 
 362   this.setzIndex(zindex);
 
 365 /////////////////////////////////////////////////////////////////////////////
 
 368 function xbStyleMoveBy(deltaX, deltaY)
 
 370   this.moveTo(this.getLeft() + deltaX, this.getTop() + deltaY);
 
 373 /////////////////////////////////////////////////////////////////////////////
 
 376 function xbStyleMoveTo(x, y)
 
 382 /////////////////////////////////////////////////////////////////////////////
 
 383 // xbStyle.moveToAbsolute()
 
 385 function xbStyleMoveToAbsolute(x, y)
 
 391 /////////////////////////////////////////////////////////////////////////////
 
 392 // xbStyle.resizeBy()
 
 394 function xbStyleResizeBy(deltaX, deltaY)
 
 396   this.setWidth( this.getWidth() + deltaX );
 
 397   this.setHeight( this.getHeight() + deltaY );
 
 400 /////////////////////////////////////////////////////////////////////////////
 
 401 // xbStyle.resizeTo()
 
 403 function xbStyleResizeTo(x, y)
 
 409 ////////////////////////////////////////////////////////////////////////
 
 410 // Navigator 4.x resizing...
 
 412 function nsxbStyleOnresize()
 
 414     if (saveInnerWidth != xbGetWindowWidth() || saveInnerHeight != xbGetWindowHeight())
 
 420 /////////////////////////////////////////////////////////////////////////////
 
 421 // xbStyle.setInnerHTML()
 
 423 function nsxbSetInnerHTML(str)
 
 425   this.object.document.open('text/html');
 
 426   this.object.document.write(str);
 
 427   this.object.document.close();
 
 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;
 
 481 window.saveInnerWidth = window.innerWidth;
 
 482 window.saveInnerHeight = window.innerHeight;
 
 484 window.onresize = nsxbStyleOnresize;