Fix showing MDI child from wxDocManager::ActivateDocument().

This fix has 2 components: first, call Raise() instead of simple SetFocus()
from ActivateDocument() as this corresponds better to what we want to do here.
And second, override Raise() to call Activate() in wxMDIChildFrame to ensure
that it works as expected as raising an MDI child doesn't work otherwise in
most ports (with the exceptions for wxOSX which, on the contrary, needs a
small fix to preserve the existing working Raise() behaviour).

Closes #13946.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70790 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2012-03-04 00:29:03 +00:00
parent e709239889
commit 3285e9a347
3 changed files with 9 additions and 2 deletions

View File

@ -181,6 +181,11 @@ public:
// return true.
virtual bool IsTopNavigationDomain() const { return true; }
// Raising any frame is supposed to show it but wxFrame Raise()
// implementation doesn't work for MDI child frames in most forms so
// forward this to Activate() which serves the same purpose by default.
virtual void Raise() { Activate(); }
protected:
wxMDIParentFrame *m_mdiParent;
};

View File

@ -1414,7 +1414,7 @@ void wxDocManager::ActivateDocument(wxDocument *doc)
view->Activate(true);
if ( wxWindow *win = view->GetFrame() )
win->SetFocus();
win->Raise();
}
wxDocument *wxDocManager::CreateDocument(const wxString& pathOrig, long flags)

View File

@ -417,7 +417,9 @@ void wxMDIChildFrame::MacActivate(long timestamp, bool activating)
// MDI operations
void wxMDIChildFrame::Activate()
{
Raise ();
// The base class method calls Activate() so skip it to avoid infinite
// recursion and go directly to the real Raise() implementation.
wxFrame::Raise();
}
//-----------------------------------------------------------------------------