comparison snippets/tabfolder/Snippet76.d @ 91:961ca8a76cad

Port of tabfolder Snippet76
author Bill Baxter <bill@billbaxter.com>
date Thu, 22 May 2008 03:05:49 +0900
parents
children 1f0a7a472680
comparison
equal deleted inserted replaced
90:29bf9ba4756b 91:961ca8a76cad
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 snippets.tabfolder.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 dwt.DWT;
22 import dwt.widgets.Display;
23 import dwt.widgets.Shell;
24 import dwt.widgets.TabFolder;
25 import dwt.widgets.TabItem;
26 import dwt.widgets.Button;
27
28 import tango.util.Convert;
29
30 void main () {
31 Display display = new Display ();
32 final Shell shell = new Shell (display);
33 final TabFolder tabFolder = new TabFolder (shell, DWT.BORDER);
34 for (int i=0; i<6; i++) {
35 TabItem item = new TabItem (tabFolder, DWT.NONE);
36 item.setText ("TabItem " ~ to!(char[])(i));
37 Button button = new Button (tabFolder, DWT.PUSH);
38 button.setText ("Page " ~ to!(char[])(i));
39 item.setControl (button);
40 }
41 tabFolder.pack ();
42 shell.pack ();
43 shell.open ();
44 while (!shell.isDisposed ()) {
45 if (!display.readAndDispatch ()) display.sleep ();
46 }
47 display.dispose ();
48 }
49