virtual bool OnSaveDocument(const wxString& filename);
virtual bool OnOpenDocument(const wxString& filename);
virtual bool OnNewDocument();
virtual bool OnSaveDocument(const wxString& filename);
virtual bool OnOpenDocument(const wxString& filename);
virtual bool OnNewDocument();
wxView *GetFirstView() const;
virtual void UpdateAllViews(wxView *sender = (wxView *) NULL, wxObject *hint = (wxObject *) NULL);
wxView *GetFirstView() const;
virtual void UpdateAllViews(wxView *sender = (wxView *) NULL, wxObject *hint = (wxObject *) NULL);
public:
// wxView(wxDocument *doc = (wxDocument *) NULL);
wxView();
~wxView();
wxDocument *GetDocument() const { return m_viewDocument; }
public:
// wxView(wxDocument *doc = (wxDocument *) NULL);
wxView();
~wxView();
wxDocument *GetDocument() const { return m_viewDocument; }
wxString GetViewName() const { return m_viewTypeName; }
void SetViewName(const wxString& name) { m_viewTypeName = name; };
wxString GetViewName() const { return m_viewTypeName; }
void SetViewName(const wxString& name) { m_viewTypeName = name; };
- wxFrame *GetFrame() const { return m_viewFrame ; }
- void SetFrame(wxFrame *frame) { m_viewFrame = frame; }
+ wxWindow *GetFrame() const { return m_viewFrame ; }
+ void SetFrame(wxWindow *frame) { m_viewFrame = frame; }
virtual void OnActivateView(bool activate, wxView *activeView, wxView *deactiveView);
virtual void OnDraw(wxDC *dc) = 0;
virtual void OnPrint(wxDC *dc, wxObject *info);
virtual void OnUpdate(wxView *sender, wxObject *hint = (wxObject *) NULL);
virtual void OnActivateView(bool activate, wxView *activeView, wxView *deactiveView);
virtual void OnDraw(wxDC *dc) = 0;
virtual void OnPrint(wxDC *dc, wxObject *info);
virtual void OnUpdate(wxView *sender, wxObject *hint = (wxObject *) NULL);
virtual void OnChangeFilename();
// Called by framework if created automatically by the default document
virtual void OnChangeFilename();
// Called by framework if created automatically by the default document
// Extend event processing to search the document's event table
virtual bool ProcessEvent(wxEvent& event);
// Extend event processing to search the document's event table
virtual bool ProcessEvent(wxEvent& event);
};
// Represents user interface (and other) properties of documents and views
class WXDLLEXPORT wxDocTemplate: public wxObject
{
};
// Represents user interface (and other) properties of documents and views
class WXDLLEXPORT wxDocTemplate: public wxObject
{
virtual wxDocument *CreateDocument(const wxString& path, long flags = 0);
virtual wxView *CreateView(wxDocument *doc, long flags = 0);
virtual wxDocument *CreateDocument(const wxString& path, long flags = 0);
virtual wxView *CreateView(wxDocument *doc, long flags = 0);
wxString GetDefaultExtension() const { return m_defaultExt; };
wxString GetDescription() const { return m_description; }
wxString GetDirectory() const { return m_directory; };
wxString GetDefaultExtension() const { return m_defaultExt; };
wxString GetDescription() const { return m_description; }
wxString GetDirectory() const { return m_directory; };
// For dynamic creation of appropriate instances.
wxClassInfo* m_docClassInfo;
wxClassInfo* m_viewClassInfo;
// For dynamic creation of appropriate instances.
wxClassInfo* m_docClassInfo;
wxClassInfo* m_viewClassInfo;
};
// One object of this class may be created in an application, to manage all
// the templates and documents.
class WXDLLEXPORT wxDocManager: public wxEvtHandler
{
};
// One object of this class may be created in an application, to manage all
// the templates and documents.
class WXDLLEXPORT wxDocManager: public wxEvtHandler
{
void OnFileNew(wxCommandEvent& event);
void OnFileOpen(wxCommandEvent& event);
void OnFileRevert(wxCommandEvent& event);
void OnFileNew(wxCommandEvent& event);
void OnFileOpen(wxCommandEvent& event);
void OnFileRevert(wxCommandEvent& event);
// called when file format detection didn't work, can be overridden to do
// something in this case
// called when file format detection didn't work, can be overridden to do
// something in this case
virtual void OnOpenFileFailure() { }
virtual wxDocument *CreateDocument(const wxString& path, long flags = 0);
virtual void OnOpenFileFailure() { }
virtual wxDocument *CreateDocument(const wxString& path, long flags = 0);
+ // closes all currently open documents
+ bool CloseDocuments(bool force = TRUE);
+
+ // closes the specified document
+ bool CloseDocument(wxDocument* doc, bool force = FALSE);
+
// Clear remaining documents and templates
bool Clear(bool force = TRUE);
// Views or windows should inform the document manager
// when a view is going in or out of focus
// Clear remaining documents and templates
bool Clear(bool force = TRUE);
// Views or windows should inform the document manager
// when a view is going in or out of focus
- virtual void RemoveFileFromHistory(int i);
- virtual int GetNoHistoryFiles() const;
- virtual wxString GetHistoryFile(int i) const;
+ virtual void RemoveFileFromHistory(size_t i);
+ virtual size_t GetHistoryFilesCount() const;
+ virtual wxString GetHistoryFile(size_t i) const;
- inline wxString GetLastDirectory() const { return m_lastDirectory; }
- inline void SetLastDirectory(const wxString& dir) { m_lastDirectory = dir; }
+ wxString GetLastDirectory() const { return m_lastDirectory; }
+ void SetLastDirectory(const wxString& dir) { m_lastDirectory = dir; }
// Get the current document manager
static wxDocManager* GetDocumentManager() { return sm_docManager; }
// Get the current document manager
static wxDocManager* GetDocumentManager() { return sm_docManager; }
// ----------------------------------------------------------------------------
// A default child frame
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxDocChildFrame : public wxFrame
{
// ----------------------------------------------------------------------------
// A default child frame
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxDocChildFrame : public wxFrame
{
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long type = wxDEFAULT_FRAME_STYLE,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long type = wxDEFAULT_FRAME_STYLE,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long type = wxDEFAULT_FRAME_STYLE,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long type = wxDEFAULT_FRAME_STYLE,
// Extend event processing to search the document manager's event table
virtual bool ProcessEvent(wxEvent& event);
// Extend event processing to search the document manager's event table
virtual bool ProcessEvent(wxEvent& event);
bool OnPrintPage(int page);
bool HasPage(int page);
bool OnBeginDocument(int startPage, int endPage);
bool OnPrintPage(int page);
bool HasPage(int page);
bool OnBeginDocument(int startPage, int endPage);
- // A synonym for GetNoHistoryFiles
- virtual int GetCount() const { return m_fileHistoryN; }
- int GetNoHistoryFiles() const { return m_fileHistoryN; }
+ const wxList& GetMenus() const { return m_fileMenus; }
#if wxUSE_STD_IOSTREAM
// For compatibility with existing file formats:
// converts from/to a stream to/from a temporary file.
#if wxUSE_STD_IOSTREAM
// For compatibility with existing file formats:
// converts from/to a stream to/from a temporary file.
// converts from/to a stream to/from a temporary file.
bool WXDLLEXPORT wxTransferFileToStream(const wxString& filename, wxOutputStream& stream);
bool WXDLLEXPORT wxTransferStreamToFile(wxInputStream& stream, const wxString& filename);
// converts from/to a stream to/from a temporary file.
bool WXDLLEXPORT wxTransferFileToStream(const wxString& filename, wxOutputStream& stream);
bool WXDLLEXPORT wxTransferStreamToFile(wxInputStream& stream, const wxString& filename);