Mercurial > projects > dwt-samples
annotate examples/controlexample/LinkTab.d @ 161:eb84f9418bbf
Change module names to this not have examples in the FQN.
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 01 Sep 2008 22:24:27 +0200 |
parents | 4a04b6759f98 |
children |
rev | line source |
---|---|
78 | 1 /******************************************************************************* |
2 * Copyright (c) 2000, 2007 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 * Frank Benoit <benoit@tionex.de> | |
12 *******************************************************************************/ | |
161
eb84f9418bbf
Change module names to this not have examples in the FQN.
Frank Benoit <benoit@tionex.de>
parents:
78
diff
changeset
|
13 module controlexample.LinkTab; |
78 | 14 |
15 | |
16 | |
17 import dwt.DWT; | |
18 import dwt.DWTError; | |
19 import dwt.layout.GridData; | |
20 import dwt.layout.GridLayout; | |
21 import dwt.widgets.Button; | |
22 import dwt.widgets.Group; | |
23 import dwt.widgets.Label; | |
24 import dwt.widgets.Link; | |
25 import dwt.widgets.Widget; | |
26 | |
161
eb84f9418bbf
Change module names to this not have examples in the FQN.
Frank Benoit <benoit@tionex.de>
parents:
78
diff
changeset
|
27 import controlexample.Tab; |
eb84f9418bbf
Change module names to this not have examples in the FQN.
Frank Benoit <benoit@tionex.de>
parents:
78
diff
changeset
|
28 import controlexample.ControlExample; |
78 | 29 |
30 class LinkTab : Tab { | |
31 /* Example widgets and groups that contain them */ | |
32 Link link1; | |
33 Group linkGroup; | |
34 | |
35 /** | |
36 * Creates the Tab within a given instance of ControlExample. | |
37 */ | |
38 this(ControlExample instance) { | |
39 super(instance); | |
40 } | |
41 | |
42 /** | |
43 * Creates the "Example" group. | |
44 */ | |
45 override void createExampleGroup () { | |
46 super.createExampleGroup (); | |
47 | |
48 /* Create a group for the list */ | |
49 linkGroup = new Group (exampleGroup, DWT.NONE); | |
50 linkGroup.setLayout (new GridLayout ()); | |
51 linkGroup.setLayoutData (new GridData (DWT.FILL, DWT.FILL, true, true)); | |
52 linkGroup.setText ("Link"); | |
53 } | |
54 | |
55 /** | |
56 * Creates the "Example" widgets. | |
57 */ | |
58 override void createExampleWidgets () { | |
59 | |
60 /* Compute the widget style */ | |
61 int style = getDefaultStyle(); | |
62 if (borderButton.getSelection ()) style |= DWT.BORDER; | |
63 | |
64 /* Create the example widgets */ | |
65 try { | |
66 link1 = new Link (linkGroup, style); | |
67 link1.setText (ControlExample.getResourceString("LinkText")); | |
68 } catch (DWTError e) { | |
69 // temporary code for photon | |
70 Label label = new Label (linkGroup, DWT.CENTER | DWT.WRAP); | |
71 label.setText ("Link widget not suported"); | |
72 } | |
73 } | |
74 | |
75 /** | |
76 * Creates the "Style" group. | |
77 */ | |
78 void createStyleGroup() { | |
79 super.createStyleGroup (); | |
80 | |
81 /* Create the extra widgets */ | |
82 borderButton = new Button(styleGroup, DWT.CHECK); | |
83 borderButton.setText("DWT.BORDER"); | |
84 } | |
85 | |
86 /** | |
87 * Gets the "Example" widget children. | |
88 */ | |
89 Widget [] getExampleWidgets () { | |
90 // temporary code for photon | |
91 if (link1 !is null) return [ cast(Widget) link1 ]; | |
92 return null; | |
93 } | |
94 | |
95 /** | |
96 * Returns a list of set/get API method names (without the set/get prefix) | |
97 * that can be used to set/get values in the example control(s). | |
98 */ | |
99 char[][] getMethodNames() { | |
100 return ["Text", "ToolTipText"]; | |
101 } | |
102 | |
103 /** | |
104 * Gets the text for the tab folder item. | |
105 */ | |
106 char[] getTabText () { | |
107 return "Link"; | |
108 } | |
109 | |
110 } |