]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/mdi.cpp
TRUE/FALSE/etc. cleanup in the *.in files, regenerated the .h and .cpp
[wxWidgets.git] / src / gtk1 / mdi.cpp
index 08f0a4e5dbafff31b66425a355324f88015c511c..131cee85cb10060bb0bc628b18544113e2b7acb0 100644 (file)
@@ -7,13 +7,17 @@
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
 #pragma implementation "mdi.h"
 #endif
 
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
 #include "wx/mdi.h"
+#include "wx/notebook.h"
 
-#if wxUSE_MDI_ARCHITECTURE
+#if wxUSE_MDI
 
 #include "wx/dialog.h"
 #include "wx/menu.h"
@@ -75,12 +79,15 @@ gtk_mdi_page_change_callback( GtkNotebook *WXUNUSED(widget),
 
     child = (wxMDIChildFrame*) NULL;
 
-    wxWindowList::Node  *node = client_window->GetChildren().GetFirst();
+    wxWindowList::compatibility_iterator node = client_window->GetChildren().GetFirst();
     while (node)
     {
         wxMDIChildFrame *child_frame = wxDynamicCast( node->GetData(), wxMDIChildFrame );
-
-        wxASSERT_MSG( child_frame, _T("child is not a wxMDIChildFrame") );
+        // CE: we come here in the destructor with a null child_frame - I think because
+        // gtk_signal_connect( GTK_OBJECT(m_widget), "switch_page", (see below)
+        // isn't deleted early enough
+        if (!child_frame)
+          return ;
 
         if (child_frame->m_page == page)
         {
@@ -161,6 +168,16 @@ void wxMDIParentFrame::OnInternalIdle()
         GtkNotebook *notebook = GTK_NOTEBOOK(m_clientWindow->m_widget);
         gtk_notebook_set_page( notebook, g_list_length( notebook->children ) - 1 );
 
+    /* need to set the menubar of the child */
+        wxMDIChildFrame *active_child_frame = GetActiveChild();
+        wxMenuBar *menu_bar = active_child_frame->m_menuBar;
+        menu_bar->m_width = m_width;
+        menu_bar->m_height = wxMENU_HEIGHT;
+        gtk_pizza_set_size( GTK_PIZZA(m_mainWidget),
+                            menu_bar->m_widget,
+                            0, 0, m_width, wxMENU_HEIGHT );
+        menu_bar->SetInvokingWindow(active_child_frame);
+
         m_justInserted = false;
         return;
     }
@@ -170,7 +187,7 @@ void wxMDIParentFrame::OnInternalIdle()
     wxMDIChildFrame *active_child_frame = GetActiveChild();
     bool visible_child_menu = false;
 
-    wxWindowList::Node     *node = m_clientWindow->GetChildren().GetFirst();
+    wxWindowList::compatibility_iterator node = m_clientWindow->GetChildren().GetFirst();
     while (node)
     {
         wxMDIChildFrame *child_frame = wxDynamicCast( node->GetData(), wxMDIChildFrame );
@@ -247,7 +264,7 @@ wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
     GtkNotebookPage* page = (GtkNotebookPage*) (g_list_nth(notebook->children,i)->data);
     if (!page) return (wxMDIChildFrame*) NULL;
 
-    wxWindowList::Node  *node = m_clientWindow->GetChildren().GetFirst();
+    wxWindowList::compatibility_iterator node = m_clientWindow->GetChildren().GetFirst();
     while (node)
     {
         wxMDIChildFrame *child_frame = wxDynamicCast( node->GetData(), wxMDIChildFrame );
@@ -316,7 +333,7 @@ wxMDIChildFrame::~wxMDIChildFrame()
 {
     if (m_menuBar)
         delete m_menuBar;
-}
+} 
 
 bool wxMDIChildFrame::Create( wxMDIParentFrame *parent,
       wxWindowID id, const wxString& title,
@@ -471,6 +488,7 @@ wxMDIClientWindow::wxMDIClientWindow( wxMDIParentFrame *parent, long style )
 
 wxMDIClientWindow::~wxMDIClientWindow()
 {
+
 }
 
 bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style )