home *** CD-ROM | disk | FTP | other *** search
/ PC World 2003 May / PCWorld_2003-05_cd.bin / Komunik / phoenix / chrome / toolkit.jar / content / global / bindings / scrollbar.xml < prev    next >
Extensible Markup Language  |  2002-06-18  |  3KB  |  78 lines

  1. <?xml version="1.0"?>
  2.  
  3. <bindings id="scrollbarBindings"
  4.    xmlns="http://www.mozilla.org/xbl"
  5.    xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  6.    xmlns:xbl="http://www.mozilla.org/xbl">
  7.   
  8.   <binding id="thumb" extends="xul:button">
  9.     <content>
  10.       <xul:gripper/>
  11.     </content>
  12.   </binding>
  13.   
  14.   <binding id="scrollbar">
  15.     <content>
  16.       <xul:scrollbarbutton sbattr="scrollbar-up-top" type="decrement" xbl:inherits="sborient=orient"/>
  17.       <xul:scrollbarbutton sbattr="scrollbar-down-top" type="increment" hidden="true" xbl:inherits="sborient=orient"/>
  18.       <xul:slider flex="1" xbl:inherits="curpos,maxpos,pageincrement,increment,orient,sborient=orient">
  19.         <xul:thumb sbattr="scrollbar-thumb" xbl:inherits="orient,sborient=orient" 
  20.                    align="center" pack="center" flex="1"/>
  21.       </xul:slider>
  22.       <xul:scrollbarbutton sbattr="scrollbar-up-bottom" type="decrement" hidden="true" xbl:inherits="sborient=orient"/>
  23.       <xul:scrollbarbutton sbattr="scrollbar-down-bottom" type="increment" xbl:inherits="sborient=orient"/>
  24.     </content>
  25.     
  26.     <implementation>
  27.       <constructor>
  28.         if (navigator.platform.indexOf("Mac") != -1)
  29.           this.initScrollbar();
  30.       </constructor>
  31.  
  32.       <method name="initScrollbar">
  33.         <body>
  34.           <![CDATA[
  35.             try {
  36.               var scrollbarStyle = this.boxObject.getLookAndFeelMetric("scrollbarStyle");
  37.               var thumbStyle = this.boxObject.getLookAndFeelMetric("thumbStyle");
  38.               var downTop;
  39.               var upBottom;
  40.               if ( scrollbarStyle == "double" ) {
  41.                 downTop = document.getAnonymousElementByAttribute(this, "sbattr", "scrollbar-down-top");
  42.                 upBottom = document.getAnonymousElementByAttribute(this, "sbattr", "scrollbar-up-bottom");
  43.                 downTop.removeAttribute("hidden");
  44.                 upBottom.removeAttribute("hidden");
  45.               }
  46.               else if ( scrollbarStyle == "doubletop" ) {
  47.                 downTop = document.getAnonymousElementByAttribute(this, "sbattr", "scrollbar-down-top");
  48.                 var downBottom = document.getAnonymousElementByAttribute(this, "sbattr", "scrollbar-down-bottom");
  49.                 downTop.removeAttribute("hidden");
  50.                 downBottom.setAttribute("hidden","true");
  51.               }
  52.               else if ( scrollbarStyle == "doublebottom" ) {
  53.                 var upTop = document.getAnonymousElementByAttribute(this, "sbattr", "scrollbar-up-top");
  54.                 upBottom = document.getAnonymousElementByAttribute(this, "sbattr", "scrollbar-up-bottom");
  55.                 upTop.setAttribute("hidden","true");
  56.                 upBottom.removeAttribute("hidden");
  57.               }
  58.               if ( thumbStyle == "fixed" ) {
  59.                 var thumb = document.getAnonymousElementByAttribute(this, "sbattr","scrollbar-thumb");
  60.                 if ( thumb )
  61.                   thumb.removeAttribute("flex");
  62.               }
  63.             }
  64.             catch ( x ) {
  65.               //throw "Scrollbars in this skin are not properly supporting mac smart-scrolling prefs!";
  66.             }
  67.           ]]>
  68.         </body>
  69.       </method>
  70.     </implementation>
  71.  
  72.     <handlers>
  73.      <handler event="contextmenu" preventdefault="true"/>
  74.     </handlers>
  75.   </binding>
  76. </bindings>
  77.  
  78.