*/
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.
*/
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.
*/
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.
*/
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
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
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.
/**
Called when the filename has changed. The default implementation
- constructs a suitable title and sets the title of the view frame (if
- any).
+ constructs a suitable title and sets the title of the view frame (if any).
*/
virtual void OnChangeFilename();
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
- const wxString& name = "frame");
+ const wxString& name = wxFrameNameStr);
/**
Destructor.
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
- const wxString& name = "frame");
+ const wxString& name = wxFrameNameStr);
/**
Destructor.
*/
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
*/
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.
*/
*/
virtual wxString GetUserReadableName() const;
+ //@{
/**
Returns the list whose elements are the views on the document.
@see GetFirstView()
*/
- wxList GetViews() const;
+ wxList& GetViews();
+ const wxList& GetViews() const;
+ //@}
/**
Returns @true if the document has been modified since the last save,
/**
Sets the filename for this document. Usually called by the framework.
+ Calls OnChangeFilename() which in turn calls wxView::OnChangeFilename() for
+ all views if @a notifyViews is @true,
+ */
+ void SetFilename(const wxString& filename, bool notifyViews = false);
+
+ /**
If @a notifyViews is @true, wxView::OnChangeFilename() is called for
all views.
+
+ @since 2.9.0
*/
- void SetFilename(const wxString& filename, bool notifyViews = false);
+ virtual void OnChangeFilename(bool notifyViews);
/**
Sets the title for this document. The document title is used for an
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;
};
// Global functions/macros
// ============================================================================
-/** @ingroup group_funcmacro_file */
+/** @addtogroup group_funcmacro_file */
//@{
/**