}
//-----------------------------------------------------------------------------
-// page change callback
+// "switch_page"
//-----------------------------------------------------------------------------
static void gtk_page_change_callback( GtkNotebook *WXUNUSED(widget),
if (m_mdiMenuBar)
{
- m_mdiMenuBar->m_x = 0;
+ m_mdiMenuBar->m_x = 0;
m_mdiMenuBar->m_y = 0;
m_mdiMenuBar->m_width = m_width;
m_mdiMenuBar->m_height = wxMENU_HEIGHT;
void wxMDIParentFrame::SetMDIMenuBar( wxMenuBar *menu_bar )
{
+ /* hide old child menu bar */
if (m_mdiMenuBar) m_mdiMenuBar->Show( FALSE );
+
m_mdiMenuBar = menu_bar;
+
+ /* show and resize new menu child menu bar */
if (m_mdiMenuBar)
{
- m_mdiMenuBar->m_x = 0;
+ m_mdiMenuBar->m_x = 0;
m_mdiMenuBar->m_y = 0;
m_mdiMenuBar->m_width = m_width;
m_mdiMenuBar->m_height = wxMENU_HEIGHT;
gtk_widget_set_usize( m_mdiMenuBar->m_widget, m_width, wxMENU_HEIGHT );
m_mdiMenuBar->Show( TRUE );
}
+
+ /* show/hide parent menu bar as required */
+ if (m_frameMenuBar) m_frameMenuBar->Show( (m_mdiMenuBar == NULL) );
}
void wxMDIParentFrame::GetClientSize(int *width, int *height ) const
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame,wxFrame)
-
+
BEGIN_EVENT_TABLE(wxMDIChildFrame, wxFrame)
EVT_ACTIVATE(wxMDIChildFrame::OnActivate)
END_EVENT_TABLE()
long style, const wxString& name )
{
m_title = title;
-
+
return wxWindow::Create( parent->GetClientWindow(), id, wxDefaultPosition, size, style, name );
}
{
wxWindow::AddChild( child );
}
-
+
static void SetInvokingWindow( wxMenu *menu, wxWindow *win )
{
menu->SetInvokingWindow( win );
- wxNode *node = menu->m_items.First();
+ wxNode *node = menu->GetItems().First();
while (node)
{
wxMenuItem *menuitem = (wxMenuItem*)node->Data();
if (m_menuBar->m_parent != this)
{
- wxNode *node = m_menuBar->m_menus.First();
+ wxNode *node = m_menuBar->GetMenus().First();
while (node)
{
wxMenu *menu = (wxMenu*)node->Data();
m_menuBar->m_parent = mdi_frame;
}
- mdi_frame->SetMDIMenuBar( m_menuBar );
gtk_myfixed_put( GTK_MYFIXED(mdi_frame->m_wxwindow),
m_menuBar->m_widget, m_menuBar->m_x, m_menuBar->m_y );
+
+ mdi_frame->SetMDIMenuBar( m_menuBar );
}
}
-wxMenuBar *wxMDIChildFrame::GetMenuBar()
+wxMenuBar *wxMDIChildFrame::GetMenuBar() const
{
return m_menuBar;
}
gtk_signal_connect( GTK_OBJECT(child->m_widget), "size_allocate",
GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)child );
-
+
GtkNotebook *notebook = GTK_NOTEBOOK(parent->m_widget);
-
+
gtk_notebook_append_page( notebook, child->m_widget, label_widget );
child->m_page = (GtkNotebookPage*) (g_list_last(notebook->children)->data);
gtk_notebook_set_page( notebook, parent->m_children.Number()-1 );
-
+
gtk_page_change_callback( (GtkNotebook *) NULL, child->m_page, 0, parent );
}
bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style )
{
m_needParent = TRUE;
-
+
m_insertCallback = (wxInsertChildFunction)wxInsertChildInMDI;
PreCreation( parent, -1, wxPoint(10,10), wxSize(100,100), style, "wxMDIClientWindow" );
m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this );
-
+
PostCreation();
Show( TRUE );