diff dwt/widgets/MessageBox.d @ 240:ce446666f5a2

Update to SWT 3.4M7
author Frank Benoit <benoit@tionex.de>
date Mon, 12 May 2008 19:13:01 +0200
parents 380bad9f6852
children 5a30aa9820f3
line wrap: on
line diff
--- a/dwt/widgets/MessageBox.d	Mon May 12 15:36:37 2008 +0200
+++ b/dwt/widgets/MessageBox.d	Mon May 12 19:13:01 2008 +0200
@@ -47,6 +47,8 @@
  */
 public class MessageBox : Dialog {
 
+    alias Dialog.checkStyle checkStyle;
+
     String message = "";
     GtkWidget* handle;
     private bool allowNullParent = false;
@@ -91,7 +93,7 @@
  * </ul>
  */
 public this (Shell parent, int style) {
-    super(parent, checkStyle(style));
+    super (parent, checkStyle (parent, checkStyle (style)));
     checkSubclass ();
 }
 
@@ -100,7 +102,7 @@
  +/
 public this (int style) {
     allowNullParent = true;
-    super (parent, checkStyle (style));
+    super (parent, checkStyle (parent, checkStyle (style)));
     checkSubclass ();
 }
 // PORT
@@ -176,10 +178,30 @@
     OS.gtk_window_set_title(handle,buffer);
     Display display = parent !is null ? parent.getDisplay (): Display.getCurrent ();
     display.addIdleProc ();
-    int result = OS.gtk_dialog_run (handle);
+    Dialog oldModal = null;
+    if (OS.gtk_window_get_modal (handle)) {
+        oldModal = display.getModalDialog ();
+        display.setModalDialog (this);
+    }
+    int signalId = 0;
+    int /*long*/ hookId = 0;
+    CallbackData emissionData;
+    emissionData.display = display;
+    emissionData.data = handle;
+    if ((style & DWT.RIGHT_TO_LEFT) !is 0) {
+        signalId = OS.g_signal_lookup (OS.map.ptr, OS.GTK_TYPE_WIDGET());
+        hookId = OS.g_signal_add_emission_hook (signalId, 0, &Display.emissionFunc, &emissionData, null);
+    }
+    int response = OS.gtk_dialog_run (handle);
+    if ((style & DWT.RIGHT_TO_LEFT) !is 0) {
+        OS.g_signal_remove_emission_hook (signalId, hookId);
+    }
+    if (OS.gtk_window_get_modal (handle)) {
+        display.setModalDialog (oldModal);
+    }
     display.removeIdleProc ();
     OS.gtk_widget_destroy (handle);
-    return result;
+    return response;
 }
 
 private void createButtons() {