home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2005 October / Gamestar_77_2005-10_dvd.iso / Programy / nsb-install-8-0.exe / chrome / toolkit.jar / content / global / bindings / scrollbar.xml < prev    next >
Extensible Markup Language  |  2005-07-29  |  4KB  |  84 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-base">
  15.     <handlers>
  16.       <handler event="contextmenu" preventdefault="true"/>
  17.       <handler event="click" action="event.preventBubble();"/>
  18.       <handler event="dblclick" action="event.preventBubble();"/>
  19.       <handler event="command" action="event.preventBubble();"/>
  20.       <handler event="contextmenu" action="event.preventBubble();"/>
  21.     </handlers>
  22.   </binding>
  23.   
  24.   <binding id="scrollbar" extends="chrome://global/content/bindings/scrollbar.xml#scrollbar-base">
  25.     <content>
  26.       <xul:scrollbarbutton sbattr="scrollbar-up-top" type="decrement" xbl:inherits="sborient=orient"/>
  27.       <xul:scrollbarbutton sbattr="scrollbar-down-top" type="increment" hidden="true" xbl:inherits="sborient=orient"/>
  28.       <xul:slider flex="1" xbl:inherits="curpos,maxpos,pageincrement,increment,orient,sborient=orient">
  29.         <xul:thumb sbattr="scrollbar-thumb" xbl:inherits="orient,sborient=orient" 
  30.                    align="center" pack="center" flex="1"/>
  31.       </xul:slider>
  32.       <xul:scrollbarbutton sbattr="scrollbar-up-bottom" type="decrement" hidden="true" xbl:inherits="sborient=orient"/>
  33.       <xul:scrollbarbutton sbattr="scrollbar-down-bottom" type="increment" xbl:inherits="sborient=orient"/>
  34.     </content>
  35.     
  36.     <implementation>
  37.       <constructor>
  38.         if (navigator.platform.indexOf("Mac") != -1)
  39.           this.initScrollbar();
  40.       </constructor>
  41.  
  42.       <method name="initScrollbar">
  43.         <body>
  44.           <![CDATA[
  45.             try {
  46.               var scrollbarStyle = this.boxObject.getLookAndFeelMetric("scrollbarStyle");
  47.               var thumbStyle = this.boxObject.getLookAndFeelMetric("thumbStyle");
  48.               var downTop;
  49.               var upBottom;
  50.               if ( scrollbarStyle == "double" ) {
  51.                 downTop = document.getAnonymousElementByAttribute(this, "sbattr", "scrollbar-down-top");
  52.                 upBottom = document.getAnonymousElementByAttribute(this, "sbattr", "scrollbar-up-bottom");
  53.                 downTop.removeAttribute("hidden");
  54.                 upBottom.removeAttribute("hidden");
  55.               }
  56.               else if ( scrollbarStyle == "doubletop" ) {
  57.                 downTop = document.getAnonymousElementByAttribute(this, "sbattr", "scrollbar-down-top");
  58.                 var downBottom = document.getAnonymousElementByAttribute(this, "sbattr", "scrollbar-down-bottom");
  59.                 downTop.removeAttribute("hidden");
  60.                 downBottom.setAttribute("hidden","true");
  61.               }
  62.               else if ( scrollbarStyle == "doublebottom" ) {
  63.                 var upTop = document.getAnonymousElementByAttribute(this, "sbattr", "scrollbar-up-top");
  64.                 upBottom = document.getAnonymousElementByAttribute(this, "sbattr", "scrollbar-up-bottom");
  65.                 upTop.setAttribute("hidden","true");
  66.                 upBottom.removeAttribute("hidden");
  67.               }
  68.               if ( thumbStyle == "fixed" ) {
  69.                 var thumb = document.getAnonymousElementByAttribute(this, "sbattr","scrollbar-thumb");
  70.                 if ( thumb )
  71.                   thumb.removeAttribute("flex");
  72.               }
  73.             }
  74.             catch ( x ) {
  75.               //throw "Scrollbars in this skin are not properly supporting mac smart-scrolling prefs!";
  76.             }
  77.           ]]>
  78.         </body>
  79.       </method>
  80.     </implementation>
  81.   </binding>
  82. </bindings>
  83.  
  84.