]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/mdi.cpp
Made wxDataViewCtrl sample use a real, expandabl data tree
[wxWidgets.git] / src / gtk / mdi.cpp
index 51027b628d81651dd13e737f865ea77892172982..7c384c2d54e10cbaeead5e0915181e5aed89f1ae 100644 (file)
@@ -292,6 +292,18 @@ void wxMDIParentFrame::ActivatePrevious()
       gtk_notebook_prev_page( GTK_NOTEBOOK(m_clientWindow->m_widget) );
 }
 
+bool wxMDIParentFrame::HasVisibleMenubar() const
+{
+    if (wxFrame::HasVisibleMenubar())
+        return true;
+
+    wxMDIChildFrame* active_child_frame = GetActiveChild();
+    wxMenuBar* menubar = NULL;
+    if (active_child_frame)
+        menubar = active_child_frame->m_menuBar;
+    return menubar && menubar->IsShown();
+}
+
 //-----------------------------------------------------------------------------
 // wxMDIChildFrame
 //-----------------------------------------------------------------------------
@@ -424,7 +436,7 @@ void wxMDIChildFrame::SetTitle( const wxString &title )
 //-----------------------------------------------------------------------------
 
 extern "C" {
-static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxWindow *win )
+static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxMDIChildFrame *win )
 {
     if ((win->m_x == alloc->x) &&
         (win->m_y == alloc->y) &&
@@ -443,9 +455,10 @@ static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
 // InsertChild callback for wxMDIClientWindow
 //-----------------------------------------------------------------------------
 
-static void wxInsertChildInMDI( wxMDIClientWindow* parent, wxMDIChildFrame* child )
+static void wxInsertChildInMDI(wxWindow* parent, wxWindow* child)
 {
-    wxString s = child->GetTitle();
+    wxMDIChildFrame* child_frame = wx_static_cast(wxMDIChildFrame*, child);
+    wxString s = child_frame->GetTitle();
     if (s.IsNull()) s = _("MDI child");
 
     GtkWidget *label_widget = gtk_label_new( s.mbc_str() );
@@ -458,9 +471,9 @@ static void wxInsertChildInMDI( wxMDIClientWindow* parent, wxMDIChildFrame* chil
 
     gtk_notebook_append_page( notebook, child->m_widget, label_widget );
 
-    child->m_page = (GtkNotebookPage*) (g_list_last(notebook->children)->data);
+    child_frame->m_page = (GtkNotebookPage*) (g_list_last(notebook->children)->data);
 
-    wxMDIParentFrame *parent_frame = (wxMDIParentFrame*) parent->GetParent();
+    wxMDIParentFrame *parent_frame = wx_static_cast(wxMDIParentFrame*, parent->GetParent());
     parent_frame->m_justInserted = true;
 }
 
@@ -486,7 +499,7 @@ wxMDIClientWindow::~wxMDIClientWindow()
 
 bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style )
 {
-    m_insertCallback = (wxInsertChildFunction)wxInsertChildInMDI;
+    m_insertCallback = wxInsertChildInMDI;
 
     if (!PreCreation( parent, wxDefaultPosition, wxDefaultSize ) ||
         !CreateBase( parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, style, wxDefaultValidator, wxT("wxMDIClientWindow") ))