X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0367c1c0e82c6da38cea16c4bcef6583271789cc..c20da25748db95da19364dc118efcb9cc41bacc2:/src/os2/frame.cpp diff --git a/src/os2/frame.cpp b/src/os2/frame.cpp index a3b3f82dd0..b7a9a6729b 100644 --- a/src/os2/frame.cpp +++ b/src/os2/frame.cpp @@ -53,10 +53,13 @@ extern wxWindowList wxModelessWindows; extern wxList WXDLLEXPORT wxPendingDelete; extern wxChar wxFrameClassName[]; + +#if wxUSE_MENUS_NATIVE extern wxMenu *wxCurrentPopupMenu; +#endif -extern void wxAssociateWinWithHandle( HWND hWnd - ,wxWindow* pWin +extern void wxAssociateWinWithHandle( HWND hWnd + ,wxWindowOS2* pWin ); // ---------------------------------------------------------------------------- @@ -68,10 +71,8 @@ BEGIN_EVENT_TABLE(wxFrameOS2, wxFrameBase) EVT_SYS_COLOUR_CHANGED(wxFrameOS2::OnSysColourChanged) END_EVENT_TABLE() -IMPLEMENT_DYNAMIC_CLASS(wxFrameOS2, wxWindow) - #ifndef __WXUNIVERSAL__ -IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxFrameMSW) +IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow) #endif // ============================================================================ @@ -555,6 +556,7 @@ void wxFrameOS2::PositionStatusBar() } // end of wxFrameOS2::PositionStatusBar #endif // wxUSE_STATUSBAR +#if wxUSE_MENUS_NATIVE void wxFrameOS2::DetachMenuBar() { if (m_frameMenuBar) @@ -617,6 +619,45 @@ void wxFrameOS2::SetMenuBar( } } // end of wxFrameOS2::SetMenuBar +void wxFrameOS2::AttachMenuBar( + wxMenuBar* pMenubar +) +{ + wxFrameBase::AttachMenuBar(pMenubar); + + m_frameMenuBar = pMenubar; + + if (!pMenubar) + { + // + // Actually remove the menu from the frame + // + m_hMenu = (WXHMENU)0; + InternalSetMenuBar(); + } + else // Set new non NULL menu bar + { + // + // Can set a menubar several times. + // + if (pMenubar->GetHMenu()) + { + m_hMenu = pMenubar->GetHMenu(); + } + else + { + if (pMenubar->IsAttached()) + pMenubar->Detach(); + + m_hMenu = pMenubar->Create(); + + if (!m_hMenu) + return; + } + InternalSetMenuBar(); + } +} // end of wxFrameOS2::AttachMenuBar + void wxFrameOS2::InternalSetMenuBar() { ERRORID vError; @@ -639,6 +680,7 @@ void wxFrameOS2::InternalSetMenuBar() } ::WinSendMsg(m_hFrame, WM_UPDATEFRAME, (MPARAM)FCF_MENU, (MPARAM)0); } // end of wxFrameOS2::InternalSetMenuBar +#endif // wxUSE_MENUS_NATIVE // // Responds to colour changes, and passes event on to children @@ -681,11 +723,11 @@ bool wxFrameOS2::ShowFullScreen( m_lFsStyle = lStyle; #if wxUSE_TOOLBAR - wxToolBar* pTheToolBar = GetToolBar(); + wxToolBar* pTheToolBar = GetToolBar(); #endif //wxUSE_TOOLBAR #if wxUSE_STATUSBAR - wxStatusBar* pTheStatusBar = GetStatusBar(); + wxStatusBar* pTheStatusBar = GetStatusBar(); #endif //wxUSE_STATUSBAR int nDummyWidth; @@ -1258,10 +1300,10 @@ bool wxFrameOS2::OS2TranslateMessage( // wxMenuBar* pMenuBar = GetMenuBar(); - if (!pMenuBar ) + if (!pMenuBar) return FALSE; -#if wxUSE_ACCEL +#if wxUSE_ACCEL && wxUSE_MENUS_NATIVE const wxAcceleratorTable& rAcceleratorTable = pMenuBar->GetAccelTable(); return rAcceleratorTable.Translate(GetHWND(), pMsg); #else @@ -1434,6 +1476,7 @@ bool wxFrameOS2::HandleCommand( // if (nCmd == CMDSRC_MENU || nCmd == CMDSRC_ACCELERATOR) { +#if wxUSE_MENUS_NATIVE if (wxCurrentPopupMenu) { wxMenu* pPopupMenu = wxCurrentPopupMenu; @@ -1443,7 +1486,9 @@ bool wxFrameOS2::HandleCommand( return pPopupMenu->OS2Command( nCmd ,nId ); + return TRUE; } +#endif if (ProcessCommand(nId)) {