comparison org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet293.d @ 28:69b1fa94a4a8

Added SWT snippets
author Frank Benoit <benoit@tionex.de>
date Sun, 22 Mar 2009 15:17:04 +0100
parents
children 536e43f63c81
comparison
equal deleted inserted replaced
27:1bf55a6eb092 28:69b1fa94a4a8
1 /*******************************************************************************
2 * Copyright (c) 2000, 2008 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.Snippet293;
14
15 /*
16 * create a tri-state button.
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.GridLayout;
23 import org.eclipse.swt.widgets.Display;
24 import org.eclipse.swt.widgets.Shell;
25 import org.eclipse.swt.widgets.Button;
26
27 void main() {
28 auto display = new Display();
29 auto shell = new Shell(display);
30 shell.setLayout(new GridLayout());
31
32 auto b1 = new Button (shell, SWT.CHECK);
33 b1.setText("State 1");
34 b1.setSelection(true);
35
36 auto b2 = new Button (shell, SWT.CHECK);
37 b2.setText("State 2");
38 b2.setSelection(false);
39
40 auto b3 = new Button (shell, SWT.CHECK);
41 b3.setText("State 3");
42 b3.setSelection(true);
43
44 // This function does not appear in the api for swt 3.3
45 // b3.setGrayed(true);
46
47 shell.pack();
48 shell.open();
49 while (!shell.isDisposed()) {
50 if (!display.readAndDispatch())
51 display.sleep();
52 }
53 display.dispose();
54 }