X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8febdd39057cf2b4984561cc2f55acc9a0d07aca..236a9de39afa090fdee3cf91cb5364ceca69e3f8:/src/gtk/frame.cpp diff --git a/src/gtk/frame.cpp b/src/gtk/frame.cpp index cf54c400db..c20496ef80 100644 --- a/src/gtk/frame.cpp +++ b/src/gtk/frame.cpp @@ -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 */