diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /toolkit/content/widgets/checkbox.xml | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'toolkit/content/widgets/checkbox.xml')
-rw-r--r-- | toolkit/content/widgets/checkbox.xml | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/toolkit/content/widgets/checkbox.xml b/toolkit/content/widgets/checkbox.xml new file mode 100644 index 000000000..c6a5babfd --- /dev/null +++ b/toolkit/content/widgets/checkbox.xml @@ -0,0 +1,84 @@ +<?xml version="1.0"?> +<!-- This Source Code Form is subject to the terms of the Mozilla Public + - License, v. 2.0. If a copy of the MPL was not distributed with this + - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> + + +<bindings id="checkboxBindings" + xmlns="http://www.mozilla.org/xbl" + xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + xmlns:xbl="http://www.mozilla.org/xbl"> + + <binding id="checkbox" extends="chrome://global/content/bindings/checkbox.xml#checkbox-baseline"> + <resources> + <stylesheet src="chrome://global/skin/checkbox.css"/> + </resources> + </binding> + + <binding id="checkbox-baseline" role="xul:checkbox" + extends="chrome://global/content/bindings/general.xml#basetext"> + <content> + <xul:image class="checkbox-check" xbl:inherits="checked,disabled"/> + <xul:hbox class="checkbox-label-box" flex="1"> + <xul:image class="checkbox-icon" xbl:inherits="src"/> + <xul:label class="checkbox-label" xbl:inherits="xbl:text=label,accesskey,crop" flex="1"/> + </xul:hbox> + </content> + + <implementation implements="nsIDOMXULCheckboxElement"> + <method name="setChecked"> + <parameter name="aValue"/> + <body> + <![CDATA[ + var change = (aValue != (this.getAttribute('checked') == 'true')); + if (aValue) + this.setAttribute('checked', 'true'); + else + this.removeAttribute('checked'); + if (change) { + var event = document.createEvent('Events'); + event.initEvent('CheckboxStateChange', true, true); + this.dispatchEvent(event); + } + return aValue; + ]]> + </body> + </method> + + <!-- public implementation --> + <property name="checked" onset="return this.setChecked(val);" + onget="return this.getAttribute('checked') == 'true';"/> + </implementation> + + <handlers> + <!-- While it would seem we could do this by handling oncommand, we need can't + because any external oncommand handlers might get called before ours, and + then they would see the incorrect value of checked. --> + <handler event="click" button="0" action="if (!this.disabled) this.checked = !this.checked;"/> + <handler event="keypress" key=" "> + <![CDATA[ + this.checked = !this.checked; + // Prevent page from scrolling on the space key. + event.preventDefault(); + ]]> + </handler> + </handlers> + </binding> + + <binding id="checkbox-with-spacing" + extends="chrome://global/content/bindings/checkbox.xml#checkbox"> + + <content> + <xul:hbox class="checkbox-spacer-box"> + <xul:image class="checkbox-check" xbl:inherits="checked,disabled"/> + </xul:hbox> + <xul:hbox class="checkbox-label-center-box" flex="1"> + <xul:hbox class="checkbox-label-box" flex="1"> + <xul:image class="checkbox-icon" xbl:inherits="src"/> + <xul:label class="checkbox-label" xbl:inherits="xbl:text=label,accesskey,crop" flex="1"/> + </xul:hbox> + </xul:hbox> + </content> + </binding> + +</bindings> |