X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0c39421228d4a84c8d0f9b61b0428c0b0302efbe..acc0ebd7a871124d4d6b36069340227e6c584f38:/src/gtk/frame.cpp?ds=sidebyside diff --git a/src/gtk/frame.cpp b/src/gtk/frame.cpp index 65ac5783e4..fb364d258e 100644 --- a/src/gtk/frame.cpp +++ b/src/gtk/frame.cpp @@ -65,11 +65,8 @@ extern int g_openDialogs; // event tables // ---------------------------------------------------------------------------- -#ifdef __WXUNIVERSAL__ - IMPLEMENT_DYNAMIC_CLASS(wxFrameGTK, wxWindow) -#else - IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxFrameGTK) - IMPLEMENT_DYNAMIC_CLASS(wxFrameGTK, wxWindow) +#ifndef __WXUNIVERSAL__ + IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow) #endif // ---------------------------------------------------------------------------- @@ -156,7 +153,8 @@ static gint gtk_frame_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WX return TRUE; } -#if wxUSE_MENUS +#if wxUSE_MENUS_NATIVE + //----------------------------------------------------------------------------- // "child_attached" of menu bar //----------------------------------------------------------------------------- @@ -180,7 +178,8 @@ static void gtk_menu_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget * win->m_menuBarDetached = TRUE; win->GtkUpdateSize(); } -#endif // wxUSE_MENUS + +#endif // wxUSE_MENUS_NATIVE #if wxUSE_TOOLBAR //----------------------------------------------------------------------------- @@ -1053,17 +1052,14 @@ void wxFrameGTK::OnInternalIdle() // menu/tool/status bar stuff // ---------------------------------------------------------------------------- -#if wxUSE_MENUS +#if wxUSE_MENUS_NATIVE -void wxFrameGTK::SetMenuBar( wxMenuBar *menuBar ) +void wxFrameGTK::DetachMenuBar() { wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") ); wxASSERT_MSG( (m_wxwindow != NULL), wxT("invalid frame") ); - if (menuBar == m_frameMenuBar) - return; - - if (m_frameMenuBar) + if ( m_frameMenuBar ) { m_frameMenuBar->UnsetInvokingWindow( this ); @@ -1081,7 +1077,12 @@ void wxFrameGTK::SetMenuBar( wxMenuBar *menuBar ) gtk_widget_unparent( m_frameMenuBar->m_widget ); } - m_frameMenuBar = menuBar; + wxFrameBase::DetachMenuBar(); +} + +void wxFrameGTK::AttachMenuBar( wxMenuBar *menuBar ) +{ + wxFrameBase::AttachMenuBar(menuBar); if (m_frameMenuBar) { @@ -1111,7 +1112,7 @@ void wxFrameGTK::SetMenuBar( wxMenuBar *menuBar ) m_sizeSet = FALSE; } -#endif // wxUSE_MENUS +#endif // wxUSE_MENUS_NATIVE #if wxUSE_TOOLBAR @@ -1231,9 +1232,14 @@ void wxFrameGTK::Iconize( bool iconize ) { if (iconize) { - XIconifyWindow( GDK_WINDOW_XDISPLAY( m_widget->window ), - GDK_WINDOW_XWINDOW( m_widget->window ), - DefaultScreen( GDK_DISPLAY() ) ); + GdkWindow *window = m_widget->window; + + // you should do it later, for example from OnCreate() handler + wxCHECK_RET( window, _T("frame not created yet - can't iconize") ); + + XIconifyWindow( GDK_WINDOW_XDISPLAY( window ), + GDK_WINDOW_XWINDOW( window ), + DefaultScreen( GDK_DISPLAY() ) ); } }