X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/adaaa68635b4c8a4d8c5284add40366ea3eefb07..c9c1faa490a451cdf42b35b92bfcc2c55d22bbe9:/interface/wx/docview.h diff --git a/interface/wx/docview.h b/interface/wx/docview.h index 5b3ad6f83f..e884ee0ba5 100644 --- a/interface/wx/docview.h +++ b/interface/wx/docview.h @@ -64,10 +64,9 @@ public: wxDocTemplate(wxDocManager* manager, const wxString& descr, const wxString& filter, const wxString& dir, const wxString& ext, const wxString& docTypeName, - const wxString& viewTypeName, - wxClassInfo* docClassInfo = NULL, - wxClassInfo* viewClassInfo = NULL, - long flags = wxDEFAULT_TEMPLATE_FLAGS); + const wxString& viewTypeName, wxClassInfo* docClassInfo = 0, + wxClassInfo* viewClassInfo = 0, + long flags = wxTEMPLATE_VISIBLE); /** Destructor. @@ -341,12 +340,20 @@ 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 the same document type), a choice of view is presented to the user. */ - wxView* CreateView(wxDocument* doc, long flags); + virtual wxView* CreateView(wxDocument* doc, long flags = 0); /** Removes the template from the list of templates. @@ -415,7 +422,7 @@ public: /** Returns a reference to the list of documents. */ - wxList GetDocuments(); + wxList& GetDocuments(); /** Returns a pointer to file history. @@ -441,7 +448,7 @@ public: /** Returns a reference to the list of associated templates. */ - wxList GetTemplates(); + wxList& GetTemplates(); /** Initializes data; currently just calls OnCreateFileHistory(). @@ -528,9 +535,9 @@ public: This function is used in CreateDocument(). */ - wxDocTemplate* SelectDocumentPath(wxDocTemplate** templates, - int noTemplates, wxString& path, - long flags, bool save); + virtual wxDocTemplate* SelectDocumentPath(wxDocTemplate** templates, + int noTemplates, wxString& path, + long flags, bool save = false); /** Returns a document template by asking the user (if there is more than @@ -547,8 +554,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 @@ -568,8 +576,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. @@ -758,7 +766,7 @@ public: /** Override this function to render the view on the given device context. */ - virtual void OnDraw(wxDC* dc); + virtual void OnDraw(wxDC* dc) = 0; /** Called when the view should be updated. @@ -772,7 +780,7 @@ public: application-specific information for making updating more efficient. */ - virtual void OnUpdate(wxView* sender, wxObject* hint); + virtual void OnUpdate(wxView* sender, wxObject* hint = 0); /** Associates the given document with the view. Normally called by the @@ -843,7 +851,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = "frame"); + const wxString& name = wxFrameNameStr); /** Destructor. @@ -865,7 +873,7 @@ public: override (but still call) this function in order to set the keyboard focus for your subwindow. */ - void OnActivate(wxActivateEvent event); + void OnActivate(wxActivateEvent& event); /** Closes and deletes the current view and document. @@ -925,7 +933,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = "frame"); + const wxString& name = wxFrameNameStr); /** Destructor. @@ -935,12 +943,10 @@ public: /** Used in two-step construction. */ - bool Create(wxDocManager* manager, wxFrame* parent, - wxWindowID id, const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = "frame"); + bool Create(wxDocManager* manager, wxFrame* parent, wxWindowID id, + const wxString& title, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 541072960, + const wxString& name = wxFrameNameStr); /** Returns the associated document manager object. @@ -989,7 +995,7 @@ public: Constructor. Define your own default constructor to initialize application-specific data. */ - wxDocument(); + wxDocument(wxDocument* parent = 0); /** Destructor. Removes itself from the document manager. @@ -1002,6 +1008,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 @@ -1037,6 +1059,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. */ @@ -1077,12 +1106,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,