+// Implementation: intercept and act upon raise and lower commands.
+void wxMDIChildFrame::OnRaise()
+{
+ wxMDIParentFrame* parentFrame = (wxMDIParentFrame*) GetParent() ;
+ wxMDIChildFrame* oldActiveChild = parentFrame->GetActiveChild();
+ parentFrame->SetActiveChild(this);
+
+ if (oldActiveChild)
+ {
+ wxActivateEvent event(wxEVT_ACTIVATE, FALSE, oldActiveChild->GetId());
+ event.SetEventObject( oldActiveChild );
+ oldActiveChild->GetEventHandler()->ProcessEvent(event);
+ }
+
+ wxActivateEvent event(wxEVT_ACTIVATE, TRUE, this->GetId());
+ event.SetEventObject( this );
+ this->GetEventHandler()->ProcessEvent(event);
+}
+
+void wxMDIChildFrame::OnLower()
+{
+ wxMDIParentFrame* parentFrame = (wxMDIParentFrame*) GetParent() ;
+ wxMDIChildFrame* oldActiveChild = parentFrame->GetActiveChild();
+
+ if (oldActiveChild == this)
+ {
+ wxActivateEvent event(wxEVT_ACTIVATE, FALSE, oldActiveChild->GetId());
+ event.SetEventObject( oldActiveChild );
+ oldActiveChild->GetEventHandler()->ProcessEvent(event);
+ }
+ // TODO: unfortunately we don't now know which is the top-most child,
+ // so make the active child NULL.
+ parentFrame->SetActiveChild((wxMDIChildFrame*) NULL);
+}
+