Changeset 208:fff9f748b33b
- Timestamp:
- 03/15/08 12:48:15
(6 months ago)
- Author:
- Frank Benoit <benoit@tionex.de>
- branch:
- default
- Message:
Added convinience methods in MessageBox? now they are same as in dwt-win
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r108 |
r208 |
|
| 1 | | /******************************************************************************* |
|---|
| | 1 | /******************************************************************************* |
|---|
| 2 | 2 | * Copyright (c) 2000, 2007 IBM Corporation and others. |
|---|
| 3 | 3 | * All rights reserved. This program and the accompanying materials |
|---|
| … | … | |
| 48 | 48 | char[] message = ""; |
|---|
| 49 | 49 | GtkWidget* handle; |
|---|
| | 50 | private bool allowNullParent = false; |
|---|
| 50 | 51 | /** |
|---|
| 51 | 52 | * Constructs a new instance of this class given only its parent. |
|---|
| … | … | |
| 91 | 92 | super(parent, checkStyle(style)); |
|---|
| 92 | 93 | checkSubclass (); |
|---|
| | 94 | } |
|---|
| | 95 | |
|---|
| | 96 | /++ |
|---|
| | 97 | + DWT extension, a MessageBox with no parent |
|---|
| | 98 | +/ |
|---|
| | 99 | public this (int style) { |
|---|
| | 100 | allowNullParent = true; |
|---|
| | 101 | super (parent, checkStyle (style)); |
|---|
| | 102 | checkSubclass (); |
|---|
| | 103 | } |
|---|
| | 104 | // PORT |
|---|
| | 105 | // actually, the parent can be null |
|---|
| | 106 | override void checkParent (Shell parent){ |
|---|
| | 107 | if( !allowNullParent ){ |
|---|
| | 108 | super.checkParent( parent ); |
|---|
| | 109 | } |
|---|
| 93 | 110 | } |
|---|
| 94 | 111 | |
|---|
| … | … | |
| 198 | 215 | return result[ 0 .. j ]; |
|---|
| 199 | 216 | } |
|---|
| 200 | | } |
|---|
| | 217 | |
|---|
| | 218 | |
|---|
| | 219 | /** |
|---|
| | 220 | * DWT extension |
|---|
| | 221 | */ |
|---|
| | 222 | public static int showMessageBox(char[] str, char[] title, Shell shell, int style) { |
|---|
| | 223 | MessageBox msgBox = (shell is null ) ? new MessageBox( style ) : new MessageBox(shell, style); |
|---|
| | 224 | msgBox.setMessage(str); |
|---|
| | 225 | if(title !is null){ |
|---|
| | 226 | msgBox.setText(title); |
|---|
| | 227 | } |
|---|
| | 228 | return msgBox.open(); |
|---|
| | 229 | } |
|---|
| | 230 | |
|---|
| | 231 | /// DWT extension |
|---|
| | 232 | public static int showInfo(char[] str, char[] title = null, Shell shell = null) { |
|---|
| | 233 | return showMessageBox( str, title, shell, DWT.OK | DWT.ICON_INFORMATION ); |
|---|
| | 234 | } |
|---|
| | 235 | /// DWT extension |
|---|
| | 236 | alias showInfo showInformation; |
|---|
| | 237 | |
|---|
| | 238 | /// DWT extension |
|---|
| | 239 | public static int showWarning(char[] str, char[] title = null, Shell shell = null) { |
|---|
| | 240 | return showMessageBox( str, title, shell, DWT.OK | DWT.ICON_WARNING ); |
|---|
| | 241 | } |
|---|
| | 242 | /// DWT extension |
|---|
| | 243 | public static int showError(char[] str, char[] title = null, Shell shell = null) { |
|---|
| | 244 | return showMessageBox( str, title, shell, DWT.OK | DWT.ICON_ERROR ); |
|---|
| | 245 | } |
|---|
| | 246 | |
|---|
| | 247 | } |
|---|