2
|
1 <?xml version="1.0"?>
|
|
2
|
|
3 <bindings id="SubPaneBindings" xmlns="http://www.mozilla.org/xbl" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
|
4
|
|
5 <binding id="subpane" name="subpane">
|
|
6
|
|
7 <content preference-editable="true" orient="vertical">
|
|
8 </content>
|
|
9
|
|
10 <implementation>
|
|
11
|
|
12 <property name="action">
|
|
13 <getter>
|
|
14 return this.getAttribute("action");
|
|
15 </getter>
|
|
16 </property>
|
|
17
|
|
18 <property name="_attribute">
|
|
19 <getter>
|
|
20 if (this.action == "hide")
|
|
21 {
|
|
22 return "hidden";
|
|
23 }
|
|
24 else if (this.action == "disable")
|
|
25 {
|
|
26 return "disabled";
|
|
27 }
|
|
28 return "";
|
|
29 </getter>
|
|
30 </property>
|
|
31
|
|
32 <property name="_invert">
|
|
33 <getter>
|
|
34 <![CDATA[
|
|
35 var invert = false;
|
|
36
|
|
37 if (this.action == "hide")
|
|
38 {
|
|
39 invert=true;
|
|
40 }
|
|
41 else if (this.action == "disable")
|
|
42 {
|
|
43 invert=true;
|
|
44 }
|
|
45
|
|
46 if (this.hasAttribute("invert") && this.getAttribute("invert") == "true")
|
|
47 invert=!invert;
|
|
48
|
|
49 return invert;
|
|
50 ]]>
|
|
51 </getter>
|
|
52 </property>
|
|
53
|
|
54 <field name="_value"/>
|
|
55 <property name="value">
|
|
56 <setter>
|
|
57 if (val == this._value)
|
|
58 return val;
|
|
59
|
|
60 this._value = val;
|
|
61 this._updateElements(val);
|
|
62
|
|
63 return val;
|
|
64 </setter>
|
|
65 <getter>
|
|
66 return this._value;
|
|
67 </getter>
|
|
68 </property>
|
|
69
|
|
70 <method name="_setElementState">
|
|
71 <parameter name="element"/>
|
|
72 <parameter name="state"/>
|
|
73 <body>
|
|
74 var attribute = this._attribute;
|
|
75 state = this._invert ? !state : state;
|
|
76
|
|
77 if (attribute in element)
|
|
78 element[attribute] = state;
|
|
79 else
|
|
80 element.setAttribute(attribute, state);
|
|
81 </body>
|
|
82 </method>
|
|
83
|
|
84 <method name="_updateElements">
|
|
85 <parameter name="state"/>
|
|
86 <body>
|
|
87 if (this.action=="hide")
|
|
88 {
|
|
89 this.hidden = this._invert ? !state : state;
|
|
90 }
|
|
91 else
|
|
92 {
|
|
93 var element = this.firstChild;
|
|
94 while (element)
|
|
95 {
|
|
96 this._setElementState(element,state);
|
|
97 element = element.nextSibling;
|
|
98 }
|
|
99 }
|
|
100 </body>
|
|
101 </method>
|
|
102
|
|
103 </implementation>
|
|
104
|
|
105 </binding>
|
|
106
|
|
107 </bindings> |