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 / progressmeter.xml < prev    next >
Extensible Markup Language  |  2005-07-29  |  3KB  |  86 lines

  1. <?xml version="1.0"?>
  2.  
  3. <bindings id="progressmeterBindings"
  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="progressmeter">
  9.     <resources>
  10.       <stylesheet src="chrome://global/skin/progressmeter.css"/>
  11.     </resources>
  12.  
  13.     <content>
  14.       <xul:spacer class="progress-bar" xbl:inherits="mode"/>
  15.       <xul:spacer class="progress-remainder" xbl:inherits="mode"/>
  16.     </content>
  17.     
  18.     <implementation implements="nsIAccessibleProvider">     
  19.       <property name="label" onset="if (this.label != val) this.setAttribute('label',val); return val;"
  20.                                       onget="return this.getAttribute('label');"/>
  21.  
  22.       <property name="mode" onset="if (this.mode != val) this.setAttribute('mode', val); return val;"
  23.                             onget="return this.getAttribute('mode');"/>
  24.  
  25.       <property name="value" onget="return this.getAttribute('value');">
  26.         <setter><![CDATA[
  27.           var p = Math.round(val);
  28.           var c = this.value; 
  29.           if (p != c) {
  30.             var delta = p - c;
  31.             if (delta < 0)
  32.               delta = -delta;
  33.             if (delta > 3 || p == 0 || p == 100)
  34.               this.setAttribute("value", p);
  35.           }
  36.           
  37.           return p;
  38.         ]]></setter>
  39.       </property>
  40.  
  41.       <property name="accessible">
  42.         <getter>
  43.           <![CDATA[
  44.             var accService = Components.classes["@mozilla.org/accessibilityService;1"].getService(Components.interfaces.nsIAccessibilityService);
  45.             return accService.createXULProgressMeterAccessible(this);
  46.           ]]>
  47.         </getter>
  48.       </property>
  49.     </implementation>
  50.   </binding>
  51.  
  52.   <binding id="progressmeter-undetermined"
  53.            extends="chrome://global/content/bindings/progressmeter.xml#progressmeter">
  54.     <content>
  55.       <xul:stack class="progress-remainder" flex="1" anonid="stack" style="overflow: -moz-hidden-unscrollable;">
  56.         <xul:spacer class="progress-bar" anonid="spacer" top="0" style="margin-right: -1000px;"/>
  57.       </xul:stack>
  58.     </content>
  59.  
  60.     <implementation>
  61.       <method name="init">
  62.         <body><![CDATA[
  63.           var stack = document.getAnonymousElementByAttribute(this, "anonid", "stack");
  64.           var spacer = document.getAnonymousElementByAttribute(this, "anonid", "spacer");
  65.           var position = -1;
  66.           var interval = setInterval(function nextStep() {
  67.             try {
  68.               spacer.height = stack.boxObject.height;
  69.               spacer.width = stack.boxObject.width >> 2;
  70.               spacer.left = spacer.width * position;
  71.               position += 30 / (stack.boxObject.width + 600);
  72.               if (position >= 4)
  73.                 position = -1;
  74.             } catch (e) {
  75.               clearInterval(interval);
  76.             }
  77.           }, 10);
  78.         ]]></body>
  79.       </method>
  80.  
  81.       <constructor>this.init();</constructor>
  82.     </implementation>
  83.   </binding>
  84.  
  85. </bindings>
  86.