X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b91c4601f2cc8fab375dc49a0a1222d58065cfdb..6b527e158d66719088621e11cfd1862d9d1e9c12:/interface/wx/docview.h diff --git a/interface/wx/docview.h b/interface/wx/docview.h index 438cce2686..baed8144d5 100644 --- a/interface/wx/docview.h +++ b/interface/wx/docview.h @@ -91,6 +91,15 @@ public: */ virtual wxView* CreateView(wxDocument* doc, long flags = 0); + /** + This function implements the default (very primitive) format detection + which checks if the extension is that of the template. + + @param path + The path to be checked against the template. + */ + virtual bool FileMatchesTemplate(const wxString& path); + /** Returns the default file extension for the document data, as passed to the document template constructor. @@ -109,6 +118,13 @@ public: */ wxString GetDirectory() const; + /** + Returns the run-time class information that allows document + instances to be constructed dynamically, as passed to the document + template constructor. + */ + wxClassInfo* GetDocClassInfo() const; + /** Returns a pointer to the document manager instance for which this template was created. @@ -132,6 +148,13 @@ public: */ long GetFlags() const; + /** + Returns the run-time class information that allows view instances + to be constructed dynamically, as passed to the document template + constructor. + */ + wxClassInfo* GetViewClassInfo() const; + /** Returns the view type name, as passed to the document template constructor. @@ -340,6 +363,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 @@ -546,8 +577,9 @@ public: will have to choose from is sorted or not when shown the choice box dialog. Default is @false. */ - wxDocTemplate* SelectDocumentType(wxDocTemplate** templates, - int noTemplates, bool sort = false); + virtual wxDocTemplate* SelectDocumentType(wxDocTemplate** templates, + int noTemplates, + bool sort = false); /** Returns a document template by asking the user (if there is more than @@ -567,8 +599,8 @@ public: will have to choose from is sorted or not when shown the choice box dialog. Default is @false. */ - wxDocTemplate* SelectViewType(wxDocTemplate** templates, - int noTemplates, bool sort = false); + virtual wxDocTemplate* SelectViewType(wxDocTemplate** templates, + int noTemplates, bool sort = false); /** Sets the directory to be displayed to the user when opening a file. @@ -842,7 +874,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = "frame"); + const wxString& name = wxFrameNameStr); /** Destructor. @@ -924,7 +956,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = "frame"); + const wxString& name = wxFrameNameStr); /** Destructor. @@ -999,6 +1031,22 @@ public: */ virtual bool AddView(wxView* view); + /** + Returns true if the document hasn't been modified since the last time + it had been saved. + + Notice that this function returns @false if the document had been never + saved at all, so it may be also used to test whether it makes sense to + save the document: if it returns @true, there is nothing to save but if + @false is returned, it can be saved, even if it might be not modified + (this can be used to create an empty document file by the user). + + @see IsModified(), GetDocumentSaved() + + @since 2.9.0 + */ + bool AlreadySaved() const; + /** Closes the document, by calling OnSaveModified() and then (if this returned @true) OnCloseDocument(). This does not normally delete the @@ -1034,6 +1082,13 @@ public: */ wxString GetDocumentName() const; + /** + Return true if this document had been already saved. + + @see IsModified() + */ + bool GetDocumentSaved() const; + /** Gets a pointer to the template that created the document. */ @@ -1074,12 +1129,15 @@ public: */ virtual wxString GetUserReadableName() const; + //@{ /** Returns the list whose elements are the views on the document. @see GetFirstView() */ - wxList GetViews() const; + wxList& GetViews() const; + const wxList& GetViews() const; + //@} /** Returns @true if the document has been modified since the last save, @@ -1437,27 +1495,6 @@ public: called, as this is not done automatically. */ virtual void UseMenu(wxMenu* menu); - - /** - A character array of strings corresponding to the most recently opened - files. - */ - char** m_fileHistory; - - /** - The number of files stored in the history array. - */ - size_t m_fileHistoryN; - - /** - The maximum number of files to be stored and displayed on the menu. - */ - size_t m_fileMaxFiles; - - /** - The file menu used to display the file history list (if enabled). - */ - wxMenu* m_fileMenu; };