annotate snippets/composite/Snippet75.d @ 120:1f0a7a472680

fix rm snippets from module statements.
author Frank Benoit <benoit@tionex.de>
date Sun, 20 Jul 2008 19:17:23 +0200
parents 9a1be6ff19a2
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
119
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1 /*******************************************************************************
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2 * Copyright (c) 2000, 2004 IBM Corporation and others.
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3 * All rights reserved. This program and the accompanying materials
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4 * are made available under the terms of the Eclipse Public License v1.0
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
5 * which accompanies this distribution, and is available at
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
6 * http://www.eclipse.org/legal/epl-v10.html
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
7 *
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
8 * Contributors:
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
9 * IBM Corporation - initial API and implementation
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
10 * D Port:
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
11 * Thomas Demmer <t_demmer AT web DOT de>
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
12 *******************************************************************************/
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
13 module composite.Snippet75;
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
14
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
15 /*
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
16 * Composite example snippet: set the tab traversal order of children
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
17 * In this example, composite1 (i.e. c1) tab order is set to: B2, B1, B3, and
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
18 * shell tab order is set to: c1, B7, toolBar1, (c4: no focusable children), c2, L2
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
19 *
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
20 * For a list of all SWT example snippets see
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
21 * http://www.eclipse.org/swt/snippets/
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
22 */
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
23 import dwt.DWT;
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
24 import dwt.widgets.Button;
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
25 import dwt.widgets.Combo;
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
26 import dwt.widgets.Composite;
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
27 import dwt.widgets.Control;
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
28 import dwt.widgets.Display;
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
29 import dwt.widgets.Label;
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
30 import dwt.widgets.List;
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
31 import dwt.widgets.Shell;
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
32 import dwt.widgets.ToolBar;
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
33 import dwt.widgets.ToolItem;
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
34 import dwt.layout.FillLayout;
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
35 import dwt.layout.RowLayout;
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
36
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
37 import dwt.dwthelper.utils;
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
38
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
39
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
40 void main (String [] args) {
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
41 Display display = new Display ();
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
42 Shell shell = new Shell (display);
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
43 shell.setLayout (new RowLayout ());
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
44
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
45 Composite c1 = new Composite (shell, DWT.BORDER);
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
46 c1.setLayout (new RowLayout ());
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
47 Button b1 = new Button (c1, DWT.PUSH);
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
48 b1.setText ("B&1");
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
49 Button r1 = new Button (c1, DWT.RADIO);
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
50 r1.setText ("R1");
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
51 Button r2 = new Button (c1, DWT.RADIO);
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
52 r2.setText ("R&2");
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
53 Button r3 = new Button (c1, DWT.RADIO);
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
54 r3.setText ("R3");
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
55 Button b2 = new Button (c1, DWT.PUSH);
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
56 b2.setText ("B2");
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
57 List l1 = new List (c1, DWT.SINGLE | DWT.BORDER);
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
58 l1.setItems (["L1"]);
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
59 Button b3 = new Button (c1, DWT.PUSH);
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
60 b3.setText ("B&3");
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
61 Button b4 = new Button (c1, DWT.PUSH);
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
62 b4.setText ("B&4");
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
63
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
64 Composite c2 = new Composite (shell, DWT.BORDER);
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
65 c2.setLayout (new RowLayout ());
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
66 Button b5 = new Button (c2, DWT.PUSH);
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
67 b5.setText ("B&5");
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
68 Button b6 = new Button (c2, DWT.PUSH);
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
69 b6.setText ("B&6");
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
70
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
71 List l2 = new List (shell, DWT.SINGLE | DWT.BORDER);
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
72 l2.setItems ( ["L2"] );
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
73
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
74 ToolBar tb1 = new ToolBar (shell, DWT.FLAT | DWT.BORDER);
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
75 ToolItem i1 = new ToolItem (tb1, DWT.RADIO);
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
76 i1.setText ("I1");
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
77 ToolItem i2 = new ToolItem (tb1, DWT.RADIO);
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
78 i2.setText ("I2");
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
79 Combo combo1 = new Combo (tb1, DWT.READ_ONLY | DWT.BORDER);
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
80 combo1.setItems (["C1"]);
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
81 combo1.setText ("C1");
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
82 combo1.pack ();
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
83 ToolItem i3 = new ToolItem (tb1, DWT.SEPARATOR);
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
84 i3.setWidth (combo1.getSize ().x);
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
85 i3.setControl (combo1);
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
86 ToolItem i4 = new ToolItem (tb1, DWT.PUSH);
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
87 i4.setText ("I&4");
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
88 ToolItem i5 = new ToolItem (tb1, DWT.CHECK);
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
89 i5.setText ("I5");
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
90
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
91 Button b7 = new Button (shell, DWT.PUSH);
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
92 b7.setText ("B&7");
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
93
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
94 Composite c4 = new Composite (shell, DWT.BORDER);
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
95 Composite c5 = new Composite (c4, DWT.BORDER);
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
96 c5.setLayout(new FillLayout());
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
97 (new Label(c5, DWT.NONE)).setText("No");
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
98 c5.pack();
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
99
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
100
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
101 Control [] tabList1 = [cast(Control)b2, b1, b3];
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
102 c1.setTabList (tabList1);
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
103 Control [] tabList2 = [cast(Control)c1, b7, tb1, c4, c2, l2];
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
104 shell.setTabList (tabList2);
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
105 shell.pack ();
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
106 shell.open ();
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
107
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
108 while (!shell.isDisposed ()) {
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
109 if (!display.readAndDispatch ()) display.sleep ();
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
110 }
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
111 display.dispose ();
9a1be6ff19a2 More snippets, thanks to Tom D.
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
112 }