X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/655719367ac5e131d9642e5783f3ecf64d1a3385..c845a1975a3d6d79b19a7ec77bd8e0b8b8850751:/include/wx/docview.h diff --git a/include/wx/docview.h b/include/wx/docview.h index ef574fd486..94a13b2cc5 100644 --- a/include/wx/docview.h +++ b/include/wx/docview.h @@ -162,6 +162,12 @@ protected: wxCommandProcessor* m_commandProcessor; bool m_savedYet; + // Called by OnSaveDocument and OnOpenDocument to implement standard + // Save/Load behavior. Re-implement in derived class for custom + // behavior. + virtual bool DoSaveDocument(const wxString& file); + virtual bool DoOpenDocument(const wxString& file); + private: DECLARE_ABSTRACT_CLASS(wxDocument) DECLARE_NO_COPY_CLASS(wxDocument) @@ -254,6 +260,10 @@ public: virtual wxDocument *CreateDocument(const wxString& path, long flags = 0); virtual wxView *CreateView(wxDocument *doc, long flags = 0); + // Helper method for CreateDocument; also allows you to do your own document + // creation + virtual bool InitDocument(wxDocument* doc, const wxString& path, long flags = 0); + wxString GetDefaultExtension() const { return m_defaultExt; }; wxString GetDescription() const { return m_description; } wxString GetDirectory() const { return m_directory; }; @@ -272,6 +282,9 @@ public: bool IsVisible() const { return ((m_flags & wxTEMPLATE_VISIBLE) == wxTEMPLATE_VISIBLE); } + wxClassInfo* GetDocClassInfo() const { return m_docClassInfo; } + wxClassInfo* GetViewClassInfo() const { return m_viewClassInfo; } + virtual bool FileMatchesTemplate(const wxString& path); protected: @@ -288,6 +301,12 @@ protected: wxClassInfo* m_docClassInfo; wxClassInfo* m_viewClassInfo; + // Called by CreateDocument and CreateView to create the actual document/view object. + // By default uses the ClassInfo provided to the constructor. Override these functions + // to provide a different method of creation. + virtual wxDocument *DoCreateDocument(); + virtual wxView *DoCreateView(); + private: DECLARE_CLASS(wxDocTemplate) DECLARE_NO_COPY_CLASS(wxDocTemplate)