-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbroadcast.xul
175 lines (147 loc) · 5.54 KB
/
broadcast.xul
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<window title="XUL Broadcasters and Observers"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script>
<![CDATA[
function disable(checked,obid)
{
document.getElementById(obid).setAttribute("disabled", checked);
}
function relabel(checked)
{
if (checked)
document.getElementById("relabeler").setAttribute("label","Other Label");
else
document.getElementById("relabeler").setAttribute("label","Some Label");
}
function relabel2(checked)
{
var cmd = document.getElementById("relabeler-cmd");
if (checked)
cmd.setAttribute("label","Next Label");
else
cmd.setAttribute("label","One Label");
}
function check(bcid,checked)
{
document.getElementById(bcid).setAttribute("checked", checked);
}
function select(bcid,button)
{
var parent = button.parentNode;
alert(parent.getElementsByAttribute("checked","true"));
}
]]>
</script>
<description><html:h1>
XUL Broadcasters and Observers (and Commands)
</html:h1></description>
<broadcasterset>
<broadcaster id="disabler" disabled="false"/>
<broadcaster id="relabeler" label="Some Label"/>
</broadcasterset>
<commandset>
<command id="disabler-cmd" disabled="false" />
<command id="relabeler-cmd" label="One Label" />
<command id="check1-cmd" checked="false"
oncommand="check('check1-cmd',this.checked);" />
<command id="check2-cmd" checked="false"
oncommand="check('check2-cmd',this.checked);" />
<command id="check3-cmd" checked="false"
oncommand="check('check3-cmd',this.checked);" />
<command id="radio1-cmd" checked="false" selected="false"
oncommand="select('radio1-cmd',this);"/>
<command id="radio2-cmd" checked="false" selected="false"
oncommand="select('radio2-cmd',this);"/>
<command id="radio3-cmd" checked="false" selected="false"
oncommand="select('radio3-cmd',this);"/>
</commandset>
<vbox flex="1" style="overflow: auto">
<groupbox >
<toolbox id="my-toolbox">
<toolbar id="a-toolbar" >
<toolbarbutton label="Disablable" observes="disabler" />
<toolbarbutton label="Relabelable" observes="relabeler" />
<toolbarseparator />
<toolbarbutton label="Disablable" observes="disabler-cmd" />
<toolbarbutton label="Relabelable" observes="relabeler-cmd" />
</toolbar>
<toolbar id="another-toolbar" >
<toolbarbutton label="Check1" type="checkbox" observes="check1-cmd" />
<toolbarbutton label="Check2" type="checkbox" observes="check2-cmd" />
<toolbarbutton label="Check3" type="checkbox" observes="check3-cmd" />
<toolbarseparator />
<toolbarbutton label="Radio1" type="radio" group="radio"
observes="radio1-cmd" />
<toolbarbutton label="Radio2" type="radio" group="radio"
observes="radio2-cmd" />
<toolbarbutton label="Radio3" type="radio" group="radio"
observes="radio3-cmd" />
</toolbar>
<menubar id="my-menubar">
<menu label="Menu" >
<menupopup>
<menuitem label="Disablable" observes="disabler" />
<menuitem label="Relabelable" observes="relabeler" />
</menupopup>
</menu>
<menu label="Next Menu" >
<menupopup>
<menuitem label="Disablable" observes="disabler-cmd" />
<menuitem label="Relabelable" observes="relabeler-cmd" />
</menupopup>
</menu>
<menu label="Checkbox">
<menupopup>
<menuitem type="checkbox" label="Check1" observes="check1-cmd" />
<menuitem type="checkbox" label="Check2" observes="check2-cmd" />
<menuitem type="checkbox" label="Check3" observes="check3-cmd" />
</menupopup>
</menu>
<menu label="Radio" >
<menupopup>
<menuitem type="radio" name="radio" label="Radio1"
observes="radio1-cmd" />
<menuitem type="radio" name="radio" label="Radio2"
observes="radio2-cmd" />
<menuitem type="radio" name="radio" label="Radio3"
observes="radio3-cmd" />
</menupopup>
</menu>
</menubar>
</toolbox>
<hbox>
<vbox flex="1" >
<button label="Disablable" observes="disabler" />
<button label="Relabelable" observes="relabeler" />
</vbox>
<vbox flex="1" >
<button label="Disablable" observes="disabler-cmd" />
<button label="Relabelable" observes="relabeler-cmd" />
</vbox>
<vbox flex="1">
<checkbox label="Check1" observes="check1-cmd" />
<checkbox label="Check2" observes="check2-cmd" />
<checkbox label="Check3" observes="check3-cmd" />
</vbox>>
<radiogroup flex="1" >
<radio label="Radio1" observes="radio1-cmd" />
<radio label="Radio2" observes="radio2-cmd" />
<radio label="Radio3" observes="radio3-cmd" />
</radiogroup>>
</hbox>
</groupbox>
<hbox>
<checkbox id="disable-check" label="Disable First"
oncommand="disable(this.checked, 'disabler');"/>
<checkbox id="relabel-check" label="Relabel First"
oncommand="relabel(this.checked);"/>
<checkbox id="disable-check2" label="Disable Next"
oncommand="disable(this.checked, 'disabler-cmd');"/>
<checkbox id="relabel-check2" label="Relabel Next"
oncommand="relabel2(this.checked);"/>
</hbox>
</vbox>
</window>