!import
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <!-- ***** BEGIN LICENSE BLOCK *****
4 - Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 -
6 - The contents of this file are subject to the Mozilla Public License Version
7 - 1.1 (the "License"); you may not use this file except in compliance with
8 - the License. You may obtain a copy of the License at
9 - http://www.mozilla.org/MPL/
10 -
11 - Software distributed under the License is distributed on an "AS IS" basis,
12 - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 - for the specific language governing rights and limitations under the
14 - License.
15 -
16 - The Original Code is Mozilla.org code.
17 -
18 - The Initial Developer of the Original Code is
19 - HÃ¥kan Waara.
20 - Portions created by the Initial Developer are Copyright (C) 2001
21 - the Initial Developer. All Rights Reserved.
22 -
23 - Contributor(s):
24 - HÃ¥kan Waara (Original Author)
25 -
26 - Alternatively, the contents of this file may be used under the terms of
27 - either of the GNU General Public License Version 2 or later (the "GPL"),
28 - or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 - in which case the provisions of the GPL or the LGPL are applicable instead
30 - of those above. If you wish to allow use of your version of this file only
31 - under the terms of either the GPL or the LGPL, and not to allow others to
32 - use your version of this file under the terms of the MPL, indicate your
33 - decision by deleting the provisions above and replace them with the notice
34 - and other provisions required by the GPL or the LGPL. If you do not delete
35 - the provisions above, a recipient may use your version of this file under
36 - the terms of any one of the MPL, the GPL or the LGPL.
37 -
38 - ***** END LICENSE BLOCK ***** -->
39
40 <bindings id="spinbuttonsBindings"
41 xmlns="http://www.mozilla.org/xbl"
42 xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
43 xmlns:xbl="http://www.mozilla.org/xbl">
44
45 <binding id="spinbuttons"
46 extends="chrome://global/content/bindings/general.xml#basecontrol">
47
48 <resources>
49 <stylesheet src="chrome://global/skin/spinbuttons.css"/>
50 </resources>
51
52 <content>
53 <xul:vbox class="spinbuttons-box" flex="1">
54 <xul:button anonid="increaseButton" type="repeat" flex="1"
55 class="spinbuttons-button spinbuttons-up"
56 xbl:inherits="disabled,disabled=increasedisabled"/>
57 <xul:button anonid="decreaseButton" type="repeat" flex="1"
58 class="spinbuttons-button spinbuttons-down"
59 xbl:inherits="disabled,disabled=decreasedisabled"/>
60 </xul:vbox>
61 </content>
62
63 <implementation>
64 <property name="_increaseButton" readonly="true">
get__increaseButton
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
65 <getter>
66 return document.getAnonymousElementByAttribute(this, "anonid", "increaseButton");
67 </getter>
68 </property>
69 <property name="_decreaseButton" readonly="true">
get__decreaseButton
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
70 <getter>
71 return document.getAnonymousElementByAttribute(this, "anonid", "decreaseButton");
72 </getter>
73 </property>
74
get_increaseDisabled
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
set_increaseDisabled
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
75 <property name="increaseDisabled"
76 onget="return this._increaseButton.getAttribute('disabled') == 'true';"
77 onset="if (val) this._increaseButton.setAttribute('disabled', 'true');
78 else this._increaseButton.removeAttribute('disabled'); return val;"/>
get_decreaseDisabled
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
set_decreaseDisabled
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
79 <property name="decreaseDisabled"
80 onget="return this._decreaseButton.getAttribute('disabled') == 'true';"
81 onset="if (val) this._decreaseButton.setAttribute('disabled', 'true');
82 else this._decreaseButton.removeAttribute('disabled'); return val;"/>
83 </implementation>
84
85 <handlers>
onmousedown
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
86 <handler event="mousedown">
87 <![CDATA[
88 // on the Mac, the native theme draws the spinbutton as a single widget
89 // so a state attribute is set based on where the mouse button was pressed
90 if (event.originalTarget == this._increaseButton)
91 this.setAttribute("state", "up");
92 else if (event.originalTarget == this._decreaseButton)
93 this.setAttribute("state", "down");
94 ]]>
95 </handler>
96
onmouseup
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
97 <handler event="mouseup">
98 this.removeAttribute("state");
99 </handler>
onmouseout
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
100 <handler event="mouseout">
101 this.removeAttribute("state");
102 </handler>
103
oncommand
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
104 <handler event="command">
105 <![CDATA[
106 var eventname;
107 if (event.originalTarget == this._increaseButton)
108 eventname = "up";
109 else if (event.originalTarget == this._decreaseButton)
110 eventname = "down";
111
112 var evt = document.createEvent("Events");
113 evt.initEvent(eventname, true, true);
114 var cancel = this.dispatchEvent(evt);
115
116 if (this.hasAttribute("on" + eventname)) {
anon:117:25
(0 calls, 0 incl. v-uS, 0 excl. v-uS)
117 var fn = new Function("event", this.getAttribute("on" + eventname));
118 if (fn.call(this, event) == false)
119 cancel = true;
120 }
121
122 return !cancel;
123 ]]>
124 </handler>
125
126 </handlers>
127 </binding>
128
129 </bindings>