]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/frame.cpp
moved wxDash typedef to gdicmn.h
[wxWidgets.git] / src / gtk / frame.cpp
index cf54c400dbe85b16d2ee619672f930d92f919baf..c20496ef80773680808539d03abdf10bf9bd7999 100644 (file)
@@ -139,7 +139,7 @@ static gint gtk_frame_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WX
     if (g_isIdle)
         wxapp_install_idle_handler();
 
-    if (g_openDialogs == 0)
+    if ((g_openDialogs == 0) && (win->IsEnabled()))
         win->Close();
 
     return TRUE;
@@ -834,6 +834,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y),
         gtk_pizza_set_size( GTK_PIZZA(m_wxwindow),
                             m_frameStatusBar->m_widget,
                             xx, yy, ww, hh );
+        gtk_widget_draw( m_frameStatusBar->m_widget, (GdkRectangle*) NULL );
     }
 #endif
 
@@ -898,33 +899,51 @@ void wxFrame::SetMenuBar( wxMenuBar *menuBar )
     wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
     wxASSERT_MSG( (m_wxwindow != NULL), wxT("invalid frame") );
 
+    if (menuBar == m_frameMenuBar)
+        return;
+
+    if (m_frameMenuBar)
+    {
+        m_frameMenuBar->UnsetInvokingWindow( this );
+
+        if (m_frameMenuBar->GetWindowStyle() & wxMB_DOCKABLE)
+        {
+            gtk_signal_disconnect_by_func( GTK_OBJECT(m_frameMenuBar->m_widget),
+                GTK_SIGNAL_FUNC(gtk_menu_attached_callback), (gpointer)this );
+
+            gtk_signal_disconnect_by_func( GTK_OBJECT(m_frameMenuBar->m_widget),
+                GTK_SIGNAL_FUNC(gtk_menu_detached_callback), (gpointer)this );
+        }
+        
+        gtk_container_remove( GTK_CONTAINER(m_mainWidget), m_frameMenuBar->m_widget );
+        gtk_widget_ref( m_frameMenuBar->m_widget );
+        gtk_widget_unparent( m_frameMenuBar->m_widget );
+    }
+
     m_frameMenuBar = menuBar;
 
     if (m_frameMenuBar)
     {
         m_frameMenuBar->SetInvokingWindow( this );
 
-        if (m_frameMenuBar->GetParent() != this)
-        {
-            m_frameMenuBar->SetParent(this);
-            gtk_pizza_put( GTK_PIZZA(m_mainWidget),
+        m_frameMenuBar->SetParent(this);
+        gtk_pizza_put( GTK_PIZZA(m_mainWidget),
                 m_frameMenuBar->m_widget,
                 m_frameMenuBar->m_x,
                 m_frameMenuBar->m_y,
                 m_frameMenuBar->m_width,
                 m_frameMenuBar->m_height );
 
-            if (menuBar->GetWindowStyle() & wxMB_DOCKABLE)
-            {
-                gtk_signal_connect( GTK_OBJECT(menuBar->m_widget), "child_attached",
-                    GTK_SIGNAL_FUNC(gtk_menu_attached_callback), (gpointer)this );
-
-                gtk_signal_connect( GTK_OBJECT(menuBar->m_widget), "child_detached",
-                    GTK_SIGNAL_FUNC(gtk_menu_detached_callback), (gpointer)this );
-            }
+        if (menuBar->GetWindowStyle() & wxMB_DOCKABLE)
+        {
+            gtk_signal_connect( GTK_OBJECT(menuBar->m_widget), "child_attached",
+                GTK_SIGNAL_FUNC(gtk_menu_attached_callback), (gpointer)this );
 
-            m_frameMenuBar->Show( TRUE );
+            gtk_signal_connect( GTK_OBJECT(menuBar->m_widget), "child_detached",
+                GTK_SIGNAL_FUNC(gtk_menu_detached_callback), (gpointer)this );
         }
+
+        m_frameMenuBar->Show( TRUE );
     }
 
     /* resize window in OnInternalIdle */