annotate examples/controlexample/TextTab.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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
78
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
1 /*******************************************************************************
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
2 * Copyright (c) 2000, 2007 IBM Corporation and others.
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
3 * All rights reserved. This program and the accompanying materials
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
4 * are made available under the terms of the Eclipse Public License v1.0
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
5 * which accompanies this distribution, and is available at
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
6 * http://www.eclipse.org/legal/epl-v10.html
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
7 *
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
8 * Contributors:
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
9 * IBM Corporation - initial API and implementation
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
10 * Port to the D programming language:
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
11 * Frank Benoit <benoit@tionex.de>
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
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.TextTab;
78
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
14
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
15
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
16
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
17 import dwt.DWT;
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
18 import dwt.events.ControlAdapter;
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
19 import dwt.events.ControlEvent;
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
20 import dwt.layout.GridData;
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
21 import dwt.layout.GridLayout;
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
22 import dwt.widgets.Button;
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
23 import dwt.widgets.Composite;
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
24 import dwt.widgets.Group;
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
25 import dwt.widgets.TabFolder;
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
26 import dwt.widgets.Text;
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
27 import dwt.widgets.Widget;
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
28
161
eb84f9418bbf Change module names to this not have examples in the FQN.
Frank Benoit <benoit@tionex.de>
parents: 78
diff changeset
29 import controlexample.Tab;
eb84f9418bbf Change module names to this not have examples in the FQN.
Frank Benoit <benoit@tionex.de>
parents: 78
diff changeset
30 import controlexample.ControlExample;
eb84f9418bbf Change module names to this not have examples in the FQN.
Frank Benoit <benoit@tionex.de>
parents: 78
diff changeset
31 import controlexample.ScrollableTab;
78
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
32
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
33 class TextTab : ScrollableTab {
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
34 /* Example widgets and groups that contain them */
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
35 Text text;
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
36 Group textGroup;
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
37
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
38 /* Style widgets added to the "Style" group */
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
39 Button wrapButton, readOnlyButton, passwordButton, searchButton, cancelButton;
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
40 Button leftButton, centerButton, rightButton;
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
41
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
42 /**
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
43 * Creates the Tab within a given instance of ControlExample.
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
44 */
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
45 this(ControlExample instance) {
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
46 super(instance);
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
47 }
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
48
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
49 /**
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
50 * Creates the "Example" group.
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
51 */
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
52 void createExampleGroup () {
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
53 super.createExampleGroup ();
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
54
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
55 /* Create a group for the text widget */
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
56 textGroup = new Group (exampleGroup, DWT.NONE);
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
57 textGroup.setLayout (new GridLayout ());
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
58 textGroup.setLayoutData (new GridData (DWT.FILL, DWT.FILL, true, true));
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
59 textGroup.setText ("Text");
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
60 }
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
61
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
62 /**
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
63 * Creates the "Example" widgets.
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
64 */
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
65 void createExampleWidgets () {
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
66
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
67 /* Compute the widget style */
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
68 int style = getDefaultStyle();
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
69 if (singleButton.getSelection ()) style |= DWT.SINGLE;
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
70 if (multiButton.getSelection ()) style |= DWT.MULTI;
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
71 if (horizontalButton.getSelection ()) style |= DWT.H_SCROLL;
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
72 if (verticalButton.getSelection ()) style |= DWT.V_SCROLL;
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
73 if (wrapButton.getSelection ()) style |= DWT.WRAP;
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
74 if (readOnlyButton.getSelection ()) style |= DWT.READ_ONLY;
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
75 if (passwordButton.getSelection ()) style |= DWT.PASSWORD;
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
76 if (searchButton.getSelection ()) style |= DWT.SEARCH;
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
77 if (cancelButton.getSelection ()) style |= DWT.CANCEL;
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
78 if (borderButton.getSelection ()) style |= DWT.BORDER;
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
79 if (leftButton.getSelection ()) style |= DWT.LEFT;
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
80 if (centerButton.getSelection ()) style |= DWT.CENTER;
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
81 if (rightButton.getSelection ()) style |= DWT.RIGHT;
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
82
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
83 /* Create the example widgets */
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
84 text = new Text (textGroup, style);
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
85 text.setText (ControlExample.getResourceString("Example_string") ~ Text.DELIMITER ~ ControlExample.getResourceString("One_Two_Three"));
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
86 }
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
87
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
88 /**
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
89 * Creates the "Style" group.
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
90 */
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
91 void createStyleGroup() {
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
92 super.createStyleGroup();
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
93
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
94 /* Create the extra widgets */
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
95 wrapButton = new Button (styleGroup, DWT.CHECK);
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
96 wrapButton.setText ("DWT.WRAP");
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
97 readOnlyButton = new Button (styleGroup, DWT.CHECK);
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
98 readOnlyButton.setText ("DWT.READ_ONLY");
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
99 passwordButton = new Button (styleGroup, DWT.CHECK);
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
100 passwordButton.setText ("DWT.PASSWORD");
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
101 searchButton = new Button (styleGroup, DWT.CHECK);
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
102 searchButton.setText ("DWT.SEARCH");
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
103 cancelButton = new Button (styleGroup, DWT.CHECK);
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
104 cancelButton.setText ("DWT.CANCEL");
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
105
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
106 Composite alignmentGroup = new Composite (styleGroup, DWT.NONE);
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
107 GridLayout layout = new GridLayout ();
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
108 layout.marginWidth = layout.marginHeight = 0;
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
109 alignmentGroup.setLayout (layout);
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
110 alignmentGroup.setLayoutData (new GridData (GridData.FILL_BOTH));
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
111 leftButton = new Button (alignmentGroup, DWT.RADIO);
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
112 leftButton.setText ("DWT.LEFT");
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
113 centerButton = new Button (alignmentGroup, DWT.RADIO);
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
114 centerButton.setText ("DWT.CENTER");
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
115 rightButton = new Button (alignmentGroup, DWT.RADIO);
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
116 rightButton.setText ("DWT.RIGHT");
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
117 }
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
118
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
119 /**
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
120 * Creates the tab folder page.
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
121 *
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
122 * @param tabFolder org.eclipse.swt.widgets.TabFolder
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
123 * @return the new page for the tab folder
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
124 */
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
125 Composite createTabFolderPage (TabFolder tabFolder) {
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
126 super.createTabFolderPage (tabFolder);
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
127
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
128 /*
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
129 * Add a resize listener to the tabFolderPage so that
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
130 * if the user types into the example widget to change
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
131 * its preferred size, and then resizes the shell, we
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
132 * recalculate the preferred size correctly.
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
133 */
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
134 tabFolderPage.addControlListener(new class() ControlAdapter {
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
135 public void controlResized(ControlEvent e) {
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
136 setExampleWidgetSize ();
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
137 }
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
138 });
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
139
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
140 return tabFolderPage;
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
141 }
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
142
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
143 /**
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
144 * Gets the "Example" widget children.
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
145 */
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
146 Widget [] getExampleWidgets () {
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
147 return [ cast(Widget) text];
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
148 }
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
149
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
150 /**
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
151 * Returns a list of set/get API method names (without the set/get prefix)
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
152 * that can be used to set/get values in the example control(s).
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
153 */
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
154 char[][] getMethodNames() {
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
155 return ["DoubleClickEnabled", "EchoChar", "Editable", "Orientation", "Selection", "Tabs", "Text", "TextLimit", "ToolTipText", "TopIndex"];
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
156 }
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
157
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
158 /**
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
159 * Gets the text for the tab folder item.
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
160 */
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
161 char[] getTabText () {
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
162 return "Text";
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
163 }
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
164
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
165 /**
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
166 * Sets the state of the "Example" widgets.
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
167 */
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
168 void setExampleWidgetState () {
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
169 super.setExampleWidgetState ();
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
170 wrapButton.setSelection ((text.getStyle () & DWT.WRAP) !is 0);
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
171 readOnlyButton.setSelection ((text.getStyle () & DWT.READ_ONLY) !is 0);
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
172 passwordButton.setSelection ((text.getStyle () & DWT.PASSWORD) !is 0);
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
173 searchButton.setSelection ((text.getStyle () & DWT.SEARCH) !is 0);
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
174 leftButton.setSelection ((text.getStyle () & DWT.LEFT) !is 0);
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
175 centerButton.setSelection ((text.getStyle () & DWT.CENTER) !is 0);
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
176 rightButton.setSelection ((text.getStyle () & DWT.RIGHT) !is 0);
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
177
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
178 /* Special case: CANCEL and H_SCROLL have the same value,
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
179 * so to avoid confusion, only set CANCEL if SEARCH is set. */
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
180 if ((text.getStyle () & DWT.SEARCH) !is 0) {
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
181 cancelButton.setSelection ((text.getStyle () & DWT.CANCEL) !is 0);
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
182 horizontalButton.setSelection (false);
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
183 } else {
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
184 cancelButton.setSelection (false);
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
185 horizontalButton.setSelection ((text.getStyle () & DWT.H_SCROLL) !is 0);
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
186 }
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
187
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
188 passwordButton.setEnabled ((text.getStyle () & DWT.SINGLE) !is 0);
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
189 searchButton.setEnabled ((text.getStyle () & DWT.SINGLE) !is 0);
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
190 cancelButton.setEnabled ((text.getStyle () & DWT.SEARCH) !is 0);
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
191 wrapButton.setEnabled ((text.getStyle () & DWT.MULTI) !is 0);
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
192 horizontalButton.setEnabled ((text.getStyle () & DWT.MULTI) !is 0);
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
193 verticalButton.setEnabled ((text.getStyle () & DWT.MULTI) !is 0);
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
194 }
4a04b6759f98 Clean up directory names
John Reimer <terminal.node@gmail.com>
parents:
diff changeset
195 }