]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/dialog.cpp
wxMimeTypesManagerImpl::GetFileTypeFromMimeType() implemented
[wxWidgets.git] / src / gtk1 / dialog.cpp
index 0e26ee1808b0eab91ca9751f4d7ba3a6ccfb3660..f4a3d741444a46eca16280bd438c9ebcf4af9ac9 100644 (file)
@@ -14,6 +14,9 @@
 #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"
 
 //-----------------------------------------------------------------------------
@@ -131,7 +134,16 @@ bool wxDialog::Create( wxWindow *parent,
 wxDialog::~wxDialog()
 {
     wxTopLevelWindows.DeleteObject( this );
-    if (wxTopLevelWindows.Number() == 0) wxTheApp->ExitMainLoop();
+    
+    if (wxTheApp->GetTopWindow() == this)
+    {
+        wxTheApp->SetTopWindow( (wxWindow*) NULL );
+    }
+    
+    if (wxTopLevelWindows.Number() == 0)
+    {  
+        wxTheApp->ExitMainLoop();
+    }
 }
 
 void wxDialog::SetTitle( const wxString& title )
@@ -245,7 +257,7 @@ void wxDialog::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int heigh
 
 void wxDialog::OnSize( wxSizeEvent &WXUNUSED(event) )
 {
-    wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
+    wxASSERT_MSG( (m_widget != NULL), "invalid dialog" );
   
     if (GetAutoLayout())
     {
@@ -254,14 +266,14 @@ void wxDialog::OnSize( wxSizeEvent &WXUNUSED(event) )
     else 
     {
         // no child: go out !
-        if (!GetChildren()->First()) return;
+        if (!GetChildren().First()) return;
       
         // do we have exactly one child?
         wxWindow *child = (wxWindow *) NULL;
-        for(wxNode *node = GetChildren()->First(); node; node = node->Next())
+        for(wxNode *node = GetChildren().First(); node; node = node->Next())
         {
             wxWindow *win = (wxWindow *)node->Data();
-            if (!IS_KIND_OF(win,wxFrame) && !IS_KIND_OF(win,wxDialog))
+            if (!wxIS_KIND_OF(win,wxFrame) && !wxIS_KIND_OF(win,wxDialog))
             {
                // it's the second one: do nothing
                 if (child) return;