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.
*/
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.
/**
Returns a reference to the list of documents.
*/
- wxList GetDocuments();
+ wxList& GetDocuments();
/**
Returns a pointer to file history.
/**
Returns a reference to the list of associated templates.
*/
- wxList GetTemplates();
+ wxList& GetTemplates();
/**
Initializes data; currently just calls OnCreateFileHistory().
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
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.
/**
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.
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
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
- const wxString& name = "frame");
+ const wxString& name = wxFrameNameStr);
/**
Destructor.
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.
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
- const wxString& name = "frame");
+ const wxString& name = wxFrameNameStr);
/**
Destructor.
/**
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.
Constructor. Define your own default constructor to initialize
application-specific data.
*/
- wxDocument();
+ wxDocument(wxDocument* parent = 0);
/**
Destructor. Removes itself from the document manager.
*/
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;
+ const wxList& GetViews() const;
+ //@}
/**
Returns @true if the document has been modified since the last save,