gecko-dev/toolkit/content/widgets/checkbox.xml

56 строки
2.4 KiB
XML

<?xml version="1.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/widgets/checkbox.xml#checkbox-baseline">
<resources>
<stylesheet src="chrome://global/skin/checkbox.css"/>
</resources>
</binding>
<binding id="checkbox-baseline" extends="chrome://global/content/bindings/general.xml#basetext">
<content>
<xul:image class="checkbox-check" xbl:inherits="checked,disabled"/>
<xul:hbox class="checkbox-label-box" xbl:inherits="flex">
<xul:image class="checkbox-icon" xbl:inherits="src"/>
<xul:label class="checkbox-label" xbl:inherits="flex,xbl:text=label,accesskey,crop"/>
</xul:hbox>
</content>
<implementation implements="nsIDOMXULCheckboxElement, nsIAccessibleProvider">
<property name="accessible">
<getter>
<![CDATA[
var accService = Components.classes["@mozilla.org/accessibilityService;1"].getService(Components.interfaces.nsIAccessibilityService);
return accService.createXULCheckboxAccessible(this);
]]>
</getter>
</property>
<!-- public implementation -->
<property name="checked" onset="if (val) this.setAttribute('checked', 'true');
else this.removeAttribute('checked');
var event = document.createEvent('Events');
event.initEvent('CheckboxStateChange', false, true);
this.dispatchEvent(event);
return 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;
]]>
</handler>
</handlers>
</binding>
</bindings>