Mercurial > projects > dwt-win
comparison dwt/widgets/MessageBox.d @ 131:2ea6488981d8
Add convinience methods to show MessageBox as info,warning,error
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Wed, 13 Feb 2008 01:33:29 +0100 |
parents | 8e3ca45497b0 |
children | 14df61b39bee |
comparison
equal
deleted
inserted
replaced
130:8e3ca45497b0 | 131:2ea6488981d8 |
---|---|
270 } | 270 } |
271 | 271 |
272 /** | 272 /** |
273 * DWT extension | 273 * DWT extension |
274 */ | 274 */ |
275 public static int showMessage(char[] str, char[] title = null, Shell shell = null, int style = DWT.OK | DWT.ICON_WARNING) { | 275 public static int showMessageBox(char[] str, char[] title = null, Shell shell = null, int style = DWT.OK | DWT.ICON_WARNING) { |
276 MessageBox msgBox = (shell is null ) ? new MessageBox( style ) : new MessageBox(shell, style); | 276 MessageBox msgBox = (shell is null ) ? new MessageBox( style ) : new MessageBox(shell, style); |
277 msgBox.setMessage(str); | 277 msgBox.setMessage(str); |
278 if(title !is null){ | 278 if(title !is null){ |
279 msgBox.setText(title); | 279 msgBox.setText(title); |
280 } | 280 } |
281 return msgBox.open(); | 281 return msgBox.open(); |
282 } | 282 } |
283 | 283 |
284 /// DWT extension | 284 /// DWT extension |
285 alias showMessage showMsg; | 285 public static int showInfo(char[] str, char[] title = null, Shell shell = null) { |
286 | 286 return showMessageBox( str, title, shell, DWT.OK | DWT.ICON_INFORMATION ); |
287 | 287 } |
288 } | 288 /// DWT extension |
289 | 289 public static int showWarning(char[] str, char[] title = null, Shell shell = null) { |
290 return showMessageBox( str, title, shell, DWT.OK | DWT.ICON_WARNING ); | |
291 } | |
292 /// DWT extension | |
293 public static int showError(char[] str, char[] title = null, Shell shell = null) { | |
294 return showMessageBox( str, title, shell, DWT.OK | DWT.ICON_ERROR ); | |
295 } | |
296 | |
297 } | |
298 |