-//
-// Default activation behaviour - set the focus for the first child
-// subwindow found.
-//
-void wxFrame::OnActivate(
- wxActivateEvent& rEvent
-)
-{
- 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
- {
- //
- // 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)
-#endif // wxUSE_TOOLBAR
-#if wxUSE_STATUSBAR
- && !wxDynamicCast(pChild, wxStatusBar)
-#endif // wxUSE_STATUSBAR
- )
- {
- pChild->SetFocus();
- return;
- }
- }
- }
-} // end of wxFrame::OnActivate
-