toolkit/content/widgets/checkbox.xml

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

     1 <?xml version="1.0"?>
     2 <!-- This Source Code Form is subject to the terms of the Mozilla Public
     3    - License, v. 2.0. If a copy of the MPL was not distributed with this
     4    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
     7 <bindings id="checkboxBindings"
     8    xmlns="http://www.mozilla.org/xbl"
     9    xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
    10    xmlns:xbl="http://www.mozilla.org/xbl">
    12   <binding id="checkbox" extends="chrome://global/content/bindings/checkbox.xml#checkbox-baseline">
    13     <resources>
    14       <stylesheet src="chrome://global/skin/checkbox.css"/>
    15     </resources>
    16   </binding>
    18   <binding id="checkbox-baseline" role="xul:checkbox"
    19     extends="chrome://global/content/bindings/general.xml#basetext">
    20     <content>
    21       <xul:image class="checkbox-check" xbl:inherits="checked,disabled"/>
    22       <xul:hbox class="checkbox-label-box" flex="1">
    23         <xul:image class="checkbox-icon" xbl:inherits="src"/>
    24         <xul:label class="checkbox-label" xbl:inherits="xbl:text=label,accesskey,crop" flex="1"/>
    25       </xul:hbox>
    26     </content>
    28     <implementation implements="nsIDOMXULCheckboxElement">
    29       <method name="setChecked">
    30         <parameter name="aValue"/>
    31         <body>
    32         <![CDATA[
    33           var change = (aValue != (this.getAttribute('checked') == 'true'));
    34           if (aValue)
    35             this.setAttribute('checked', 'true');
    36           else
    37             this.removeAttribute('checked');
    38           if (change) {
    39             var event = document.createEvent('Events');
    40             event.initEvent('CheckboxStateChange', true, true);
    41             this.dispatchEvent(event);
    42           }
    43           return aValue;
    44         ]]>
    45         </body>
    46       </method>
    48       <!-- public implementation -->
    49       <property name="checked"    onset="return this.setChecked(val);"
    50                                   onget="return this.getAttribute('checked') == 'true';"/>
    51     </implementation>
    53     <handlers>
    54       <!-- While it would seem we could do this by handling oncommand, we need can't
    55            because any external oncommand handlers might get called before ours, and
    56            then they would see the incorrect value of checked. -->           
    57       <handler event="click" button="0" action="if (!this.disabled) this.checked = !this.checked;"/>
    58       <handler event="keypress" key=" ">
    59         <![CDATA[
    60           this.checked = !this.checked;
    61         ]]>
    62       </handler>
    63     </handlers>
    64   </binding> 
    66   <binding id="checkbox-with-spacing"
    67            extends="chrome://global/content/bindings/checkbox.xml#checkbox">
    69     <content>
    70       <xul:hbox class="checkbox-spacer-box">
    71         <xul:image class="checkbox-check" xbl:inherits="checked,disabled"/>
    72       </xul:hbox>
    73       <xul:hbox class="checkbox-label-center-box" flex="1">
    74         <xul:hbox class="checkbox-label-box" flex="1">
    75           <xul:image class="checkbox-icon" xbl:inherits="src"/>
    76           <xul:label class="checkbox-label" xbl:inherits="xbl:text=label,accesskey,crop" flex="1"/>
    77         </xul:hbox>
    78       </xul:hbox>
    79     </content>
    80   </binding>
    82 </bindings>

mercurial