+ // if there are no more children left we need to show the frame if we
+ // hadn't shown it before because there were active children and it was
+ // useless (note that we have to do it after fully removing the child, i.e.
+ // after calling the base class RemoveChild() as otherwise we risk to touch
+ // pointer to the child being deleted)
+ if ( !m_currentChild && m_shouldBeShown && !IsShown() )
+ {
+ // we have to show it, but at least move it out of sight and make it of
+ // smallest possible size (unfortunately (0, 0) doesn't work so that it
+ // doesn't appear in expose
+ SetSize(-10000, -10000, 1, 1);
+ Show();
+ }
+}
+
+void wxMDIParentFrame::MacActivate(long timestamp, bool activating)
+{
+ wxLogTrace(TRACE_MDI, wxT("MDI PARENT=%p MacActivate(0x%08lx,%s)"), this, timestamp, activating ? wxT("ACTIV") : wxT("deact"));
+
+ if (activating)
+ {
+ if (s_macDeactivateWindow && s_macDeactivateWindow->GetParent() == this)
+ {
+ wxLogTrace(TRACE_MDI, wxT("child had been scheduled for deactivation, rehighlighting"));
+
+ UMAHighlightAndActivateWindow((WindowRef)s_macDeactivateWindow->MacGetWindowRef(), true);
+
+ wxLogTrace(TRACE_MDI, wxT("finished highliting child"));
+
+ s_macDeactivateWindow = NULL;
+ }
+ else if (s_macDeactivateWindow == this)
+ {
+ wxLogTrace(TRACE_MDI, wxT("Avoided deactivation/activation of this=%p"), this);
+
+ s_macDeactivateWindow = NULL;
+ }
+ else // window to deactivate is NULL or is not us or one of our kids
+ {
+ // activate kid instead
+ if (m_currentChild)
+ m_currentChild->MacActivate(timestamp, activating);
+ else
+ wxFrame::MacActivate(timestamp, activating);
+ }
+ }
+ else
+ {
+ // We were scheduled for deactivation, and now we do it.
+ if (s_macDeactivateWindow == this)
+ {
+ s_macDeactivateWindow = NULL;
+ if (m_currentChild)
+ m_currentChild->MacActivate(timestamp, activating);
+ wxFrame::MacActivate(timestamp, activating);
+ }
+ else // schedule ourselves for deactivation
+ {
+ if (s_macDeactivateWindow)
+ wxLogTrace(TRACE_MDI, wxT("window=%p SHOULD have been deactivated, oh well!"), s_macDeactivateWindow);
+ wxLogTrace(TRACE_MDI, wxT("Scheduling delayed MDI Parent deactivation"));
+
+ s_macDeactivateWindow = this;
+ }
+ }