Mercurial > projects > dwt-linux
diff dwt/widgets/ColorDialog.d @ 240:ce446666f5a2
Update to SWT 3.4M7
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 12 May 2008 19:13:01 +0200 |
parents | 0f12f6bb9739 |
children | 5a30aa9820f3 |
line wrap: on
line diff
--- a/dwt/widgets/ColorDialog.d Mon May 12 15:36:37 2008 +0200 +++ b/dwt/widgets/ColorDialog.d Mon May 12 19:13:01 2008 +0200 @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* * Copyright (c) 2000, 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -59,7 +59,7 @@ * @see Widget#getStyle */ public this (Shell parent) { - this (parent, DWT.NONE); + this (parent, DWT.APPLICATION_MODAL); } /** * Constructs a new instance of this class given its parent @@ -90,7 +90,7 @@ * @see Widget#getStyle */ public this (Shell parent, int style) { - super (parent, style); + super (parent, checkStyle (parent, style)); checkSubclass (); } @@ -120,6 +120,7 @@ public RGB open () { char* buffer = toStringz(title); auto handle = cast(GtkWidget*)OS.gtk_color_selection_dialog_new (buffer); + Display display = parent !is null ? parent.getDisplay (): Display.getCurrent (); if (parent !is null) { auto shellHandle = parent.topHandle (); OS.gtk_window_set_transient_for (handle, shellHandle); @@ -138,9 +139,28 @@ OS.gtk_color_selection_set_current_color (dialog.colorsel, &color); } OS.gtk_color_selection_set_has_palette (dialog.colorsel, true); - Display display = parent !is null ? parent.getDisplay (): Display.getCurrent (); display.addIdleProc (); + 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); + } bool success = response is OS.GTK_RESPONSE_OK; if (success) { OS.gtk_color_selection_get_current_color (dialog.colorsel, &color);