From b54129836cbc680fbeb338bb6087c1a4f80bdf18 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 1 Oct 2008 17:04:43 +0000 Subject: [PATCH] add a more readable wrapper for CreateDocument(wxEmptyString, wxDOC_NEW) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56018 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/docview.h | 5 +++++ interface/wx/docview.h | 8 ++++++++ src/common/docview.cpp | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/include/wx/docview.h b/include/wx/docview.h index beac80fc73..49be65f1bb 100644 --- a/include/wx/docview.h +++ b/include/wx/docview.h @@ -354,6 +354,11 @@ public: virtual void OnOpenFileFailure() { } virtual wxDocument *CreateDocument(const wxString& path, long flags = 0); + + // wrapper around CreateDocument() with a more clear name + wxDocument *CreateNewDocument() + { return CreateDocument(wxString(), wxDOC_NEW); } + virtual wxView *CreateView(wxDocument *doc, long flags = 0); virtual void DeleteTemplate(wxDocTemplate *temp, long flags = 0); virtual bool FlushDoc(wxDocument *doc); diff --git a/interface/wx/docview.h b/interface/wx/docview.h index 438cce2686..bd11e9e13b 100644 --- a/interface/wx/docview.h +++ b/interface/wx/docview.h @@ -340,6 +340,14 @@ public: */ virtual wxDocument* CreateDocument(const wxString& path, long flags = 0); + /** + Creates an empty new document. + + This is equivalent to calling CreateDocument() with @c wxDOC_NEW flags + and without the file name. + */ + wxDocument *CreateNewDocument(); + /** Creates a new view for the given document. If more than one view is allowed for the document (by virtue of multiple templates mentioning diff --git a/src/common/docview.cpp b/src/common/docview.cpp index a4e3f5df60..3498256d94 100644 --- a/src/common/docview.cpp +++ b/src/common/docview.cpp @@ -972,7 +972,7 @@ void wxDocManager::OnFileCloseAll(wxCommandEvent& WXUNUSED(event)) void wxDocManager::OnFileNew(wxCommandEvent& WXUNUSED(event)) { - CreateDocument( wxEmptyString, wxDOC_NEW ); + CreateNewDocument(); } void wxDocManager::OnFileOpen(wxCommandEvent& WXUNUSED(event))