summaryrefslogtreecommitdiff
path: root/includes/js/dijit/tests/test_Toolbar.html
blob: 6634e2d3581e95a3e9414be79718025ab5b58720 (plain)
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
176
177
178
179
180
181
182
183
184
185
186
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
		"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
	<title>Dojo Toolbar Widget Test</title>

	<style type="text/css">
		@import "../../dojo/resources/dojo.css";
		@import "css/dijitTests.css";

		.dijitToolbar .dijitButton, .dijitToolbar .dijitDropDownButton { margin: 0px; }
		.dijitToolbar .dijitToggleButtonSelected BUTTON, .dijitToolbar .dijitToggleButtonSelectedHover BUTTON { border-width: 3px; }
	</style>
	
	<script type="text/javascript" src="../../dojo/dojo.js"
		djConfig="parseOnLoad: true, isDebug: true"></script>
	<script type="text/javascript" src="_testCommon.js"></script>

	<script type="text/javascript">
		dojo.require("dijit.form.Button");
		dojo.require("dijit.ColorPalette");
		dojo.require("dijit.Dialog");
		dojo.require("dijit.Toolbar");
		dojo.require("dijit.form.Button");
		dojo.require("dijit.form.TextBox");
		dojo.require("dijit.Menu");
		dojo.require("dojo.parser");

		<!-- programatic creation -->
		function init(){
			dojo.forEach(["toolbar2", "toolbar3", "toolbar4"], function(toolbarId){
				var toolbar = new dijit.Toolbar({}, dojo.byId(toolbarId));
				dojo.forEach(["Cut", "Copy", "Paste"], function(label){
					var button = new dijit.form.Button({
                        id: toolbarId+"."+label,
                        // note: should always specify a label, for accessibility reasons.
                        // Just set showLabel=false if you don't want it to be displayed normally
                        label: label,
                        showLabel: (toolbarId == "toolbar2" ? false : true),
                        iconClass: toolbarId == "toolbar4" ? "" : "dijitEditorIcon dijitEditorIcon"+label
                    });
                    toolbar.addChild(button);
				});
			});
		}

		dojo.addOnLoad(init);
	</script>
</head>
<body>
	<h1 class="testTitle">Toolbar test</h1>

	<h2>Toolbar from markup</h2>

	<div id="toolbar1" dojoType="dijit.Toolbar"
			><div dojoType="dijit.form.Button" id="toolbar1.cut" iconClass="dijitEditorIcon dijitEditorIconCut" showLabel="false">Cut</div
			><div dojoType="dijit.form.Button" id="toolbar1.copy" iconClass="dijitEditorIcon dijitEditorIconCopy" showLabel="false">Copy</div
			><div dojoType="dijit.form.Button" id="toolbar1.paste" iconClass="dijitEditorIcon dijitEditorIconPaste" showLabel="false">Paste</div

			><span dojoType="dijit.ToolbarSeparator"></span

			><div dojoType="dijit.form.ToggleButton" id="toolbar1.bold" iconClass="dijitEditorIcon dijitEditorIconBold" showLabel="false">Bold</div
			><div dojoType="dijit.form.ToggleButton" id="toolbar1.italic" iconClass="dijitEditorIcon dijitEditorIconItalic" showLabel="false">Italic</div
			><div dojoType="dijit.form.ToggleButton" id="toolbar1.underline" iconClass="dijitEditorIcon dijitEditorIconUnderline" showLabel="false">Underline</div
			><div dojoType="dijit.form.ToggleButton" id="toolbar1.strikethrough" iconClass="dijitEditorIcon dijitEditorIconStrikethrough" showLabel="false">Strikethrough</div

