78
|
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
|
|
12 *******************************************************************************/
|
|
13 module snippets.sashform.Snippet109;
|
|
14
|
|
15 /*
|
|
16 * SashForm example snippet: create a sash form with three children
|
|
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.custom.SashForm;
|
|
23 import dwt.layout.FillLayout;
|
|
24 import dwt.widgets.Display;
|
|
25 import dwt.widgets.Shell;
|
|
26 import dwt.widgets.Label;
|
|
27 import dwt.widgets.Button;
|
|
28 import dwt.widgets.Composite;
|
|
29
|
|
30 void main () {
|
|
31 final Display display = new Display ();
|
|
32 Shell shell = new Shell(display);
|
|
33 shell.setLayout (new FillLayout());
|
|
34
|
|
35 SashForm form = new SashForm(shell,DWT.HORIZONTAL);
|
|
36 form.setLayout(new FillLayout());
|
|
37
|
|
38 Composite child1 = new Composite(form,DWT.NONE);
|
|
39 child1.setLayout(new FillLayout());
|
|
40 (new Label(child1,DWT.NONE)).setText("Label in pane 1");
|
|
41
|
|
42 Composite child2 = new Composite(form,DWT.NONE);
|
|
43 child2.setLayout(new FillLayout());
|
|
44 (new Button(child2,DWT.PUSH)).setText("Button in pane2");
|
|
45
|
|
46 Composite child3 = new Composite(form,DWT.NONE);
|
|
47 child3.setLayout(new FillLayout());
|
|
48 (new Label(child3,DWT.PUSH)).setText("Label in pane3");
|
|
49
|
|
50 form.setWeights([30,40,30]);
|
|
51 shell.open ();
|
|
52 while (!shell.isDisposed ()) {
|
|
53 if (!display.readAndDispatch ()) display.sleep ();
|
|
54 }
|
|
55 display.dispose ();
|
|
56 }
|
|
57
|