3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4 <title>qooxdoo » Demo</title>
5 <link type="text/css" rel="stylesheet" href="../../resource/css/layout.css"/>
7 <link type="text/css" rel="stylesheet" href="../../resource/css/layout_ie.css"/>
9 <script type="text/javascript" src="../../script/qx.js"></script>
12 <script type="text/javascript" src="../../script/layout.js"></script>
14 <div id="demoDescription">
15 <p>Introduce all classes needed for creating real qx.ui.toolbar.ToolBars. This includes qx.ui.toolbar.ToolBars,
16 qx.ui.toolbar.ToolBarParts, qx.ui.toolbar.ToolBarSeparator and qx.ui.toolbar.ToolBarButtons.</p>
18 <p>The qx.ui.toolbar.ToolBarButtons and QxRadioButtons in this example are beautifully
19 decoupled by "global" qx.event.type.DataEvent.</p>
22 <script type="text/javascript">
23 qx.core.Init.getInstance().defineMain(function()
25 var d = qx.ui.core.ClientDocument.getInstance();
27 var tb = new qx.ui.toolbar.ToolBar;
38 { type : "button", icon : "file-new", text : "New" },
39 { type : "separator" },
40 { type : "button", icon : "edit-copy", text : "Copy" },
41 { type : "button", icon : "edit-cut", text : "Cut" },
42 { type : "button", icon : "edit-paste", text : "Paste" }
46 { type : "button", icon : "up", text : "Upload" },
47 { type : "button", icon : "down", text : "Download" }
51 { type : "button", icon : "help", text : "Help" }
54 var bars = [ btns1, btns2, btns3 ];
56 function changeLayout(e) {
57 this.setShow(e.getData());
60 function changeSize(e) {
62 var o = v == 22 ? 32 : 22;
64 this.setIcon(this.getIcon().replace(o, v));
67 function buttonExecute() { this.debug("Executed: " + this.getLabel()); };
72 for (var j=0; j<bars.length; j++)
77 var tbp = new qx.ui.toolbar.ToolBarPart;
80 for (var i=0; i<btns.length; i++)
87 var o = new qx.ui.toolbar.ToolBarSeparator;
91 var o = new qx.ui.toolbar.ToolBarButton(btn.text, "icon/22/" + btn.icon + ".png");
93 // beautiful decoupling: toolbar buttons don't know about radio boxes
95 d.addEventListener("changeLayout", changeLayout, o);
96 d.addEventListener("changeSize", changeSize, o);
98 o.addEventListener("execute", buttonExecute);
124 var rd1 = new qx.ui.form.RadioButton("Show Icons and Label", "both");
125 var rd2 = new qx.ui.form.RadioButton("Show Icons", "icon");
126 var rd3 = new qx.ui.form.RadioButton("Show Label", "label");
148 var rbm = new qx.manager.selection.RadioManager();
155 // beautiful decoupling: radio boxes don't know about toolbar buttons
156 rbm.addEventListener("changeSelected", function(e) {
157 d.dispatchEvent( new qx.event.type.DataEvent("changeLayout", e.getData().getValue() ) );
160 d.add(rd1, rd2, rd3);
165 var ra1 = new qx.ui.form.RadioButton("Left Aligned", "left");
166 var ra2 = new qx.ui.form.RadioButton("Centered", "center");
167 var ra3 = new qx.ui.form.RadioButton("Right Aligned", "right");
189 var ram = new qx.manager.selection.RadioManager();
195 d.add(ra1, ra2, ra3);
197 ram.addEventListener("changeSelected", function(e) {
198 tb.setHorizontalChildrenAlign(e.getData().getValue());
205 var b3 = new qx.ui.form.Button("Icons: 22 Pixel", "icon/16/colors.png");
211 setHorizontalAlign("center");
214 b3.addEventListener("execute", function(e) {
215 d.dispatchEvent(new qx.event.type.DataEvent("changeSize", 22));
218 var b4 = new qx.ui.form.Button("Icons: 32 Pixel", "icon/16/colors.png");
224 setHorizontalAlign("center");
227 b4.addEventListener("execute", function(e) {
228 d.dispatchEvent(new qx.event.type.DataEvent("changeSize", 32));
237 // Icon & Color Themes
238 qx.manager.object.ImageManager.getInstance().createThemeList(d, 20, 248);
239 qx.manager.object.ColorManager.getInstance().createThemeList(d, 220, 248);
244 Test for cloning support
246 tb2 = tb.clone(true);