Mercurial > projects > dwt-linux
diff dwt/widgets/FontDialog.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/FontDialog.d Mon May 12 15:36:37 2008 +0200 +++ b/dwt/widgets/FontDialog.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 @@ -58,7 +58,7 @@ * </ul> */ public this (Shell parent) { - this (parent, DWT.PRIMARY_MODAL); + this (parent, DWT.APPLICATION_MODAL); } /** * Constructs a new instance of this class given its parent @@ -85,7 +85,7 @@ * </ul> */ public this (Shell parent, int style) { - super (parent, style); + super (parent, checkStyle (parent, style)); checkSubclass (); } @@ -144,6 +144,7 @@ GtkWidget* handle; char* titleBytes; titleBytes = tango.stdc.stringz.toStringz(title); + Display display = parent !is null ? parent.getDisplay (): Display.getCurrent (); handle = OS.gtk_font_selection_dialog_new (titleBytes); if (parent !is null) { auto shellHandle = parent.topHandle (); @@ -155,16 +156,34 @@ } } if (fontData !is null) { - Display display = parent !is null ? parent.display : Display.getCurrent (); Font font = new Font (display, fontData); auto fontName = OS.pango_font_description_to_string (font.handle); font.dispose(); OS.gtk_font_selection_dialog_set_font_name (handle, fontName); OS.g_free (fontName); } - Display display = parent !is null ? parent.getDisplay (): Display.getCurrent (); display.addIdleProc (); - int response = 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); + } bool success = response is OS.GTK_RESPONSE_OK; if (success) { auto fontName = OS.gtk_font_selection_dialog_get_font_name (handle);