comparison dwt/widgets/MessageBox.d @ 212:ab60f3309436

reverted the char[] to String and use the an alias.
author Frank Benoit <benoit@tionex.de>
date Mon, 05 May 2008 00:12:38 +0200
parents 72ef824d4983
children 36f5cb12e1a2
comparison
equal deleted inserted replaced
211:ff59aeb96cac 212:ab60f3309436
17 import dwt.internal.win32.OS; 17 import dwt.internal.win32.OS;
18 18
19 import dwt.widgets.Dialog; 19 import dwt.widgets.Dialog;
20 import dwt.widgets.Shell; 20 import dwt.widgets.Shell;
21 import dwt.widgets.Display; 21 import dwt.widgets.Display;
22 import dwt.dwthelper.utils;
22 23
23 /** 24 /**
24 * Instances of this class are used to inform or warn the user. 25 * Instances of this class are used to inform or warn the user.
25 * <dl> 26 * <dl>
26 * <dt><b>Styles:</b></dt> 27 * <dt><b>Styles:</b></dt>
39 * IMPORTANT: This class is intended to be subclassed <em>only</em> 40 * IMPORTANT: This class is intended to be subclassed <em>only</em>
40 * within the DWT implementation. 41 * within the DWT implementation.
41 * </p> 42 * </p>
42 */ 43 */
43 public class MessageBox : Dialog { 44 public class MessageBox : Dialog {
44 char[] message = ""; 45 String message = "";
45 private bool allowNullParent = false; 46 private bool allowNullParent = false;
46 47
47 /** 48 /**
48 * Constructs a new instance of this class given only its parent. 49 * Constructs a new instance of this class given only its parent.
49 * 50 *
121 * The message is a description of the purpose for which the dialog was opened. 122 * The message is a description of the purpose for which the dialog was opened.
122 * This message will be visible in the dialog while it is open. 123 * This message will be visible in the dialog while it is open.
123 * 124 *
124 * @return the message 125 * @return the message
125 */ 126 */
126 public char[] getMessage () { 127 public String getMessage () {
127 return message; 128 return message;
128 } 129 }
129 130
130 /** 131 /**
131 * Makes the dialog visible and brings it to the front 132 * Makes the dialog visible and brings it to the front
262 * 263 *
263 * @exception IllegalArgumentException <ul> 264 * @exception IllegalArgumentException <ul>
264 * <li>ERROR_NULL_ARGUMENT - if the string is null</li> 265 * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
265 * </ul> 266 * </ul>
266 */ 267 */
267 public void setMessage (char[] string) { 268 public void setMessage (String string) {
268 if (string is null) error (DWT.ERROR_NULL_ARGUMENT); 269 if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
269 message = string; 270 message = string;
270 } 271 }
271 272
272 /++ 273 /++
273 + DWT extension 274 + DWT extension
274 +/ 275 +/
275 public static int showMessageBox(char[] str, char[] title, Shell shell, int style) { 276 public static int showMessageBox(String str, String title, Shell shell, int style) {
276 MessageBox msgBox = (shell is null ) ? new MessageBox( style ) : new MessageBox(shell, style); 277 MessageBox msgBox = (shell is null ) ? new MessageBox( style ) : new MessageBox(shell, style);
277 msgBox.setMessage(str); 278 msgBox.setMessage(str);
278 if(title !is null){ 279 if(title !is null){
279 msgBox.setText(title); 280 msgBox.setText(title);
280 } 281 }
281 return msgBox.open(); 282 return msgBox.open();
282 } 283 }
283 284
284 /// DWT extension 285 /// DWT extension
285 public static int showInfo(char[] str, char[] title = null, Shell shell = null) { 286 public static int showInfo(String str, String title = null, Shell shell = null) {
286 return showMessageBox( str, title, shell, DWT.OK | DWT.ICON_INFORMATION ); 287 return showMessageBox( str, title, shell, DWT.OK | DWT.ICON_INFORMATION );
287 } 288 }
288 /// DWT extension 289 /// DWT extension
289 alias showInfo showInformation; 290 alias showInfo showInformation;
290 291
291 /// DWT extension 292 /// DWT extension
292 public static int showWarning(char[] str, char[] title = null, Shell shell = null) { 293 public static int showWarning(String str, String title = null, Shell shell = null) {
293 return showMessageBox( str, title, shell, DWT.OK | DWT.ICON_WARNING ); 294 return showMessageBox( str, title, shell, DWT.OK | DWT.ICON_WARNING );
294 } 295 }
295 /// DWT extension 296 /// DWT extension
296 public static int showError(char[] str, char[] title = null, Shell shell = null) { 297 public static int showError(String str, String title = null, Shell shell = null) {
297 return showMessageBox( str, title, shell, DWT.OK | DWT.ICON_ERROR ); 298 return showMessageBox( str, title, shell, DWT.OK | DWT.ICON_ERROR );
298 } 299 }
299 300
300 } 301 }
301 302