toolkit/content/widgets/general.xml

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:c8f89232e91b
1 <?xml version="1.0"?>
2 <!-- This Source Code Form is subject to the terms of the Mozilla Public
3 - License, v. 2.0. If a copy of the MPL was not distributed with this
4 - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
5
6
7 <bindings id="generalBindings"
8 xmlns="http://www.mozilla.org/xbl"
9 xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
10 xmlns:xbl="http://www.mozilla.org/xbl">
11
12 <binding id="basecontrol">
13 <implementation implements="nsIDOMXULControlElement">
14 <!-- public implementation -->
15 <property name="disabled" onset="if (val) this.setAttribute('disabled', 'true');
16 else this.removeAttribute('disabled');
17 return val;"
18 onget="return this.getAttribute('disabled') == 'true';"/>
19 <property name="tabIndex" onget="return parseInt(this.getAttribute('tabindex')) || 0"
20 onset="if (val) this.setAttribute('tabindex', val);
21 else this.removeAttribute('tabindex'); return val;"/>
22 </implementation>
23 </binding>
24
25 <binding id="basetext" extends="chrome://global/content/bindings/general.xml#basecontrol">
26 <implementation implements="nsIDOMXULLabeledControlElement">
27 <!-- public implementation -->
28 <property name="label" onset="this.setAttribute('label',val); return val;"
29 onget="return this.getAttribute('label');"/>
30 <property name="crop" onset="this.setAttribute('crop',val); return val;"
31 onget="return this.getAttribute('crop');"/>
32 <property name="image" onset="this.setAttribute('image',val); return val;"
33 onget="return this.getAttribute('image');"/>
34 <property name="command" onset="this.setAttribute('command',val); return val;"
35 onget="return this.getAttribute('command');"/>
36 <property name="accessKey">
37 <getter>
38 <![CDATA[
39 return this.labelElement ? this.labelElement.accessKey : this.getAttribute('accesskey');
40 ]]>
41 </getter>
42 <setter>
43 <![CDATA[
44 // Always store on the control
45 this.setAttribute('accesskey', val);
46 // If there is a label, change the accesskey on the labelElement
47 // if it's also set there
48 if (this.labelElement) {
49 this.labelElement.accessKey = val;
50 }
51 return val;
52 ]]>
53 </setter>
54 </property>
55
56 <field name="labelElement"/>
57 </implementation>
58 </binding>
59
60 <binding id="control-item" extends="chrome://global/content/bindings/general.xml#basetext">
61 <implementation>
62 <property name="value" onset="this.setAttribute('value', val); return val;"
63 onget="return this.getAttribute('value');"/>
64 </implementation>
65 </binding>
66
67 <binding id="root-element">
68 <implementation>
69 <field name="_lightweightTheme">null</field>
70 <constructor><![CDATA[
71 if (this.hasAttribute("lightweightthemes")) {
72 let temp = {};
73 Components.utils.import("resource://gre/modules/LightweightThemeConsumer.jsm", temp);
74 this._lightweightTheme = new temp.LightweightThemeConsumer(this.ownerDocument);
75 }
76 ]]></constructor>
77 <destructor><![CDATA[
78 if (this._lightweightTheme) {
79 this._lightweightTheme.destroy();
80 this._lightweightTheme = null;
81 }
82 ]]></destructor>
83 </implementation>
84 </binding>
85
86 <binding id="iframe" role="outerdoc">
87 <implementation>
88 <property name="docShell"
89 readonly="true"
90 onget="return this.boxObject.QueryInterface(Components.interfaces.nsIContainerBoxObject).docShell"/>
91 <property name="contentWindow"
92 readonly="true"
93 onget="return this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindow);"/>
94 <property name="webNavigation"
95 onget="return this.docShell.QueryInterface(Components.interfaces.nsIWebNavigation);"
96 readonly="true"/>
97 <property name="contentDocument" readonly="true"
98 onget="return this.webNavigation.document;"/>
99 </implementation>
100 </binding>
101
102 <binding id="statusbarpanel" display="xul:button">
103 <content>
104 <children>
105 <xul:label class="statusbarpanel-text" xbl:inherits="value=label,crop" crop="right" flex="1"/>
106 </children>
107 </content>
108
109 <implementation>
110 <property name="label"
111 onget="return this.getAttribute('label');"
112 onset="this.setAttribute('label',val); return val;"/>
113 <property name="image"
114 onget="return this.getAttribute('image');"
115 onset="this.setAttribute('image',val); return val;"/>
116 <property name="src"
117 onget="return this.getAttribute('src');"
118 onset="this.setAttribute('src',val); return val;"/>
119 </implementation>
120 </binding>
121
122 <binding id="statusbarpanel-menu-iconic" display="xul:menu"
123 extends="chrome://global/content/bindings/general.xml#statusbarpanel">
124 <content>
125 <xul:image class="statusbarpanel-icon" xbl:inherits="src,src=image"/>
126 <children/>
127 </content>
128 </binding>
129
130 <binding id="statusbar" role="xul:statusbar">
131 <content>
132 <children/>
133 <xul:statusbarpanel class="statusbar-resizerpanel">
134 <xul:resizer dir="bottomend"/>
135 </xul:statusbarpanel>
136 </content>
137 </binding>
138
139 <binding id="statusbar-drag"
140 extends="chrome://global/content/bindings/general.xml#statusbar">
141 <implementation>
142 <field name="_dragBindingAlive">true</field>
143 <constructor>
144 if (!this._draggableStarted) {
145 this._draggableStarted = true;
146 try {
147 let tmp = {};
148 Components.utils.import("resource://gre/modules/WindowDraggingUtils.jsm", tmp);
149 let draghandle = new tmp.WindowDraggingElement(this);
150 draghandle.mouseDownCheck = function () this._dragBindingAlive;
151 } catch (e) {}
152 }
153 </constructor>
154 </implementation>
155 </binding>
156
157 <binding id="statusbarpanel-iconic" display="xul:button" role="xul:button"
158 extends="chrome://global/content/bindings/general.xml#statusbarpanel">
159 <content>
160 <xul:image class="statusbarpanel-icon" xbl:inherits="src,src=image"/>
161 </content>
162 </binding>
163
164 <binding id="statusbarpanel-iconic-text" display="xul:button" role="xul:button"
165 extends="chrome://global/content/bindings/general.xml#statusbarpanel">
166 <content>
167 <xul:image class="statusbarpanel-icon" xbl:inherits="src,src=image"/>
168 <xul:label class="statusbarpanel-text" xbl:inherits="value=label,crop"/>
169 </content>
170 </binding>
171
172 <binding id="image" role="xul:image">
173 <implementation implements="nsIDOMXULImageElement">
174 <property name="src"
175 onget="return this.getAttribute('src');"
176 onset="this.setAttribute('src',val); return val;"/>
177 </implementation>
178 </binding>
179
180 <binding id="deck">
181 <implementation>
182 <property name="selectedIndex"
183 onget="return this.getAttribute('selectedIndex') || '0'">
184 <setter>
185 <![CDATA[
186 if (this.selectedIndex == val)
187 return val;
188 this.setAttribute("selectedIndex", val);
189 var event = document.createEvent('Events');
190 event.initEvent('select', true, true);
191 this.dispatchEvent(event);
192 return val;
193 ]]>
194 </setter>
195 </property>
196
197 <property name="selectedPanel">
198 <getter>
199 <![CDATA[
200 return this.childNodes[this.selectedIndex];
201 ]]>
202 </getter>
203
204 <setter>
205 <![CDATA[
206 var selectedIndex = -1;
207 for (var panel = val; panel != null; panel = panel.previousSibling)
208 ++selectedIndex;
209 this.selectedIndex = selectedIndex;
210 return val;
211 ]]>
212 </setter>
213 </property>
214 </implementation>
215 </binding>
216
217 <binding id="dropmarker" extends="xul:button" role="xul:dropmarker">
218 <resources>
219 <stylesheet src="chrome://global/skin/dropmarker.css"/>
220 </resources>
221
222 <content>
223 <xul:image class="dropmarker-icon"/>
224 </content>
225 </binding>
226
227 <binding id="windowdragbox">
228 <implementation>
229 <field name="_dragBindingAlive">true</field>
230 <constructor>
231 if (!this._draggableStarted) {
232 this._draggableStarted = true;
233 try {
234 let tmp = {};
235 Components.utils.import("resource://gre/modules/WindowDraggingUtils.jsm", tmp);
236 let draghandle = new tmp.WindowDraggingElement(this);
237 draghandle.mouseDownCheck = function () this._dragBindingAlive;
238 } catch (e) {}
239 }
240 </constructor>
241 </implementation>
242 </binding>
243
244 </bindings>

mercurial