home *** CD-ROM | disk | FTP | other *** search
- <?xml version="1.0"?>
-
- <bindings 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="custom-arrowscrollbox-clicktoscroll">
- <content>
- <xul:box class="scrollbutton-arrow"
- anonid="buttonup"
- onclick="_dispEv(event)"
- onmousedown="_dispEv(event)"
- onmouseover="_dispEv(event)"
- onmouseup="_dispEv(event)"
- onmouseout="_dispEv(event)">
- <xul:image/>
- </xul:box>
-
- <xul:arrowscrollbox xbl:inherits="orient,align,pack,dir" flex="1"
- anonid="arrowscrollbox" clicktoscroll="true">
- <children/>
- </xul:arrowscrollbox>
-
- <xul:box class="scrollbutton-arrow"
- anonid="buttondown"
- onclick="_dispEv(event)"
- onmousedown="_dispEv(event)"
- onmouseover="_dispEv(event)"
- onmouseup="_dispEv(event)"
- onmouseout="_dispEv(event)">
- <xul:image/>
- </xul:box>
- </content>
-
- <implementation>
- <field name="mScrollbox">document.getAnonymousElementByAttribute(this, "anonid", "arrowscrollbox")</field>
- <field name="mSelfbuttonup">document.getAnonymousElementByAttribute(this, "anonid", "buttonup")</field>
- <field name="mSelfbuttondown">document.getAnonymousElementByAttribute(this, "anonid", "buttondown")</field>
- <field name="mNativebuttonup">null</field>
- <field name="mNativebuttondown">null</field>
-
- <constructor><![CDATA[
- if (!this.mScrollbox)
- return;
-
- this.mNativebuttonup = document.getAnonymousElementByAttribute(this.mScrollbox, "anonid", "scrollbutton-up");
- this.mNativebuttondown = document.getAnonymousElementByAttribute(this.mScrollbox, "anonid", "scrollbutton-down");
-
- if (!this.mNativebuttonup || !this.mNativebuttondown)
- return;
-
- var me = this;
- this.mScrollbox.addEventListener("UpdatedScrollButtonsDisabledState",
- function(){me.checkButtonsDisabledState()}, true
- );
-
- this.checkButtonsDisabledState();
- ]]></constructor>
-
- <destructor><![CDATA[
- if (this.mScrollbox && this.mNativebuttonup && this.mNativebuttondown) {
- var me = this;
- this.mScrollbox.removeEventListener("UpdatedScrollButtonsDisabledState",
- function(){me.checkButtonsDisabledState()}, true
- );
- }
- ]]></destructor>
-
- <property name="scrollBoxObject" readonly="true">
- <getter><![CDATA[
- return this.mScrollbox.scrollBoxObject;
- ]]></getter>
- </property>
-
- <method name="scrollByPixels">
- <parameter name="px"/>
- <body><![CDATA[
- this.mScrollbox.scrollByPixels(px);
- ]]></body>
- </method>
-
- <method name="checkButtonsDisabledState">
- <body><![CDATA[
- for each (var direction in ["up", "down"]) {
- var nativeButton = this["mNativebutton" + direction];
- this["mSelfbutton" + direction].setAttribute("disabled", nativeButton.collapsed ||
- nativeButton.getAttribute("disabled"));
- }
- ]]></body>
- </method>
-
- <method name="_dispEv">
- <parameter name="aEvent"/>
- <body><![CDATA[
- var target = aEvent.target;
-
- if (target.localName == "image")
- target = target.parentNode;
-
- var eventTypeAttr = "on" + aEvent.type;
-
- var button = this["mNative" + target.getAttribute("anonid")]
-
- return (button && button.hasAttribute(eventTypeAttr)) ? button[eventTypeAttr]() : false;
- ]]></body>
- </method>
- </implementation>
- </binding>
- </bindings>