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

  1. <?xml version="1.0"?>
  2. <bindings id="expanderBindings"
  3.           xmlns="http://www.mozilla.org/xbl"
  4.           xmlns:xbl="http://www.mozilla.org/xbl"
  5.           xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  6.  
  7.   <binding id="expander" display="xul:vbox">
  8.     <resources>
  9.       <stylesheet src="chrome://global/skin/expander.css"/>
  10.     </resources>
  11.     <content>
  12.       <xul:hbox align="center">
  13.         <xul:button type="disclosure" class="expanderButton" anonid="disclosure" xbl:inherits="disabled" mousethrough="always"/>
  14.         <xul:label class="header expanderButton" anonid="label" xbl:inherits="value=label,disabled" mousethrough="always" flex="1"/>
  15.         <xul:button anonid="clear-button" xbl:inherits="label=clearlabel,disabled=cleardisabled,hidden=clearhidden" mousethrough="always"/>
  16.       </xul:hbox>
  17.       <xul:vbox flex="1" anonid="settings" class="settingsContainer" collapsed="true" xbl:inherits="align">
  18.         <children/>
  19.       </xul:vbox>
  20.     </content>
  21.     <implementation>
  22.       <constructor><![CDATA[
  23.         var settings = document.getAnonymousElementByAttribute(this, "anonid", "settings");
  24.         var expander = document.getAnonymousElementByAttribute(this, "anonid", "disclosure");
  25.         var open = this.getAttribute("open") == "true";
  26.         settings.collapsed = !open;
  27.         expander.open = open;
  28.       ]]></constructor>
  29.       <property name="open">
  30.         <setter>
  31.           <![CDATA[
  32.             var settings = document.getAnonymousElementByAttribute(this, "anonid", "settings");
  33.             var expander = document.getAnonymousElementByAttribute(this, "anonid", "disclosure");
  34.             settings.collapsed = !val;
  35.             expander.open = val;
  36.             if (val)
  37.               this.setAttribute("open", "true");
  38.             else
  39.               this.setAttribute("open", "false");
  40.             return val;
  41.           ]]>
  42.         </setter>
  43.         <getter>
  44.           return this.getAttribute("open");
  45.         </getter>
  46.       </property>        
  47.       <method name="onCommand">
  48.         <parameter name="aEvent"/>
  49.         <body><![CDATA[
  50.           var element = aEvent.originalTarget;
  51.           var button = element.getAttribute("anonid");
  52.           switch (button) {
  53.           case "disclosure":
  54.           case "label":
  55.             if (this.open == "true")
  56.               this.open = false;
  57.             else
  58.               this.open = true;
  59.             break;
  60.           case "clear-button":
  61.             var event = document.createEvent("Events");
  62.             event.initEvent("clear", false, true);
  63.             this.dispatchEvent(event);
  64.             break;
  65.           }
  66.         ]]></body>
  67.       </method>
  68.     </implementation>
  69.     <handlers>
  70.       <handler event="command"><![CDATA[
  71.         this.onCommand(event);
  72.       ]]></handler>
  73.       <handler event="click"><![CDATA[
  74.         if (event.originalTarget.localName == "label")
  75.           this.onCommand(event);
  76.       ]]></handler>
  77.     </handlers>
  78.   </binding>
  79.           
  80. </bindings>
  81.  
  82.