><!--
			<span dojoType="dijit.ToolbarSeparator">&nbsp;</span>

			<span dojo:type="ToolbarButtonGroup" name="justify" defaultButton="justifyleft" preventDeselect="true" showLabel="false">
				<div dojoType="dijit.form.ToggleButton" iconClass="dijitEditorIcon dijitEditorIconJustifyLeft" name="justify" showLabel="false">Left</div>
				<div dojoType="dijit.form.ToggleButton" iconClass="dijitEditorIcon dijitEditorIconJustifyRight" name="justify" showLabel="false">Right</div>
				<div dojoType="dijit.form.ToggleButton" iconClass="dijitEditorIcon dijitEditorIconJustifyCenter" name="justify" showLabel="false">Center</div>
			 </span>

			--><span dojoType="dijit.ToolbarSeparator">&nbsp;</span

			><div dojoType="dijit.form.Button" id="toolbar1.insertorderedlist" iconClass="dijitEditorIcon dijitEditorIconInsertOrderedList" showLabel="false">Ordered list</div
			><div dojoType="dijit.form.Button" id="toolbar1.insertunorderedlist" iconClass="dijitEditorIcon dijitEditorIconInsertUnorderedList" showLabel="false">Unordered list</div
			><div dojoType="dijit.form.Button" id="toolbar1.indent" iconClass="dijitEditorIcon dijitEditorIconIndent" showLabel="false">Indent</div
			><div dojoType="dijit.form.Button" id="toolbar1.outdent" iconClass="dijitEditorIcon dijitEditorIconOutdent" showLabel="false">Outdent</div

			><span dojoType="dijit.ToolbarSeparator"></span
			><div dojoType="dijit.form.DropDownButton" id="toolbar1.dialog">
				<span>Login</span>
				<div dojoType="dijit.TooltipDialog" id="tooltipDlg" title="Enter Login information"
					execute="alert('submitted w/args:\n' + dojo.toJson(arguments[0], true));">
					<table>
						<tr>
							<td><label for="user">User:</label></td>
							<td><input dojoType=dijit.form.TextBox type="text" name="user" ></td>
						</tr>
						<tr>
							<td><label for="pwd">Password:</label></td>
							<td><input dojoType=dijit.form.TextBox type="password" name="pwd"></td>
						</tr>
						<tr>
							<td colspan="2" align="center">
								<button dojoType=dijit.form.Button type="submit" name="submit">Login</button></td>
						</tr>
					</table>
				</div
			></div
			><div dojoType="dijit.form.DropDownButton" id="toolbar1.backcolor" iconClass="dijitEditorIcon dijitEditorIconBackColor" showLabel="false">
				<span>Background</span>
				<div dojoType="dijit.ColorPalette" id="toolbar1.colorPalette" style="display: none" palette="3x4" onChange="console.log(this.value);"></div>
			</div
			><div dojoType="dijit.form.DropDownButton" id="toolbar1.forecolor" iconClass="dijitEditorIcon dijitEditorIconForeColor" showLabel="false">
				<span>Foreground</span>
				<div dojoType="dijit.ColorPalette" id="toolbar1.colorPalette2" style="display: none" palette="3x4" onChange="console.log(this.value);"></div>
			</div

			><span dojoType="dijit.ToolbarSeparator"></span
			><div dojoType="dijit.form.ComboButton" optionsTitle='save options' onClick='console.log("clicked combo save")'>
				<span>Save</span>
				<div dojoType="dijit.Menu" id="saveMenu" style="display: none;">
					<div dojoType="dijit.MenuItem"  iconClass="dijitEditorIcon dijitEditorIconSave"
						onClick="console.log('not actually saving anything, just a test!')">Save</div>
					<div dojoType="dijit.MenuItem"
						onClick="console.log('not actually saving anything, just a test!')">Save As</div>
				</div>
			</div
	></div>

	<h2>Toolbar that looks like MenuBar</h2>
	<div id="menubar" dojoType="dijit.Toolbar" class="menuBar">
		<div dojoType="dijit.form.DropDownButton">
			<span>File</span>
			<div dojoType="dijit.Menu">
				<div dojoType="dijit.MenuItem">New</div>
				<div dojoType="dijit.MenuItem">Open</div>
				<div dojoType="dijit.MenuSeparator"></div>
				<div dojoType="dijit.MenuItem" iconClass="dijitEditorIconSave">Save</div>
				<div dojoType="dijit.MenuItem">Save As...</div>
			</div>
		</div>
		<div dojoType="dijit.form.DropDownButton">
			<span>Edit</span>
			<div dojoType="dijit.Menu">
				<div dojoType="dijit.MenuItem"  iconClass="dijitEditorIcon dijitEditorIconCut"
					onClick="console.log('not actually cutting anything, just a test!')">Cut</div>
				<div dojoType="dijit.MenuItem"  iconClass="dijitEditorIcon dijitEditorIconCopy"
					onClick="console.log('not actually copying anything, just a test!')">Copy</div>
				<div dojoType="dijit.MenuItem"  iconClass="dijitEditorIcon dijitEditorIconPaste"
					onClick="console.log('not actually pasting anything, just a test!')">Paste</div>
			</div>
		</div>
		<div dojoType="dijit.form.DropDownButton">
			<span>View</span>
			<div dojoType="dijit.Menu">
				<div dojoType="dijit.MenuItem">Normal</div>
				<div dojoType="dijit.MenuItem">Outline</div>
				<div dojoType="dijit.PopupMenuItem">
					<span>Zoom</span>
					<div dojoType="dijit.Menu" id="submenu2">
						<div dojoType="dijit.MenuItem">50%</div>
						<div dojoType="dijit.MenuItem">75%</div>
						<div dojoType="dijit.MenuItem">100%</div>
						<div dojoType="dijit.MenuItem">150%</div>
						<div dojoType="dijit.MenuItem">200%</div>
					</div>
				</div>
			</div>
		</div>
		<div dojoType="dijit.form.DropDownButton">
			<span>Help</span>
			<div dojoType="dijit.Menu">
				<div dojoType="dijit.MenuItem">Help Topics</div>
				<div dojoType="dijit.MenuItem">About Dijit</div>
			</div>
		</div>
	</div>	

	<h2>Toolbar from script with icons only</h2>
	<div id="toolbar2"></div>

	<h2>Toolbar from script with text and icons</h2>
	<div id="toolbar3"></div>

	<h2>Toolbar from script with text only</h2>
	<div id="toolbar4"></div>

    <!-- leave some space before the console window -->
    <br><br>
  </body>
</html>