comparison snippets/toolbar/Snippet58.d @ 78:4a04b6759f98

Clean up directory names
author John Reimer <terminal.node@gmail.com>
date Sat, 10 May 2008 13:32:45 -0700
parents
children 1f0a7a472680
comparison
equal deleted inserted replaced
76:04f122e90b0a 78:4a04b6759f98
1 /*******************************************************************************
2 * Copyright (c) 2000, 2004 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * IBM Corporation - initial API and implementation
10 * Port to the D programming language:
11 * Bill Baxter <bill@billbaxter.com>
12 *******************************************************************************/
13 module snippets.toolbar.Snippet58;
14
15 /*
16 * ToolBar example snippet: place a combo box in a tool bar
17 *
18 * For a list of all SWT example snippets see
19 * http://www.eclipse.org/swt/snippets/
20 */
21 import dwt.DWT;
22 import dwt.widgets.Display;
23 import dwt.widgets.Shell;
24 import dwt.widgets.ToolBar;
25 import dwt.widgets.ToolItem;
26 import dwt.widgets.Combo;
27
28 import tango.util.Convert;
29
30 void main () {
31 Display display = new Display ();
32 Shell shell = new Shell (display);
33 ToolBar bar = new ToolBar (shell, DWT.BORDER);
34 for (int i=0; i<4; i++) {
35 ToolItem item = new ToolItem (bar, 0);
36 item.setText ("Item " ~ to!(char[])(i));
37 }
38 ToolItem sep = new ToolItem (bar, DWT.SEPARATOR);
39 int start = bar.getItemCount ();
40 for (int i=start; i<start+4; i++) {
41 ToolItem item = new ToolItem (bar, 0);
42 item.setText ("Item " ~ to!(char[])(i));
43 }
44 Combo combo = new Combo (bar, DWT.READ_ONLY);
45 for (int i=0; i<4; i++) {
46 combo.add ("Item " ~ to!(char[])(i));
47 }
48 combo.pack ();
49 sep.setWidth (combo.getSize ().x);
50 sep.setControl (combo);
51 bar.pack ();
52 shell.pack ();
53 shell.open ();
54 while (!shell.isDisposed ()) {
55 if (!display.readAndDispatch ()) display.sleep ();
56 }
57 display.dispose ();
58 }
59