X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fb83aca503d1d34532288b73fe85b9857a677e88..4b7b750dd1ffd0d26b78728adb613b282a37c058:/src/os2/frame.cpp diff --git a/src/os2/frame.cpp b/src/os2/frame.cpp index 18fc488fd0..838197f4d4 100644 --- a/src/os2/frame.cpp +++ b/src/os2/frame.cpp @@ -243,6 +243,13 @@ void wxFrame::DoGetClientSize( { RECTL vRect; ::WinQueryWindowRect(GetHwnd(), &vRect); + + // + // No need to use statusbar code as in WIN32 as the FORMATFRAME + // window procedure ensures PM knows about the new frame client + // size internally. A ::WinQueryWindowRect is all that is needed! + // + if (pX) *pX = vRect.xRight - vRect.xLeft; if (pY) @@ -334,15 +341,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 // ---------------------------------------------------------------------------- @@ -1053,27 +1054,51 @@ void wxFrame::OnActivate( wxActivateEvent& rEvent ) { - for (wxWindowList::Node* pNode = GetChildren().GetFirst(); - pNode; - pNode = pNode->GetNext()) + if ( rEvent.GetActive() ) + { + // restore focus to the child which was last focused + wxLogTrace(_T("focus"), _T("wxFrame %08x activated."), m_hWnd); + + wxWindow* pParent = m_pWinLastFocused ? m_pWinLastFocused->GetParent() + : NULL; + if (!pParent) + { + pParent = this; + } + + wxSetFocusToChild( pParent + ,&m_pWinLastFocused + ); + } + else // deactivating { - // FIXME all this is totally bogus - we need to do the same as wxPanel, - // but how to do it without duplicating the code? + // + // Remember the last focused child if it is our child + // + m_pWinLastFocused = FindFocus(); - // restore focus - wxWindow* pChild = pNode->GetData(); + for (wxWindowList::Node* pNode = GetChildren().GetFirst(); + pNode; + pNode = pNode->GetNext()) + { + // FIXME all this is totally bogus - we need to do the same as wxPanel, + // but how to do it without duplicating the code? - if (!pChild->IsTopLevel() + // restore focus + wxWindow* pChild = pNode->GetData(); + + if (!pChild->IsTopLevel() #if wxUSE_TOOLBAR - && !wxDynamicCast(pChild, wxToolBar) + && !wxDynamicCast(pChild, wxToolBar) #endif // wxUSE_TOOLBAR #if wxUSE_STATUSBAR - && !wxDynamicCast(pChild, wxStatusBar) + && !wxDynamicCast(pChild, wxStatusBar) #endif // wxUSE_STATUSBAR - ) - { - pChild->SetFocus(); - return; + ) + { + pChild->SetFocus(); + return; + } } } } // end of wxFrame::OnActivate @@ -1156,12 +1181,12 @@ void wxFrame::PositionToolBar() } #endif // wxUSE_STATUSBAR - if ( GetToolBar() ) + if ( m_frameToolBar ) { int nToolbarWidth; int nToolbarHeight; - GetToolBar()->GetSize( &nToolbarWidth + m_frameToolBar->GetSize( &nToolbarWidth ,&nToolbarHeight ); @@ -1325,6 +1350,7 @@ bool wxFrame::HandleSize( // restore all child frames too // IconizeChildFrames(FALSE); + (void)SendIconizeEvent(FALSE); // // fall through @@ -1339,6 +1365,7 @@ bool wxFrame::HandleSize( // Iconize all child frames too // IconizeChildFrames(TRUE); + (void)SendIconizeEvent(); m_bIconized = TRUE; break; }