2150 |
mathias |
1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
|
|
2 |
"http://www.w3.org/TR/html4/strict.dtd">
|
|
|
3 |
<html>
|
|
|
4 |
<head>
|
|
|
5 |
|
|
|
6 |
<title>Dojo Toolbar Widget Test</title>
|
|
|
7 |
|
|
|
8 |
|
|
|
9 |
<script type="text/javascript" src="../../dojo/dojo.js"
|
|
|
10 |
djConfig="parseOnLoad: true, isDebug: true"></script>
|
|
|
11 |
<script type="text/javascript" src="_testCommon.js"></script>
|
|
|
12 |
|
|
|
13 |
<script type="text/javascript">
|
|
|
14 |
dojo.require("dijit.form.Button");
|
|
|
15 |
dojo.require("dijit.ColorPalette");
|
|
|
16 |
dojo.require("dijit.Dialog");
|
|
|
17 |
dojo.require("dijit.Toolbar");
|
|
|
18 |
dojo.require("dijit.form.Button");
|
|
|
19 |
dojo.require("dijit.form.TextBox");
|
|
|
20 |
dojo.require("dijit.Menu");
|
|
|
21 |
dojo.require("dojo.parser");
|
|
|
22 |
</script>
|
|
|
23 |
|
|
|
24 |
<!-- programatic creation -->
|
|
|
25 |
<script>
|
|
|
26 |
function init(){
|
|
|
27 |
dojo.forEach(["toolbar2", "toolbar3", "toolbar4"], function(toolbarId){
|
|
|
28 |
var toolbar = new dijit.Toolbar({}, dojo.byId(toolbarId));
|
|
|
29 |
dojo.forEach(["Cut", "Copy", "Paste"], function(label){
|
|
|
30 |
var button = new dijit.form.Button({id: toolbarId+"."+label, label: label, iconClass: "dijitEditorIcon dijitEditorIcon"+label, showLabel: (toolbarId == "toolbar2" ? false : true)});
|
|
|
31 |
toolbar.addChild(button);
|
|
|
32 |
});
|
|
|
33 |
});
|
|
|
34 |
}
|
|
|
35 |
|
|
|
36 |
dojo.addOnLoad(init);
|
|
|
37 |
</script>
|
|
|
38 |
|
|
|
39 |
<style type="text/css">
|
|
|
40 |
@import "../../dojo/resources/dojo.css";
|
|
|
41 |
@import "css/dijitTests.css";
|
|
|
42 |
|
|
|
43 |
.dijitToolbar .dijitButton, .dijitToolbar .dijitDropDownButton { margin: 0px; }
|
|
|
44 |
.dijitToolbar .dijitToggleButtonSelected BUTTON, .dijitToolbar .dijitToggleButtonSelectedHover BUTTON { border-width: 3px; }
|
|
|
45 |
</style>
|
|
|
46 |
|
|
|
47 |
<!-- To turn off display of text use showLabel=false attribute on button
|
|
|
48 |
to turn off display or icon, add your own classes and/or CSS rules -->
|
|
|
49 |
<style>
|
|
|
50 |
|
|
|
51 |
.toolbarWithNoImages .dijitButtonContents .dijitInline,
|
|
|
52 |
.toolbarWithNoImages .dijitButtonContents .dijitInline {
|
|
|
53 |
display: none;
|
|
|
54 |
}
|
|
|
55 |
|
|
|
56 |
.menuBar .dijitA11yDownArrow { display: none; }
|
|
|
57 |
</style>
|
|
|
58 |
|
|
|
59 |
</head>
|
|
|
60 |
<body>
|
|
|
61 |
<h1 class="testTitle">Toolbar test</h1>
|
|
|
62 |
|
|
|
63 |
<h2>Toolbar from markup</h2>
|
|
|
64 |
|
|
|
65 |
<div id="toolbar1" dojoType="dijit.Toolbar"
|
|
|
66 |
><div dojoType="dijit.form.Button" id="toolbar1.cut" iconClass="dijitEditorIcon dijitEditorIconCut" showLabel="false">Cut</div
|
|
|
67 |
><div dojoType="dijit.form.Button" id="toolbar1.copy" iconClass="dijitEditorIcon dijitEditorIconCopy" showLabel="false">Copy</div
|
|
|
68 |
><div dojoType="dijit.form.Button" id="toolbar1.paste" iconClass="dijitEditorIcon dijitEditorIconPaste" showLabel="false">Paste</div
|
|
|
69 |
|
|
|
70 |
><span dojoType="dijit.ToolbarSeparator"></span
|
|
|
71 |
|
|
|
72 |
><div dojoType="dijit.form.ToggleButton" id="toolbar1.bold" iconClass="dijitEditorIcon dijitEditorIconBold" showLabel="false">Bold</div
|
|
|
73 |
><div dojoType="dijit.form.ToggleButton" id="toolbar1.italic" iconClass="dijitEditorIcon dijitEditorIconItalic" showLabel="false">Italic</div
|
|
|
74 |
><div dojoType="dijit.form.ToggleButton" id="toolbar1.underline" iconClass="dijitEditorIcon dijitEditorIconUnderline" showLabel="false">Underline</div
|
|
|
75 |
><div dojoType="dijit.form.ToggleButton" id="toolbar1.strikethrough" iconClass="dijitEditorIcon dijitEditorIconStrikethrough" showLabel="false">Strikethrough</div
|
|
|
76 |
|
|
|
77 |
><!--
|
|
|
78 |
<span dojoType="dijit.ToolbarSeparator"> </span>
|
|
|
79 |
|
|
|
80 |
<span dojo:type="ToolbarButtonGroup" name="justify" defaultButton="justifyleft" preventDeselect="true" showLabel="false">
|
|
|
81 |
<div dojoType="dijit.form.ToggleButton" iconClass="dijitEditorIcon dijitEditorIconJustifyLeft" name="justify" showLabel="false">Left</div>
|
|
|
82 |
<div dojoType="dijit.form.ToggleButton" iconClass="dijitEditorIcon dijitEditorIconJustifyRight" name="justify" showLabel="false">Right</div>
|
|
|
83 |
<div dojoType="dijit.form.ToggleButton" iconClass="dijitEditorIcon dijitEditorIconJustifyCenter" name="justify" showLabel="false">Center</div>
|
|
|
84 |
</span>
|
|
|
85 |
|
|
|
86 |
--><span dojoType="dijit.ToolbarSeparator"> </span
|
|
|
87 |
|
|
|
88 |
><div dojoType="dijit.form.Button" id="toolbar1.insertorderedlist" iconClass="dijitEditorIcon dijitEditorIconInsertOrderedList" showLabel="false">Ordered list</div
|
|
|
89 |
><div dojoType="dijit.form.Button" id="toolbar1.insertunorderedlist" iconClass="dijitEditorIcon dijitEditorIconInsertUnorderedList" showLabel="false">Unordered list</div
|
|
|
90 |
><div dojoType="dijit.form.Button" id="toolbar1.indent" iconClass="dijitEditorIcon dijitEditorIconIndent" showLabel="false">Indent</div
|
|
|
91 |
><div dojoType="dijit.form.Button" id="toolbar1.outdent" iconClass="dijitEditorIcon dijitEditorIconOutdent" showLabel="false">Outdent</div
|
|
|
92 |
|
|
|
93 |
><span dojoType="dijit.ToolbarSeparator"></span
|
|
|
94 |
><div dojoType="dijit.form.DropDownButton" id="toolbar1.dialog">
|
|
|
95 |
<span>Login</span>
|
|
|
96 |
<div dojoType="dijit.TooltipDialog" id="tooltipDlg" title="Enter Login information"
|
|
|
97 |
execute="alert('submitted w/args:\n' + dojo.toJson(arguments[0], true));">
|
|
|
98 |
<table>
|
|
|
99 |
<tr>
|
|
|
100 |
<td><label for="user">User:</label></td>
|
|
|
101 |
<td><input dojoType=dijit.form.TextBox type="text" name="user" ></td>
|
|
|
102 |
</tr>
|
|
|
103 |
<tr>
|
|
|
104 |
<td><label for="pwd">Password:</label></td>
|
|
|
105 |
<td><input dojoType=dijit.form.TextBox type="password" name="pwd"></td>
|
|
|
106 |
</tr>
|
|
|
107 |
<tr>
|
|
|
108 |
<td colspan="2" align="center">
|
|
|
109 |
<button dojoType=dijit.form.Button type="submit" name="submit">Login</button></td>
|
|
|
110 |
</tr>
|
|
|
111 |
</table>
|
|
|
112 |
</div
|
|
|
113 |
></div
|
|
|
114 |
><div dojoType="dijit.form.DropDownButton" id="toolbar1.backcolor" iconClass="dijitEditorIcon dijitEditorIconBackColor" showLabel="false">
|
|
|
115 |
<span>Background</span>
|
|
|
116 |
<div dojoType="dijit.ColorPalette" id="toolbar1.colorPalette" style="display: none" palette="3x4" onChange="console.log(this.value);"></div>
|
|
|
117 |
</div
|
|
|
118 |
><div dojoType="dijit.form.DropDownButton" id="toolbar1.forecolor" iconClass="dijitEditorIcon dijitEditorIconForeColor" showLabel="false">
|
|
|
119 |
<span>Foreground</span>
|
|
|
120 |
<div dojoType="dijit.ColorPalette" id="toolbar1.colorPalette2" style="display: none" palette="3x4" onChange="console.log(this.value);"></div>
|
|
|
121 |
</div
|
|
|
122 |
|
|
|
123 |
><span dojoType="dijit.ToolbarSeparator"></span
|
|
|
124 |
><div dojoType="dijit.form.ComboButton" optionsTitle='save options' onClick='console.log("clicked combo save")'>
|
|
|
125 |
<span>Save</span>
|
|
|
126 |
<div dojoType="dijit.Menu" id="saveMenu" style="display: none;">
|
|
|
127 |
<div dojoType="dijit.MenuItem" iconClass="dijitEditorIcon dijitEditorIconSave"
|
|
|
128 |
onClick="console.log('not actually saving anything, just a test!')">Save</div>
|
|
|
129 |
<div dojoType="dijit.MenuItem"
|
|
|
130 |
onClick="console.log('not actually saving anything, just a test!')">Save As</div>
|
|
|
131 |
</div>
|
|
|
132 |
</div
|
|
|
133 |
></div>
|
|
|
134 |
|
|
|
135 |
<h2>Toolbar that looks like MenuBar</h2>
|
|
|
136 |
<div id="menubar" dojoType="dijit.Toolbar" class="menuBar">
|
|
|
137 |
<div dojoType="dijit.form.DropDownButton">
|
|
|
138 |
<span>File</span>
|
|
|
139 |
<div dojoType="dijit.Menu">
|
|
|
140 |
<div dojoType="dijit.MenuItem">New</div>
|
|
|
141 |
<div dojoType="dijit.MenuItem">Open</div>
|
|
|
142 |
<div dojoType="dijit.MenuSeparator"></div>
|
|
|
143 |
<div dojoType="dijit.MenuItem" iconClass="dijitEditorIconSave">Save</div>
|
|
|
144 |
<div dojoType="dijit.MenuItem">Save As...</div>
|
|
|
145 |
</div>
|
|
|
146 |
</div>
|
|
|
147 |
<div dojoType="dijit.form.DropDownButton">
|
|
|
148 |
<span>Edit</span>
|
|
|
149 |
<div dojoType="dijit.Menu">
|
|
|
150 |
<div dojoType="dijit.MenuItem" iconClass="dijitEditorIcon dijitEditorIconCut"
|
|
|
151 |
onClick="console.log('not actually cutting anything, just a test!')">Cut</div>
|
|
|
152 |
<div dojoType="dijit.MenuItem" iconClass="dijitEditorIcon dijitEditorIconCopy"
|
|
|
153 |
onClick="console.log('not actually copying anything, just a test!')">Copy</div>
|
|
|
154 |
<div dojoType="dijit.MenuItem" iconClass="dijitEditorIcon dijitEditorIconPaste"
|
|
|
155 |
onClick="console.log('not actually pasting anything, just a test!')">Paste</div>
|
|
|
156 |
</div>
|
|
|
157 |
</div>
|
|
|
158 |
<div dojoType="dijit.form.DropDownButton">
|
|
|
159 |
<span>View</span>
|
|
|
160 |
<div dojoType="dijit.Menu">
|
|
|
161 |
<div dojoType="dijit.MenuItem">Normal</div>
|
|
|
162 |
<div dojoType="dijit.MenuItem">Outline</div>
|
|
|
163 |
<div dojoType="dijit.PopupMenuItem">
|
|
|
164 |
<span>Zoom</span>
|
|
|
165 |
<div dojoType="dijit.Menu" id="submenu2">
|
|
|
166 |
<div dojoType="dijit.MenuItem">50%</div>
|
|
|
167 |
<div dojoType="dijit.MenuItem">75%</div>
|
|
|
168 |
<div dojoType="dijit.MenuItem">100%</div>
|
|
|
169 |
<div dojoType="dijit.MenuItem">150%</div>
|
|
|
170 |
<div dojoType="dijit.MenuItem">200%</div>
|
|
|
171 |
</div>
|
|
|
172 |
</div>
|
|
|
173 |
</div>
|
|
|
174 |
</div>
|
|
|
175 |
<div dojoType="dijit.form.DropDownButton">
|
|
|
176 |
<span>Help</span>
|
|
|
177 |
<div dojoType="dijit.Menu">
|
|
|
178 |
<div dojoType="dijit.MenuItem">Help Topics</div>
|
|
|
179 |
<div dojoType="dijit.MenuItem">About Dijit</div>
|
|
|
180 |
</div>
|
|
|
181 |
</div>
|
|
|
182 |
</div>
|
|
|
183 |
|
|
|
184 |
<h2>Toolbar from script</h2>
|
|
|
185 |
<div id="toolbar2"></div>
|
|
|
186 |
|
|
|
187 |
<h2>Toolbar with text and icons</h2>
|
|
|
188 |
<div id="toolbar3"></div>
|
|
|
189 |
|
|
|
190 |
<h2>Toolbar with text only</h2>
|
|
|
191 |
<div id="toolbar4" class="toolbarWithNoImages"></div>
|
|
|
192 |
</body>
|
|
|
193 |
</html>
|