comparison examples/controlexample/ListTab.d @ 78:4a04b6759f98

Clean up directory names
author John Reimer <terminal.node@gmail.com>
date Sat, 10 May 2008 13:32:45 -0700
parents
children eb84f9418bbf
comparison
equal deleted inserted replaced
76:04f122e90b0a 78:4a04b6759f98
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 *******************************************************************************/
13 module examples.controlexample.ListTab;
14
15
16
17 import dwt.DWT;
18 import dwt.layout.GridData;
19 import dwt.layout.GridLayout;
20 import dwt.widgets.Group;
21 import dwt.widgets.List;
22 import dwt.widgets.Widget;
23
24 import examples.controlexample.Tab;
25 import examples.controlexample.ControlExample;
26 import examples.controlexample.ScrollableTab;
27
28 class ListTab : ScrollableTab {
29
30 /* Example widgets and groups that contain them */
31 List list1;
32 Group listGroup;
33
34 static char[] [] ListData1;
35
36 /**
37 * Creates the Tab within a given instance of ControlExample.
38 */
39 this(ControlExample instance) {
40 super(instance);
41 if( ListData1.length is 0 ){
42 ListData1 = [
43 ControlExample.getResourceString("ListData1_0"),
44 ControlExample.getResourceString("ListData1_1"),
45 ControlExample.getResourceString("ListData1_2"),
46 ControlExample.getResourceString("ListData1_3"),
47 ControlExample.getResourceString("ListData1_4"),
48 ControlExample.getResourceString("ListData1_5"),
49 ControlExample.getResourceString("ListData1_6"),
50 ControlExample.getResourceString("ListData1_7"),
51 ControlExample.getResourceString("ListData1_8")];
52 }
53 }
54
55 /**
56 * Creates the "Example" group.
57 */
58 void createExampleGroup () {
59 super.createExampleGroup ();
60
61 /* Create a group for the list */
62 listGroup = new Group (exampleGroup, DWT.NONE);
63 listGroup.setLayout (new GridLayout ());
64 listGroup.setLayoutData (new GridData (DWT.FILL, DWT.FILL, true, true));
65 listGroup.setText ("List");
66 }
67
68 /**
69 * Creates the "Example" widgets.
70 */
71 void createExampleWidgets () {
72
73 /* Compute the widget style */
74 int style = getDefaultStyle();
75 if (singleButton.getSelection ()) style |= DWT.SINGLE;
76 if (multiButton.getSelection ()) style |= DWT.MULTI;
77 if (horizontalButton.getSelection ()) style |= DWT.H_SCROLL;
78 if (verticalButton.getSelection ()) style |= DWT.V_SCROLL;
79 if (borderButton.getSelection ()) style |= DWT.BORDER;
80
81 /* Create the example widgets */
82 list1 = new List (listGroup, style);
83 list1.setItems (ListData1);
84 }
85
86 /**
87 * Gets the "Example" widget children.
88 */
89 Widget [] getExampleWidgets () {
90 return [cast(Widget) list1];
91 }
92
93 /**
94 * Returns a list of set/get API method names (without the set/get prefix)
95 * that can be used to set/get values in the example control(s).
96 */
97 char[][] getMethodNames() {
98 return ["Items", "Selection", "ToolTipText", "TopIndex" ];
99 }
100
101 /**
102 * Gets the text for the tab folder item.
103 */
104 char[] getTabText () {
105 return "List";
106 }
107 }