]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/dialog.cpp
Add some "USE" defs that were missing.
[wxWidgets.git] / src / gtk / dialog.cpp
index 8739c60b354c52becae8a11fc73ef2d44a42f8fc..6da4337b2e8e3060bc62ded2f4860e4b4605024b 100644 (file)
 #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 <gdk/gdk.h>
+#include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
+
+#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") );