RetroZilla/xpfe/global/resources/content/bindings/scrollbox.xml
2015-10-20 23:03:22 -04:00

83 lines
2.8 KiB
XML

<?xml version="1.0"?>
<bindings id="arrowscrollboxBindings"
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="scrollbox-base">
<resources>
<stylesheet src="chrome://global/skin/scrollbox.css"/>
</resources>
</binding>
<binding id="scrollbox" extends="chrome://global/content/bindings/scrollbox.xml#scrollbox-base">
<content>
<xul:box class="box-inherit scrollbox-innerbox" xbl:inherits="orient,align,pack,dir">
<children/>
</xul:box>
</content>
</binding>
<binding id="arrowscrollbox" extends="chrome://global/content/bindings/scrollbox.xml#scrollbox-base">
<content>
<xul:autorepeatbutton class="autorepeatbutton-up" collapsed="true"
oncommand="this.parentNode.scrollByIndex(-1); event.stopPropagation();"/>
<xul:scrollbox xbl:inherits="orient,align,pack,dir" flex="1">
<children/>
</xul:scrollbox>
<xul:autorepeatbutton class="autorepeatbutton-down" collapsed="true"
oncommand="this.parentNode.scrollByIndex(1); event.stopPropagation();"/>
</content>
<implementation>
<method name="scrollByIndex">
<parameter name="lines"/>
<body><![CDATA[
if (!("mScrollBoxObject" in this)) {
var kids = document.getAnonymousNodes(this);
this.mScrollBoxObject = kids[1].boxObject.QueryInterface(Components.interfaces.nsIScrollBoxObject);
}
this.mScrollBoxObject.scrollByIndex(lines);
]]></body>
</method>
</implementation>
<handlers>
<handler event="DOMMouseScroll" action="this.scrollByIndex(event.detail); event.stopPropagation();"/>
<handler event="underflow"><![CDATA[
// XXX Workaround for unexpected events dispatched during scrollbox
// destruction (bug 341047).
if (this.boxObject.width <= 0)
return;
var kids = document.getAnonymousNodes(this);
kids[0].collapsed = true;
kids[2].collapsed = true;
event.stopPropagation();
]]></handler>
<handler event="overflow"><![CDATA[
// XXX Workaround for unexpected events dispatched during scrollbox
// destruction (bug 341047).
if (this.boxObject.width <= 0)
return;
var kids = document.getAnonymousNodes(this);
kids[0].collapsed = false;
kids[2].collapsed = false;
event.stopPropagation();
]]></handler>
</handlers>
</binding>
<binding id="autorepeatbutton" extends="chrome://global/content/bindings/scrollbox.xml#scrollbox-base">
<content>
<xul:image class="autorepeatbutton-icon"/>
</content>
</binding>
</bindings>