28
|
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 * Bill Baxter <wbaxter> at gmail com
|
|
12 *******************************************************************************/
|
|
13 module org.eclipse.swt.snippets.Snippet76;
|
|
14
|
|
15 /*
|
|
16 * TabFolder example snippet: create a tab folder (six pages)
|
|
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.widgets.Display;
|
|
23 import org.eclipse.swt.widgets.Shell;
|
|
24 import org.eclipse.swt.widgets.TabFolder;
|
|
25 import org.eclipse.swt.widgets.TabItem;
|
|
26 import org.eclipse.swt.widgets.Button;
|
112
|
27 import java.lang.all;
|
28
|
28
|
112
|
29 version(Tango){
|
|
30 import tango.util.Convert;
|
|
31 } else { // Phobos
|
|
32 import std.conv;
|
|
33 }
|
28
|
34
|
|
35 void main () {
|
|
36 Display display = new Display ();
|
112
|
37 Shell shell = new Shell (display);
|
|
38 TabFolder tabFolder = new TabFolder (shell, SWT.BORDER);
|
28
|
39 for (int i=0; i<6; i++) {
|
|
40 TabItem item = new TabItem (tabFolder, SWT.NONE);
|
112
|
41 item.setText ("TabItem " ~ to!(String)(i));
|
28
|
42 Button button = new Button (tabFolder, SWT.PUSH);
|
112
|
43 button.setText ("Page " ~ to!(String)(i));
|
28
|
44 item.setControl (button);
|
|
45 }
|
|
46 tabFolder.pack ();
|
|
47 shell.pack ();
|
|
48 shell.open ();
|
|
49 while (!shell.isDisposed ()) {
|
|
50 if (!display.readAndDispatch ()) display.sleep ();
|
|
51 }
|
|
52 display.dispose ();
|
|
53 }
|
|
54
|