X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5fb9d2be3f3092f3340616bc4aba020c43d10e71..fe35d097d6618b4a15cafcfc40b33b757d620e49:/src/os2/frame.cpp?ds=inline diff --git a/src/os2/frame.cpp b/src/os2/frame.cpp index dbc1e6be98..e948ffeaf3 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 ); // ---------------------------------------------------------------------------- @@ -341,15 +344,9 @@ void wxFrame::DoGetPosition( POINTL vPoint; ::WinQueryWindowRect(m_hFrame, &vRect); - vPoint.x = vRect.xLeft; - - // - // OS/2 is backwards [WIN32 it is vRect.yTop] - // - vPoint.y = vRect.yBottom; - *pX = vPoint.x; - *pY = vPoint.y; + *pX = vRect.xRight - vRect.xLeft; + *pY = vRect.yTop - vRect.yBottom; } // end of wxFrame::DoGetPosition // ---------------------------------------------------------------------------- @@ -557,6 +554,7 @@ void wxFrame::PositionStatusBar() } // end of wxFrame::PositionStatusBar #endif // wxUSE_STATUSBAR +#if wxUSE_MENUS_NATIVE void wxFrame::DetachMenuBar() { if (m_frameMenuBar) @@ -615,10 +613,49 @@ void wxFrame::SetMenuBar( } InternalSetMenuBar(); m_frameMenuBar = pMenuBar; - pMenuBar->Attach(this); + pMenuBar->Attach((wxFrame*)this); } } // end of wxFrame::SetMenuBar +void wxFrame::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 wxFrame::AttachMenuBar + void wxFrame::InternalSetMenuBar() { ERRORID vError; @@ -641,6 +678,7 @@ void wxFrame::InternalSetMenuBar() } ::WinSendMsg(m_hFrame, WM_UPDATEFRAME, (MPARAM)FCF_MENU, (MPARAM)0); } // end of wxFrame::InternalSetMenuBar +#endif // wxUSE_MENUS_NATIVE // // Responds to colour changes, and passes event on to children @@ -683,11 +721,11 @@ bool wxFrame::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; @@ -1260,10 +1298,10 @@ bool wxFrame::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 @@ -1356,6 +1394,7 @@ bool wxFrame::HandleSize( // restore all child frames too // IconizeChildFrames(FALSE); + (void)SendIconizeEvent(FALSE); // // fall through @@ -1370,6 +1409,7 @@ bool wxFrame::HandleSize( // Iconize all child frames too // IconizeChildFrames(TRUE); + (void)SendIconizeEvent(); m_bIconized = TRUE; break; } @@ -1434,6 +1474,7 @@ bool wxFrame::HandleCommand( // if (nCmd == CMDSRC_MENU || nCmd == CMDSRC_ACCELERATOR) { +#if wxUSE_MENUS_NATIVE if (wxCurrentPopupMenu) { wxMenu* pPopupMenu = wxCurrentPopupMenu; @@ -1443,7 +1484,9 @@ bool wxFrame::HandleCommand( return pPopupMenu->OS2Command( nCmd ,nId ); + return TRUE; } +#endif if (ProcessCommand(nId)) {