X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8d854fa93f8f5a48e383395060063a7931bf0207..38755449339718307f594d0c92f7d37ce56c908c:/src/os2/frame.cpp?ds=sidebyside diff --git a/src/os2/frame.cpp b/src/os2/frame.cpp index 9fd9d2423e..2921ea42dc 100644 --- a/src/os2/frame.cpp +++ b/src/os2/frame.cpp @@ -243,6 +243,18 @@ void wxFrame::DoGetClientSize( { RECTL vRect; ::WinQueryWindowRect(GetHwnd(), &vRect); +#if wxUSE_STATUSBAR + if ( GetStatusBar() && GetStatusBar()->IsShown() ) + { + int nStatusX + int nStatusY; + + GetStatusBar()->GetClientSize( &nStatusX + ,&nStatusY + ); + vRect.yBottom += nStatusY; + } +#endif // wxUSE_STATUSBAR if (pX) *pX = vRect.xRight - vRect.xLeft; if (pY) @@ -1030,10 +1042,10 @@ bool wxFrame::OS2Create( // if (!::WinSetWindowPos( m_hWnd ,HWND_TOP - ,nX + 20 - ,nY + 20 - ,nWidth - 60 - ,nHeight - 60 + ,nX // + 20 + ,nY // + 20 + ,nWidth // - 60 + ,nHeight // - 60 ,SWP_SIZE | SWP_MOVE | SWP_ACTIVATE | SWP_ZORDER )) { @@ -1053,27 +1065,51 @@ void wxFrame::OnActivate( wxActivateEvent& rEvent ) { - for (wxWindowList::Node* pNode = GetChildren().GetFirst(); - pNode; - pNode = pNode->GetNext()) + if ( rEvent.GetActive() ) { - // FIXME all this is totally bogus - we need to do the same as wxPanel, - // but how to do it without duplicating the code? + // restore focus to the child which was last focused + wxLogTrace(_T("focus"), _T("wxFrame %08x activated."), m_hWnd); - // restore focus - wxWindow* pChild = pNode->GetData(); + wxWindow* pParent = m_pWinLastFocused ? m_pWinLastFocused->GetParent() + : NULL; + if (!pParent) + { + pParent = this; + } - if (!pChild->IsTopLevel() + wxSetFocusToChild( pParent + ,&m_pWinLastFocused + ); + } + else // deactivating + { + // + // Remember the last focused child if it is our child + // + m_pWinLastFocused = FindFocus(); + + 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? + + // 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