use wxDialog::ShowModal() rather than gtk_dialog_run()
so all the things wxDialog::ShowModal() does are not bypassed git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76227 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
8e52f498c5
commit
f65efb1e26
@ -18,7 +18,6 @@
|
||||
#if wxUSE_COLOURDLG
|
||||
|
||||
#include "wx/colordlg.h"
|
||||
#include "wx/modalhook.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/intl.h"
|
||||
@ -39,6 +38,13 @@ extern "C" {
|
||||
}
|
||||
#endif // wxUSE_LIBHILDON2
|
||||
|
||||
extern "C" {
|
||||
static void response(GtkDialog*, int response_id, wxColourDialog* win)
|
||||
{
|
||||
win->EndModal(response_id == GTK_RESPONSE_OK ? wxID_OK : wxID_CANCEL);
|
||||
}
|
||||
}
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog)
|
||||
|
||||
wxColourDialog::wxColourDialog(wxWindow *parent, wxColourData *data)
|
||||
@ -83,30 +89,16 @@ bool wxColourDialog::Create(wxWindow *parent, wxColourData *data)
|
||||
|
||||
int wxColourDialog::ShowModal()
|
||||
{
|
||||
WX_HOOK_MODAL_DIALOG();
|
||||
|
||||
ColourDataToDialog();
|
||||
|
||||
wxOpenModalDialogLocker modalLocker;
|
||||
gulong id = g_signal_connect(m_widget, "response", G_CALLBACK(response), this);
|
||||
int rc = wxDialog::ShowModal();
|
||||
g_signal_handler_disconnect(m_widget, id);
|
||||
|
||||
gint result = gtk_dialog_run(GTK_DIALOG(m_widget));
|
||||
gtk_widget_hide(m_widget);
|
||||
if (rc == wxID_OK)
|
||||
DialogToColourData();
|
||||
|
||||
switch (result)
|
||||
{
|
||||
default:
|
||||
wxFAIL_MSG(wxT("unexpected GtkColorSelectionDialog return code"));
|
||||
// fall through
|
||||
|
||||
case GTK_RESPONSE_CANCEL:
|
||||
case GTK_RESPONSE_DELETE_EVENT:
|
||||
case GTK_RESPONSE_CLOSE:
|
||||
return wxID_CANCEL;
|
||||
|
||||
case GTK_RESPONSE_OK:
|
||||
DialogToColourData();
|
||||
return wxID_OK;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
void wxColourDialog::ColourDataToDialog()
|
||||
|
Loading…
Reference in New Issue
Block a user