+ wxMDIParentFrame *parent = GetMDIParent();
+
+ HMENU menuToSet = 0;
+
+ bool activated;
+
+ if ( m_hWnd == hwndAct )
+ {
+ activated = true;
+ parent->m_currentChild = this;
+
+ HMENU child_menu = (HMENU)GetWinMenu();
+ if ( child_menu )
+ {
+ parent->m_parentFrameActive = false;
+
+ menuToSet = child_menu;
+ }
+ }
+ else if ( m_hWnd == hwndDeact )
+ {
+ wxASSERT_MSG( parent->m_currentChild == this,
+ wxT("can't deactivate MDI child which wasn't active!") );
+
+ activated = false;
+ parent->m_currentChild = NULL;
+
+ HMENU parent_menu = (HMENU)parent->GetWinMenu();
+
+ // activate the the parent menu only when there is no other child
+ // that has been activated
+ if ( parent_menu && !hwndAct )
+ {
+ parent->m_parentFrameActive = true;
+
+ menuToSet = parent_menu;
+ }
+ }
+ else
+ {
+ // we have nothing to do with it
+ return false;
+ }
+
+ if ( menuToSet )
+ {
+ MDISetMenu(parent->GetClientWindow(),
+ menuToSet, GetMDIWindowMenu(parent));
+ }
+
+ wxActivateEvent event(wxEVT_ACTIVATE, activated, m_windowId);
+ event.SetEventObject( this );
+
+ ResetWindowStyle((void *)NULL);
+
+ return HandleWindowEvent(event);