Mercurial > projects > dwt-win
changeset 60:6423053f6d3e
MessageBox
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 04 Feb 2008 14:12:19 +0100 |
parents | dc7db4338dbe |
children | cb74965f7ca3 |
files | dwt/widgets/MessageBox.d |
diffstat | 1 files changed, 15 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/dwt/widgets/MessageBox.d Mon Feb 04 13:39:10 2008 +0100 +++ b/dwt/widgets/MessageBox.d Mon Feb 04 14:12:19 2008 +0100 @@ -12,19 +12,13 @@ *******************************************************************************/ module dwt.widgets.MessageBox; -import dwt.widgets.Dialog; -import dwt.widgets.Shell; - -class MessageBox : Dialog { - public this (Shell parent, int style) { - super (parent, style); - } -} -/++ import dwt.DWT; import dwt.DWTException; import dwt.internal.win32.OS; -import dwt.internal.win32.TCHAR; + +import dwt.widgets.Dialog; +import dwt.widgets.Shell; +import dwt.widgets.Display; /** * Instances of this class are used to inform or warn the user. @@ -46,8 +40,8 @@ * within the DWT implementation. * </p> */ -public class MessageBox extends Dialog { - String message = ""; +public class MessageBox : Dialog { + char[] message = ""; /** * Constructs a new instance of this class given only its parent. @@ -62,7 +56,7 @@ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li> * </ul> */ -public MessageBox (Shell parent) { +public this (Shell parent) { this (parent, DWT.OK | DWT.ICON_INFORMATION | DWT.APPLICATION_MODAL); } @@ -89,7 +83,7 @@ * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li> * </ul> */ -public MessageBox (Shell parent, int style) { +public this (Shell parent, int style) { super (parent, checkStyle (style)); checkSubclass (); } @@ -112,7 +106,7 @@ * * @return the message */ -public String getMessage () { +public char[] getMessage () { return message; } @@ -187,7 +181,7 @@ * anyway and not rely on MB_MODAL to work by making the * parent be temporarily modal. */ - int hwndOwner = parent !is null ? parent.handle : 0; + HWND hwndOwner = parent !is null ? parent.handle : null; Shell oldModal = null; Display display = null; if ((bits & OS.MB_TASKMODAL) !is 0) { @@ -198,9 +192,9 @@ /* Open the message box */ /* Use the character encoding for the default locale */ - TCHAR buffer1 = new TCHAR (0, message, true); - TCHAR buffer2 = new TCHAR (0, title, true); - int code = OS.MessageBox (hwndOwner, buffer1, buffer2, bits); + TCHAR[] buffer1 = StrToTCHARs (0, message, true); + TCHAR[] buffer2 = StrToTCHARs (0, title, true); + int code = OS.MessageBox (hwndOwner, buffer1.ptr, buffer2.ptr, bits); /* Clear the temporarily dialog modal parent */ if ((bits & OS.MB_TASKMODAL) !is 0) { @@ -253,10 +247,10 @@ * <li>ERROR_NULL_ARGUMENT - if the string is null</li> * </ul> */ -public void setMessage (String string) { +public void setMessage (char[] string) { if (string is null) error (DWT.ERROR_NULL_ARGUMENT); message = string; } } -++/ +