Mercurial > projects > dwt2
comparison org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet15.d @ 28:69b1fa94a4a8
Added SWT snippets
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 22 Mar 2009 15:17:04 +0100 |
parents | |
children | 9f4c18c268b2 |
comparison
equal
deleted
inserted
replaced
27:1bf55a6eb092 | 28:69b1fa94a4a8 |
---|---|
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 * D Port: | |
11 * Jesse Phillips <Jesse.K.Phillips+D> gmail.com | |
12 *******************************************************************************/ | |
13 module org.eclipse.swt.snippets.Snippet15; | |
14 | |
15 /* | |
16 * Tree example snippet: create a tree | |
17 * | |
18 * For a list of all SWT example snippets see | |
19 * http://www.eclipse.org/swt/snippets/ | |
20 */ | |
21 import org.eclipse.swt.SWT; | |
22 import org.eclipse.swt.layout.FillLayout; | |
23 import org.eclipse.swt.widgets.Display; | |
24 import org.eclipse.swt.widgets.Shell; | |
25 import org.eclipse.swt.widgets.Tree; | |
26 import org.eclipse.swt.widgets.TreeItem; | |
27 | |
28 import tango.util.Convert; | |
29 | |
30 void main () { | |
31 auto display = new Display (); | |
32 auto shell = new Shell (display); | |
33 shell.setLayout(new FillLayout()); | |
34 auto tree = new Tree (shell, SWT.BORDER); | |
35 for (int i=0; i<4; i++) { | |
36 auto iItem = new TreeItem (tree, 0); | |
37 iItem.setText ("TreeItem (0) -" ~ to!(char[])(i)); | |
38 for (int j=0; j<4; j++) { | |
39 TreeItem jItem = new TreeItem (iItem, 0); | |
40 jItem.setText ("TreeItem (1) -" ~ to!(char[])(j)); | |
41 for (int k=0; k<4; k++) { | |
42 TreeItem kItem = new TreeItem (jItem, 0); | |
43 kItem.setText ("TreeItem (2) -" ~ to!(char[])(k)); | |
44 for (int l=0; l<4; l++) { | |
45 TreeItem lItem = new TreeItem (kItem, 0); | |
46 lItem.setText ("TreeItem (3) -" ~ to!(char[])(l)); | |
47 } | |
48 } | |
49 } | |
50 } | |
51 shell.setSize (200, 200); | |
52 shell.open (); | |
53 while (!shell.isDisposed()) { | |
54 if (!display.readAndDispatch ()) display.sleep (); | |
55 } | |
56 display.dispose (); | |
57 } |