toolkit/content/widgets/general.xml

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/content/widgets/general.xml	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,244 @@
     1.4 +<?xml version="1.0"?>
     1.5 +<!-- This Source Code Form is subject to the terms of the Mozilla Public
     1.6 +   - License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 +   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
     1.8 +
     1.9 +
    1.10 +<bindings id="generalBindings"
    1.11 +   xmlns="http://www.mozilla.org/xbl"
    1.12 +   xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
    1.13 +   xmlns:xbl="http://www.mozilla.org/xbl">
    1.14 +
    1.15 +  <binding id="basecontrol">
    1.16 +    <implementation implements="nsIDOMXULControlElement">
    1.17 +      <!-- public implementation -->
    1.18 +      <property name="disabled" onset="if (val) this.setAttribute('disabled', 'true');
    1.19 +                                       else this.removeAttribute('disabled');
    1.20 +                                       return val;"
    1.21 +                                onget="return this.getAttribute('disabled') == 'true';"/>
    1.22 +      <property name="tabIndex" onget="return parseInt(this.getAttribute('tabindex')) || 0"
    1.23 +                                onset="if (val) this.setAttribute('tabindex', val);
    1.24 +                                       else this.removeAttribute('tabindex'); return val;"/>
    1.25 +    </implementation>
    1.26 +  </binding>
    1.27 +
    1.28 +  <binding id="basetext" extends="chrome://global/content/bindings/general.xml#basecontrol">
    1.29 +    <implementation implements="nsIDOMXULLabeledControlElement">
    1.30 +      <!-- public implementation -->
    1.31 +      <property name="label"      onset="this.setAttribute('label',val); return val;"
    1.32 +                                  onget="return this.getAttribute('label');"/>
    1.33 +      <property name="crop"       onset="this.setAttribute('crop',val); return val;"
    1.34 +                                  onget="return this.getAttribute('crop');"/>
    1.35 +      <property name="image"      onset="this.setAttribute('image',val); return val;"
    1.36 +                                  onget="return this.getAttribute('image');"/>
    1.37 +      <property name="command"    onset="this.setAttribute('command',val); return val;"
    1.38 +                                  onget="return this.getAttribute('command');"/>
    1.39 +      <property name="accessKey">
    1.40 +        <getter>
    1.41 +          <![CDATA[
    1.42 +            return this.labelElement ? this.labelElement.accessKey : this.getAttribute('accesskey');
    1.43 +          ]]>
    1.44 +        </getter>
    1.45 +        <setter>
    1.46 +          <![CDATA[
    1.47 +            // Always store on the control
    1.48 +            this.setAttribute('accesskey', val);
    1.49 +            // If there is a label, change the accesskey on the labelElement
    1.50 +            // if it's also set there
    1.51 +            if (this.labelElement) {
    1.52 +              this.labelElement.accessKey = val;
    1.53 +            }
    1.54 +            return val;
    1.55 +          ]]>
    1.56 +        </setter>
    1.57 +      </property>
    1.58 +
    1.59 +      <field name="labelElement"/>
    1.60 +    </implementation>      
    1.61 +  </binding>
    1.62 +
    1.63 +  <binding id="control-item" extends="chrome://global/content/bindings/general.xml#basetext">
    1.64 +    <implementation>
    1.65 +      <property name="value"      onset="this.setAttribute('value', val); return val;"
    1.66 +                                  onget="return this.getAttribute('value');"/>
    1.67 +    </implementation>
    1.68 +  </binding>
    1.69 +
    1.70 +  <binding id="root-element">
    1.71 +    <implementation>
    1.72 +      <field name="_lightweightTheme">null</field>
    1.73 +      <constructor><![CDATA[
    1.74 +        if (this.hasAttribute("lightweightthemes")) {
    1.75 +          let temp = {};
    1.76 +          Components.utils.import("resource://gre/modules/LightweightThemeConsumer.jsm", temp);
    1.77 +          this._lightweightTheme = new temp.LightweightThemeConsumer(this.ownerDocument);
    1.78 +        }
    1.79 +      ]]></constructor>
    1.80 +      <destructor><![CDATA[
    1.81 +        if (this._lightweightTheme) {
    1.82 +          this._lightweightTheme.destroy();
    1.83 +          this._lightweightTheme = null;
    1.84 +        }
    1.85 +      ]]></destructor>
    1.86 +    </implementation>
    1.87 +  </binding>
    1.88 +
    1.89 +  <binding id="iframe" role="outerdoc">
    1.90 +    <implementation>
    1.91 +      <property name="docShell"
    1.92 +                readonly="true"
    1.93 +                onget="return this.boxObject.QueryInterface(Components.interfaces.nsIContainerBoxObject).docShell"/>
    1.94 +      <property name="contentWindow"
    1.95 +                readonly="true"
    1.96 +                onget="return this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindow);"/>
    1.97 +      <property name="webNavigation"
    1.98 +                onget="return this.docShell.QueryInterface(Components.interfaces.nsIWebNavigation);"
    1.99 +                readonly="true"/>
   1.100 +      <property name="contentDocument" readonly="true"
   1.101 +                onget="return this.webNavigation.document;"/>
   1.102 +    </implementation>
   1.103 +  </binding>
   1.104 +
   1.105 +  <binding id="statusbarpanel" display="xul:button">
   1.106 +    <content>
   1.107 +      <children>
   1.108 +        <xul:label class="statusbarpanel-text" xbl:inherits="value=label,crop" crop="right" flex="1"/>
   1.109 +      </children>
   1.110 +    </content>
   1.111 +
   1.112 +    <implementation>
   1.113 +      <property name="label"
   1.114 +                onget="return this.getAttribute('label');"
   1.115 +                onset="this.setAttribute('label',val); return val;"/>
   1.116 +      <property name="image"
   1.117 +                onget="return this.getAttribute('image');"
   1.118 +                onset="this.setAttribute('image',val); return val;"/>
   1.119 +      <property name="src"
   1.120 +                onget="return this.getAttribute('src');"
   1.121 +                onset="this.setAttribute('src',val); return val;"/>
   1.122 +    </implementation>
   1.123 +  </binding>
   1.124 +
   1.125 +  <binding id="statusbarpanel-menu-iconic" display="xul:menu"
   1.126 +           extends="chrome://global/content/bindings/general.xml#statusbarpanel">
   1.127 +    <content>
   1.128 +      <xul:image class="statusbarpanel-icon" xbl:inherits="src,src=image"/>
   1.129 +      <children/>
   1.130 +    </content>
   1.131 +  </binding>
   1.132 +
   1.133 +  <binding id="statusbar" role="xul:statusbar">
   1.134 +    <content>
   1.135 +      <children/>
   1.136 +      <xul:statusbarpanel class="statusbar-resizerpanel">
   1.137 +        <xul:resizer dir="bottomend"/>
   1.138 +      </xul:statusbarpanel>
   1.139 +    </content>
   1.140 +  </binding>
   1.141 +  
   1.142 +  <binding id="statusbar-drag"
   1.143 +           extends="chrome://global/content/bindings/general.xml#statusbar">
   1.144 +    <implementation>
   1.145 +      <field name="_dragBindingAlive">true</field>
   1.146 +      <constructor>
   1.147 +        if (!this._draggableStarted) {
   1.148 +          this._draggableStarted = true;
   1.149 +          try {
   1.150 +            let tmp = {};
   1.151 +            Components.utils.import("resource://gre/modules/WindowDraggingUtils.jsm", tmp);
   1.152 +            let draghandle = new tmp.WindowDraggingElement(this);
   1.153 +            draghandle.mouseDownCheck = function () this._dragBindingAlive;
   1.154 +          } catch (e) {}
   1.155 +        }
   1.156 +      </constructor>
   1.157 +    </implementation>
   1.158 +  </binding>
   1.159 +
   1.160 +  <binding id="statusbarpanel-iconic" display="xul:button" role="xul:button"
   1.161 +           extends="chrome://global/content/bindings/general.xml#statusbarpanel">
   1.162 +    <content>
   1.163 +      <xul:image class="statusbarpanel-icon" xbl:inherits="src,src=image"/>
   1.164 +    </content>
   1.165 +  </binding>
   1.166 +
   1.167 +  <binding id="statusbarpanel-iconic-text" display="xul:button" role="xul:button"
   1.168 +           extends="chrome://global/content/bindings/general.xml#statusbarpanel">
   1.169 +    <content>
   1.170 +      <xul:image class="statusbarpanel-icon" xbl:inherits="src,src=image"/>
   1.171 +      <xul:label class="statusbarpanel-text" xbl:inherits="value=label,crop"/>
   1.172 +    </content>
   1.173 +  </binding>
   1.174 +
   1.175 +  <binding id="image" role="xul:image">
   1.176 +    <implementation implements="nsIDOMXULImageElement">
   1.177 +      <property name="src"
   1.178 +                onget="return this.getAttribute('src');"
   1.179 +                onset="this.setAttribute('src',val); return val;"/>
   1.180 +    </implementation>
   1.181 +  </binding>
   1.182 +
   1.183 +  <binding id="deck">
   1.184 +    <implementation>
   1.185 +      <property name="selectedIndex"
   1.186 +                onget="return this.getAttribute('selectedIndex') || '0'">
   1.187 +        <setter>
   1.188 +        <![CDATA[
   1.189 +          if (this.selectedIndex == val)
   1.190 +            return val;
   1.191 +          this.setAttribute("selectedIndex", val);
   1.192 +          var event = document.createEvent('Events');
   1.193 +          event.initEvent('select', true, true);
   1.194 +          this.dispatchEvent(event);
   1.195 +          return val;
   1.196 +        ]]>
   1.197 +        </setter>
   1.198 +      </property>
   1.199 +
   1.200 +      <property name="selectedPanel">
   1.201 +        <getter>
   1.202 +          <![CDATA[
   1.203 +            return this.childNodes[this.selectedIndex];
   1.204 +          ]]>
   1.205 +        </getter>
   1.206 +
   1.207 +        <setter>
   1.208 +          <![CDATA[
   1.209 +            var selectedIndex = -1;
   1.210 +            for (var panel = val; panel != null; panel = panel.previousSibling)
   1.211 +              ++selectedIndex;
   1.212 +            this.selectedIndex = selectedIndex;
   1.213 +            return val;
   1.214 +          ]]>
   1.215 +        </setter>
   1.216 +      </property>
   1.217 +    </implementation>
   1.218 +  </binding>
   1.219 +
   1.220 +  <binding id="dropmarker" extends="xul:button" role="xul:dropmarker">
   1.221 +    <resources>
   1.222 +      <stylesheet src="chrome://global/skin/dropmarker.css"/>
   1.223 +    </resources>
   1.224 +
   1.225 +    <content>
   1.226 +      <xul:image class="dropmarker-icon"/>
   1.227 +    </content>
   1.228 +  </binding>
   1.229 +
   1.230 +  <binding id="windowdragbox">
   1.231 +    <implementation>
   1.232 +      <field name="_dragBindingAlive">true</field>
   1.233 +      <constructor>
   1.234 +        if (!this._draggableStarted) {
   1.235 +          this._draggableStarted = true;
   1.236 +          try {
   1.237 +            let tmp = {};
   1.238 +            Components.utils.import("resource://gre/modules/WindowDraggingUtils.jsm", tmp);
   1.239 +            let draghandle = new tmp.WindowDraggingElement(this);
   1.240 +            draghandle.mouseDownCheck = function () this._dragBindingAlive;
   1.241 +          } catch (e) {}
   1.242 +        }
   1.243 +      </constructor>
   1.244 +    </implementation>
   1.245 +  </binding>
   1.246 +
   1.247 +</bindings>

mercurial