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

  1. <?xml version="1.0"?>
  2.  
  3. <bindings id="toolbarBindings"
  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="toolbar-base">
  9.     <resources>
  10.       <stylesheet src="chrome://global/skin/toolbar.css"/>
  11.     </resources>
  12.     <implementation implements="nsIAccessibleProvider">
  13.       <property name="accessible">
  14.         <getter>
  15.           <![CDATA[
  16.             var accService = Components.classes["@mozilla.org/accessibilityService;1"].getService(Components.interfaces.nsIAccessibilityService);
  17.             if (this.localName == "toolbarseparator")
  18.               return accService.createXULToolbarSeparatorAccessible(this);
  19.             else
  20.               return accService.createXULToolbarAccessible(this);
  21.           ]]>
  22.         </getter>
  23.       </property>
  24.     </implementation>
  25.   </binding>
  26.  
  27.   <binding id="toolbar" extends="chrome://global/content/bindings/toolbar.xml#toolbar-base">
  28.     <content>
  29.       <xul:hbox flex="1" class="toolbar-holder" align="center"
  30.                 xbl:inherits="collapsed,last-toolbar,orient=tborient,align=tbalign,pack=tbpack">
  31.         <children/>
  32.       </xul:hbox>
  33.     </content>
  34.   </binding>
  35.  
  36.   <binding id="toolbar-primary" extends="chrome://global/content/bindings/toolbar.xml#toolbar">
  37.     <implementation implements="nsIObserver">
  38.       <field name="domain" readonly="true">
  39.         "browser.chrome.toolbar_style"
  40.       </field>
  41.  
  42.       <field name="prefs" readonly="true">
  43.         Components.classes["@mozilla.org/preferences-service;1"]
  44.                   .getService(Components.interfaces.nsIPrefService).getBranch(null)
  45.                   .QueryInterface(Components.interfaces.nsIPrefBranchInternal)
  46.       </field>
  47.  
  48.       <method name="observe">
  49.         <parameter name="subject"/>
  50.         <parameter name="topic"/>
  51.         <parameter name="name"/>
  52.         <body>
  53.           <![CDATA[
  54.             if (topic == "nsPref:changed" && name == this.domain) {
  55.               const styles = ["pictures", "text", null];
  56.               const style = styles[this.prefs.getIntPref(name)];
  57.               this.setAttribute("buttonstyle", style);
  58.               this.update("toolbarbutton", style);
  59.               this.update("button", style);
  60.             }
  61.           ]]>
  62.         </body>
  63.       </method>
  64.  
  65.       <method name="update">
  66.         <parameter name="tag"/>
  67.         <parameter name="style"/>
  68.         <body>
  69.           <![CDATA[
  70.             var elements = this.getElementsByTagName(tag);
  71.             for (var i = 0; i < elements.length; i++)
  72.               elements[i].setAttribute("buttonstyle", style);
  73.           ]]>
  74.         </body>
  75.       </method>
  76.  
  77.       <constructor>
  78.         this.prefs.addObserver(this.domain, this, false);
  79.         if (this.prefs.getIntPref(this.domain) != 2)
  80.           this.observe(this.prefs, "nsPref:changed", this.domain);
  81.       </constructor>
  82.  
  83.       <destructor>
  84.         this.prefs.removeObserver(this.domain, this);
  85.       </destructor>
  86.     </implementation>
  87.   </binding>
  88.  
  89.   <binding id="menubar" extends="xul:menubar">
  90.     <resources>
  91.       <stylesheet src="chrome://global/skin/toolbar.css"/>
  92.     </resources>
  93.  
  94.     <content>
  95.       <xul:hbox flex="1" class="toolbar-holder" xbl:inherits="collapsed,last-toolbar" align="center">
  96.         <children/>
  97.       </xul:hbox>
  98.     </content>
  99.     
  100.     <implementation implements="nsIAccessibleProvider">
  101.       <property name="accessible">
  102.         <getter>
  103.           <![CDATA[
  104.             var accService = Components.classes["@mozilla.org/accessibilityService;1"].getService(Components.interfaces.nsIAccessibilityService);
  105.             return accService.createXULMenubarAccessible(this);
  106.           ]]>
  107.         </getter>
  108.        </property>
  109.     </implementation>
  110.   </binding>
  111.  
  112.   <binding id="toolbarseparator" extends="chrome://global/content/bindings/toolbar.xml#toolbar-base"/>
  113.  
  114. </bindings>          
  115.  
  116.