X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2d68e1b4f42c2c021a2a45bd9ea385153fbcbbf4..f21a7f94fc140318308cc1c5bc1d63ea2b4c62c7:/src/gtk/dialog.cpp?ds=sidebyside diff --git a/src/gtk/dialog.cpp b/src/gtk/dialog.cpp index 8739c60b35..6da4337b2e 100644 --- a/src/gtk/dialog.cpp +++ b/src/gtk/dialog.cpp @@ -14,16 +14,13 @@ #include "wx/dialog.h" #include "wx/frame.h" #include "wx/app.h" - -#include "gdk/gdk.h" -#include "gtk/gtk.h" -#include "wx/gtk/win_gtk.h" #include "wx/cursor.h" -/* -#include "gdk/gdkprivate.h" -#include "gdk/gdkx.h" -*/ +#include +#include +#include + +#include "wx/gtk/win_gtk.h" //----------------------------------------------------------------------------- // idle system @@ -39,6 +36,20 @@ extern int g_openDialogs; extern wxList wxPendingDelete; +//----------------------------------------------------------------------------- +// "focus" from m_window +//----------------------------------------------------------------------------- + +static gint gtk_dialog_focus_callback( GtkWidget *widget, GtkDirectionType WXUNUSED(d), wxWindow *WXUNUSED(win) ) +{ + if (g_isIdle) + wxapp_install_idle_handler(); + + // This disables GTK's tab traversal + gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus" ); + return TRUE; +} + //----------------------------------------------------------------------------- // "delete_event" //----------------------------------------------------------------------------- @@ -268,6 +279,9 @@ bool wxDialog::Create( wxWindow *parent, return FALSE; } + // All dialogs should really have this style + m_windowStyle |= wxTAB_TRAVERSAL; + m_insertCallback = (wxInsertChildFunction) wxInsertChildInDialog; m_widget = gtk_window_new( GTK_WINDOW_DIALOG ); @@ -307,6 +321,10 @@ bool wxDialog::Create( wxWindow *parent, gtk_signal_connect( GTK_OBJECT(m_widget), "configure_event", GTK_SIGNAL_FUNC(gtk_dialog_configure_callback), (gpointer)this ); + /* disable native tab traversal */ + gtk_signal_connect( GTK_OBJECT(m_widget), "focus", + GTK_SIGNAL_FUNC(gtk_dialog_focus_callback), (gpointer)this ); + return TRUE; } @@ -321,7 +339,8 @@ wxDialog::~wxDialog() wxTheApp->SetTopWindow( (wxWindow*) NULL ); } - if (wxTopLevelWindows.Number() == 0) + if ((wxTopLevelWindows.Number() == 0) && + (wxTheApp->GetExitOnFrameDelete())) { wxTheApp->ExitMainLoop(); } @@ -451,6 +470,11 @@ void wxDialog::OnSize( wxSizeEvent &WXUNUSED(event) ) } } +void wxDialog::DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(width), int WXUNUSED(height) ) +{ + wxFAIL_MSG( wxT("DoMoveWindow called for wxDialog") ); +} + void wxDialog::DoSetSize( int x, int y, int width, int height, int sizeFlags ) { wxASSERT_MSG( (m_widget != NULL), wxT("invalid dialog") );