mobile/android/chrome/content/bindings/checkbox.xml

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

Correct previous dual key logic pending first delivery installment.

michael@0 1 <?xml version="1.0"?>
michael@0 2
michael@0 3 <!-- This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 - License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
michael@0 6
michael@0 7 <!DOCTYPE bindings [
michael@0 8 <!ENTITY % checkboxDTD SYSTEM "chrome://browser/locale/checkbox.dtd">
michael@0 9 %checkboxDTD;
michael@0 10 ]>
michael@0 11
michael@0 12 <bindings
michael@0 13 xmlns="http://www.mozilla.org/xbl"
michael@0 14 xmlns:xbl="http://www.mozilla.org/xbl"
michael@0 15 xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
michael@0 16
michael@0 17 <binding id="checkbox-radio" display="xul:box" extends="chrome://global/content/bindings/checkbox.xml#checkbox-baseline">
michael@0 18 <content>
michael@0 19 <xul:radiogroup anonid="group" xbl:inherits="disabled">
michael@0 20 <xul:radio anonid="on" class="checkbox-radio-on" label="&checkbox.yes.label;" xbl:inherits="label=onlabel"/>
michael@0 21 <xul:radio anonid="off" class="checkbox-radio-off" label="&checkbox.no.label;" xbl:inherits="label=offlabel"/>
michael@0 22 </xul:radiogroup>
michael@0 23 </content>
michael@0 24 <implementation>
michael@0 25 <constructor><![CDATA[
michael@0 26 this.setChecked(this.checked);
michael@0 27 ]]></constructor>
michael@0 28
michael@0 29 <field name="_group">
michael@0 30 document.getAnonymousElementByAttribute(this, "anonid", "group");
michael@0 31 </field>
michael@0 32
michael@0 33 <field name="_on">
michael@0 34 document.getAnonymousElementByAttribute(this, "anonid", "on");
michael@0 35 </field>
michael@0 36
michael@0 37 <field name="_off">
michael@0 38 document.getAnonymousElementByAttribute(this, "anonid", "off");
michael@0 39 </field>
michael@0 40
michael@0 41 <property name="onlabel"
michael@0 42 onget="return this._on.label"
michael@0 43 onset="this._on.label=val"/>
michael@0 44
michael@0 45 <property name="offlabel"
michael@0 46 onget="return this._off.label"
michael@0 47 onset="this._off.label=val"/>
michael@0 48
michael@0 49 <method name="setChecked">
michael@0 50 <parameter name="aValue"/>
michael@0 51 <body>
michael@0 52 <![CDATA[
michael@0 53 var change = (aValue != this.checked);
michael@0 54 if (aValue) {
michael@0 55 this.setAttribute("checked", "true");
michael@0 56 this._group.selectedItem = this._on;
michael@0 57 }
michael@0 58 else {
michael@0 59 this.removeAttribute("checked");
michael@0 60 this._group.selectedItem = this._off;
michael@0 61 }
michael@0 62
michael@0 63 if (change) {
michael@0 64 var event = document.createEvent("Events");
michael@0 65 event.initEvent("CheckboxStateChange", true, true);
michael@0 66 this.dispatchEvent(event);
michael@0 67 }
michael@0 68 return aValue;
michael@0 69 ]]>
michael@0 70 </body>
michael@0 71 </method>
michael@0 72 </implementation>
michael@0 73 </binding>
michael@0 74
michael@0 75 </bindings>

mercurial