Add wxDocument::Activate() method.

Make activating the first (and, in the vast majority of cases, the only) view
of the document easier.

Closes #15120.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73720 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2013-03-26 11:00:59 +00:00
parent 82bf23ce3c
commit beba4fa694
4 changed files with 17 additions and 8 deletions

View File

@@ -1407,9 +1407,9 @@ wxDocTemplateVector GetVisibleTemplates(const wxList& allTemplates)
} // anonymous namespace
void wxDocManager::ActivateDocument(wxDocument *doc)
void wxDocument::Activate()
{
wxView * const view = doc->GetFirstView();
wxView * const view = GetFirstView();
if ( !view )
return;
@@ -1472,7 +1472,7 @@ wxDocument *wxDocManager::CreateDocument(const wxString& pathOrig, long flags)
if ( fn == doc->GetFilename() )
{
// file already open, just activate it and return
ActivateDocument(doc);
doc->Activate();
return doc;
}
}
@@ -1523,7 +1523,7 @@ wxDocument *wxDocManager::CreateDocument(const wxString& pathOrig, long flags)
// at least under Mac (where views are top level windows) it seems to be
// necessary to manually activate the new document to bring it to the
// forefront -- and it shouldn't hurt doing this under the other platforms
ActivateDocument(docNew);
docNew->Activate();
return docNew;
}