comparison org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/browser/PromptDialog.d @ 49:7a2dd761a8b2

more work until dmd 2.026 linux segfaults.
author Frank Benoit <benoit@tionex.de>
date Fri, 27 Mar 2009 12:59:54 +0100
parents f713da8bc051
children
comparison
equal deleted inserted replaced
48:ddbfe84d86df 49:7a2dd761a8b2
39 this(parent, 0); 39 this(parent, 0);
40 } 40 }
41 41
42 void alertCheck(String title, String text, String check, ref int checkValue) { 42 void alertCheck(String title, String text, String check, ref int checkValue) {
43 Shell parent = getParent(); 43 Shell parent = getParent();
44 /* final */ Shell shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); 44 /* const */ Shell shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
45 if (title !is null) shell.setText(title); 45 if (title !is null) shell.setText(title);
46 GridLayout gridLayout = new GridLayout(); 46 GridLayout gridLayout = new GridLayout();
47 shell.setLayout(gridLayout); 47 shell.setLayout(gridLayout);
48 Label label = new Label(shell, SWT.WRAP); 48 Label label = new Label(shell, SWT.WRAP);
49 label.setText(text); 49 label.setText(text);
54 data.widthHint = Math.min(width, maxWidth); 54 data.widthHint = Math.min(width, maxWidth);
55 data.horizontalAlignment = GridData.FILL; 55 data.horizontalAlignment = GridData.FILL;
56 data.grabExcessHorizontalSpace = true; 56 data.grabExcessHorizontalSpace = true;
57 label.setLayoutData (data); 57 label.setLayoutData (data);
58 58
59 final Button checkButton = check !is null ? new Button(shell, SWT.CHECK) : null; 59 Button checkButton = check !is null ? new Button(shell, SWT.CHECK) : null;
60 if (checkButton !is null) { 60 if (checkButton !is null) {
61 checkButton.setText(check); 61 checkButton.setText(check);
62 checkButton.setSelection(checkValue !is 0); 62 checkButton.setSelection(checkValue !is 0);
63 data = new GridData (); 63 data = new GridData ();
64 data.horizontalAlignment = GridData.BEGINNING; 64 data.horizontalAlignment = GridData.BEGINNING;
85 } 85 }
86 } 86 }
87 87
88 void confirmEx(String title, String text, String check, String button0, String button1, String button2, int defaultIndex, ref int checkValue, ref int result) { 88 void confirmEx(String title, String text, String check, String button0, String button1, String button2, int defaultIndex, ref int checkValue, ref int result) {
89 Shell parent = getParent(); 89 Shell parent = getParent();
90 /* final */ Shell shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); 90 /* const */ Shell shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
91 shell.setText(title); 91 shell.setText(title);
92 GridLayout gridLayout = new GridLayout(); 92 GridLayout gridLayout = new GridLayout();
93 shell.setLayout(gridLayout); 93 shell.setLayout(gridLayout);
94 Label label = new Label(shell, SWT.WRAP); 94 Label label = new Label(shell, SWT.WRAP);
95 label.setText(text); 95 label.setText(text);
100 data.widthHint = Math.min(width, maxWidth); 100 data.widthHint = Math.min(width, maxWidth);
101 data.horizontalAlignment = GridData.FILL; 101 data.horizontalAlignment = GridData.FILL;
102 data.grabExcessHorizontalSpace = true; 102 data.grabExcessHorizontalSpace = true;
103 label.setLayoutData (data); 103 label.setLayoutData (data);
104 104
105 final Button[] buttons = new Button[4]; 105 Button[] buttons = new Button[4];
106 Listener listener = new class() Listener { 106 Listener listener = new class() Listener {
107 public void handleEvent(Event event) { 107 public void handleEvent(Event event) {
108 if (buttons[0] !is null) checkValue = buttons[0].getSelection() ? 1 : 0; 108 if (buttons[0] !is null) checkValue = buttons[0].getSelection() ? 1 : 0;
109 Widget widget = event.widget; 109 Widget widget = event.widget;
110 for (int i = 1; i < buttons.length; i++) { 110 for (int i = 1; i < buttons.length; i++) {
180 data.widthHint = Math.min(width, maxWidth); 180 data.widthHint = Math.min(width, maxWidth);
181 data.horizontalAlignment = GridData.FILL; 181 data.horizontalAlignment = GridData.FILL;
182 data.grabExcessHorizontalSpace = true; 182 data.grabExcessHorizontalSpace = true;
183 label.setLayoutData (data); 183 label.setLayoutData (data);
184 184
185 final Text valueText = new Text(shell, SWT.BORDER); 185 Text valueText = new Text(shell, SWT.BORDER);
186 if (value !is null) valueText.setText(value); 186 if (value !is null) valueText.setText(value);
187 data = new GridData(); 187 data = new GridData();
188 width = valueText.computeSize(SWT.DEFAULT, SWT.DEFAULT).x; 188 width = valueText.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
189 if (width > maxWidth) data.widthHint = maxWidth; 189 if (width > maxWidth) data.widthHint = maxWidth;
190 data.horizontalAlignment = GridData.FILL; 190 data.horizontalAlignment = GridData.FILL;
191 data.grabExcessHorizontalSpace = true; 191 data.grabExcessHorizontalSpace = true;
192 valueText.setLayoutData(data); 192 valueText.setLayoutData(data);
193 193
194 final Button[] buttons = new Button[3]; 194 Button[] buttons = new Button[3];
195 Listener listener = new class() Listener { 195 Listener listener = new class() Listener {
196 public void handleEvent(Event event) { 196 public void handleEvent(Event event) {
197 if (buttons[0] !is null) checkValue = buttons[0].getSelection() ? 1 : 0; 197 if (buttons[0] !is null) checkValue = buttons[0].getSelection() ? 1 : 0;
198 value = valueText.getText(); 198 value = valueText.getText();
199 result = event.widget is buttons[1] ? 1 : 0; 199 result = event.widget is buttons[1] ? 1 : 0;
250 label.setLayoutData (data); 250 label.setLayoutData (data);
251 251
252 Label userLabel = new Label(shell, SWT.NONE); 252 Label userLabel = new Label(shell, SWT.NONE);
253 //userLabel.setText(SWT.getMessage("SWT_Username")); //$NON-NLS-1$ 253 //userLabel.setText(SWT.getMessage("SWT_Username")); //$NON-NLS-1$
254 userLabel.setText("Username:"); 254 userLabel.setText("Username:");
255 final Text userText = new Text(shell, SWT.BORDER); 255 Text userText = new Text(shell, SWT.BORDER);
256 if (user !is null) userText.setText(user); 256 if (user !is null) userText.setText(user);
257 data = new GridData(); 257 data = new GridData();
258 data.horizontalAlignment = GridData.FILL; 258 data.horizontalAlignment = GridData.FILL;
259 data.grabExcessHorizontalSpace = true; 259 data.grabExcessHorizontalSpace = true;
260 userText.setLayoutData(data); 260 userText.setLayoutData(data);
261 261
262 Label passwordLabel = new Label(shell, SWT.NONE); 262 Label passwordLabel = new Label(shell, SWT.NONE);
263 //passwordLabel.setText(SWT.getMessage("SWT_Password")); //$NON-NLS-1$ 263 //passwordLabel.setText(SWT.getMessage("SWT_Password")); //$NON-NLS-1$
264 passwordLabel.setText("Password:"); 264 passwordLabel.setText("Password:");
265 final Text passwordText = new Text(shell, SWT.PASSWORD | SWT.BORDER); 265 Text passwordText = new Text(shell, SWT.PASSWORD | SWT.BORDER);
266 if (pass !is null) passwordText.setText(pass); 266 if (pass !is null) passwordText.setText(pass);
267 data = new GridData(); 267 data = new GridData();
268 data.horizontalAlignment = GridData.FILL; 268 data.horizontalAlignment = GridData.FILL;
269 data.grabExcessHorizontalSpace = true; 269 data.grabExcessHorizontalSpace = true;
270 passwordText.setLayoutData(data); 270 passwordText.setLayoutData(data);
271 271
272 final Button[] buttons = new Button[3]; 272 Button[] buttons = new Button[3];
273 Listener listener = new class() Listener { 273 Listener listener = new class() Listener {
274 public void handleEvent(Event event) { 274 public void handleEvent(Event event) {
275 if (buttons[0] !is null) checkValue = buttons[0].getSelection() ? 1 : 0; 275 if (buttons[0] !is null) checkValue = buttons[0].getSelection() ? 1 : 0;
276 user = userText.getText(); 276 user = userText.getText();
277 pass = passwordText.getText(); 277 pass = passwordText.getText();