void wxFrame::AttachMenuBar( wxMenuBar *menuBar ) { wxFrameBase::AttachMenuBar(menuBar); if (m_frameMenuBar) { 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 ); } gtk_widget_show( m_frameMenuBar->m_widget ); UpdateMenuBarSize(); } else { m_menuBarHeight = 2; GtkUpdateSize(); // resize window in OnInternalIdle } }
void wxFrame::AttachMenuBar( wxMenuBar *menuBar ) { wxFrameBase::AttachMenuBar(menuBar); if (m_frameMenuBar) { m_frameMenuBar->SetInvokingWindow( this ); 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) { g_signal_connect (menuBar->m_widget, "child_attached", G_CALLBACK (gtk_menu_attached_callback), this); g_signal_connect (menuBar->m_widget, "child_detached", G_CALLBACK (gtk_menu_detached_callback), this); } gtk_widget_show( m_frameMenuBar->m_widget ); UpdateMenuBarSize(); g_signal_connect(menuBar->m_widget, "style-set", G_CALLBACK(menubar_style_set), this); } else { m_menuBarHeight = 2; GtkUpdateSize(); // resize window in OnInternalIdle } }
void wxFrame::OnInternalIdle() { wxFrameBase::OnInternalIdle(); #if wxUSE_MENUS_NATIVE if (m_frameMenuBar) m_frameMenuBar->OnInternalIdle(); // UpdateMenuBarSize may return a height of zero on some // systems (e.g. Ubuntu 11.04 Alpha as of 2010-12-06), // when the menubar widget has not been fully realized. // Update the menu bar size again at this point, otherwise // the menu would not be visible at all. if (!m_menuBarHeight) { UpdateMenuBarSize(); } #endif // wxUSE_MENUS_NATIVE #if wxUSE_TOOLBAR if (m_frameToolBar) m_frameToolBar->OnInternalIdle(); #endif #if wxUSE_STATUSBAR if (m_frameStatusBar) { m_frameStatusBar->OnInternalIdle(); // There may be controls in the status bar that // need to be updated for ( wxWindowList::compatibility_iterator node = m_frameStatusBar->GetChildren().GetFirst(); node; node = node->GetNext() ) { wxWindow *child = node->GetData(); child->OnInternalIdle(); } } #endif }