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 * Jesse Phillips <Jesse.K.Phillips+D> gmail.com
|
|
12 *******************************************************************************/
|
|
13
|
|
14 module snippets.tooltips.Snippet41;
|
|
15
|
|
16 /*
|
|
17 * Tool Tips example snippet: create tool tips for a tab item, tool item, and shell
|
|
18 *
|
|
19 * For a list of all SWT example snippets see
|
|
20 * http://www.eclipse.org/swt/snippets/
|
|
21 */
|
|
22 import dwt.DWT;
|
|
23 import dwt.widgets.Display;
|
|
24 import dwt.widgets.Shell;
|
|
25 import dwt.widgets.TabFolder;
|
|
26 import dwt.widgets.TabItem;
|
|
27 import dwt.widgets.ToolBar;
|
|
28 import dwt.widgets.ToolItem;
|
|
29
|
|
30 void main () {
|
|
31 auto string = "This is a string\nwith a new line.";
|
|
32 auto display = new Display ();
|
|
33 auto shell = new Shell (display);
|
|
34
|
|
35 TabFolder folder = new TabFolder (shell, DWT.BORDER);
|
|
36
|
|
37 folder.setSize (200, 200);
|
|
38 auto item0 = new TabItem (folder, 0);
|
|
39 item0.setText( "Text" );
|
|
40 item0.setToolTipText ("TabItem toolTip: " ~ string);
|
|
41
|
|
42 auto bar = new ToolBar (shell, DWT.BORDER);
|
|
43 bar.setBounds (0, 200, 200, 64);
|
|
44
|
|
45 ToolItem item1 = new ToolItem (bar, 0);
|
|
46 item1.setText( "Text" );
|
|
47 item1.setToolTipText ("ToolItem toolTip: " ~ string);
|
|
48 shell.setToolTipText ("Shell toolTip: " ~ string);
|
|
49
|
|
50 shell.open ();
|
|
51 while (!shell.isDisposed ()) {
|
|
52 if (!display.readAndDispatch ()) display.sleep ();
|
|
53 }
|
|
54 display.dispose ();
|
|
55 }
|