+void wxTopLevelWindowOS2::OnActivate(
+ wxActivateEvent& rEvent
+)
+{
+ if (rEvent.GetActive())
+ {
+ //
+ // Restore focus to the child which was last focused
+ //
+ wxLogTrace(_T("focus"), _T("wxTLW %08lx activated."), m_hWnd);
+
+ wxWindow* pParent = m_pWinLastFocused ? m_pWinLastFocused->GetParent()
+ : NULL;
+ if (!pParent)
+ {
+ pParent = this;
+ }
+
+ wxSetFocusToChild( pParent
+ ,&m_pWinLastFocused
+ );
+ }
+ else // deactivating
+ {
+ //
+ // Remember the last focused child if it is our child
+ //
+ m_pWinLastFocused = FindFocus();
+
+ //
+ // So we NULL it out if it's a child from some other frame
+ //
+ wxWindow* pWin = m_pWinLastFocused;
+
+ while (pWin)
+ {
+ if (pWin->IsTopLevel())
+ {
+ if (pWin != this)
+ {
+ m_pWinLastFocused = NULL;
+ }
+ break;
+ }
+ pWin = pWin->GetParent();
+ }
+
+ wxLogTrace(_T("focus"),
+ _T("wxTLW %08lx deactivated, last focused: %08lx."),
+ m_hWnd,
+ m_pWinLastFocused ? GetHwndOf(m_pWinLastFocused)
+ : NULL);
+ rEvent.Skip();
+ }
+} // end of wxTopLevelWindowOS2::OnActivate
+
+WXDWORD wxTopLevelWindowOS2::OS2GetStyle(
+ long lStyle
+, WXDWORD* pdwExflags