- DECLARE_DYNAMIC_CLASS(wxDocManager)
- public:
- wxDocManager(long flags = wxDEFAULT_DOCMAN_FLAGS, bool initialize = TRUE);
- ~wxDocManager(void);
-
- virtual bool Initialize(void);
-
- // Handlers for common user commands
-// virtual void OldOnMenuCommand(int command);
-
- void OnFileClose(wxCommandEvent& event);
- void OnFileNew(wxCommandEvent& event);
- void OnFileOpen(wxCommandEvent& event);
- void OnFileRevert(wxCommandEvent& event);
- void OnFileSave(wxCommandEvent& event);
- void OnFileSaveAs(wxCommandEvent& event);
- void OnPrint(wxCommandEvent& event);
- void OnPrintSetup(wxCommandEvent& event);
- void OnPreview(wxCommandEvent& event);
- void OnUndo(wxCommandEvent& event);
- void OnRedo(wxCommandEvent& event);
-
- // Extend event processing to search the view's event table
- virtual bool ProcessEvent(wxEvent& event);
-
- virtual wxDocument *CreateDocument(const wxString& path, long flags = 0);
- virtual wxView *CreateView(wxDocument *doc, long flags = 0);
- virtual void DeleteTemplate(wxDocTemplate *temp, long flags = 0);
- virtual bool FlushDoc(wxDocument *doc);
- virtual wxDocTemplate *MatchTemplate(const wxString& path);
- virtual wxDocTemplate *SelectDocumentPath(wxDocTemplate **templates,
- int noTemplates, wxString& path, long flags, bool save = FALSE);
- virtual wxDocTemplate *SelectDocumentType(wxDocTemplate **templates,
- int noTemplates);
- virtual wxDocTemplate *SelectViewType(wxDocTemplate **templates,
- int noTemplates);
- virtual wxDocTemplate *FindTemplateForPath(const wxString& path);
-
- void AssociateTemplate(wxDocTemplate *temp);
- void DisassociateTemplate(wxDocTemplate *temp);
-
- wxDocument *GetCurrentDocument(void) const;
-
- inline void SetMaxDocsOpen(int n) { m_maxDocsOpen = n; }
- inline int GetMaxDocsOpen(void) const { return m_maxDocsOpen; }
-
- // Add and remove a document from the manager's list
- void AddDocument(wxDocument *doc);
- void RemoveDocument(wxDocument *doc);
-
- // 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 ActivateView(wxView *view, bool activate = TRUE, bool deleting = FALSE);
- virtual wxView *GetCurrentView(void) const;
-
- virtual inline wxList& GetDocuments(void) const { return (wxList&) m_docs; }
-
- // Make a default document name
- virtual bool MakeDefaultName(wxString& buf);
-
- virtual wxFileHistory *OnCreateFileHistory(void);
- virtual inline wxFileHistory *GetFileHistory(void) const { return m_fileHistory; }
-
- // File history management
- virtual void AddFileToHistory(const wxString& file);
- virtual int GetNoHistoryFiles(void) const;
- virtual wxString GetHistoryFile(int i) const;
- virtual void FileHistoryUseMenu(wxMenu *menu);
- virtual void FileHistoryRemoveMenu(wxMenu *menu);
-#ifdef wxUSE_CONFIG
- virtual void FileHistoryLoad(wxConfigBase& config);
- virtual void FileHistorySave(wxConfigBase& config);
-#endif
- virtual void FileHistoryAddFilesToMenu();
- virtual void FileHistoryAddFilesToMenu(wxMenu* menu);
- protected:
- long m_flags;
- int m_defaultDocumentNameCounter;
- int m_maxDocsOpen;
- wxList m_docs;
- wxList m_templates;
- wxView* m_currentView;
- wxFileHistory* m_fileHistory;
-
-DECLARE_EVENT_TABLE()
+ DECLARE_DYNAMIC_CLASS(wxDocManager)
+
+public:
+ wxDocManager(long flags = wxDEFAULT_DOCMAN_FLAGS, bool initialize = TRUE);
+ ~wxDocManager();
+
+ virtual bool Initialize();
+
+ // Handlers for common user commands
+ void OnFileClose(wxCommandEvent& event);
+ void OnFileNew(wxCommandEvent& event);
+ void OnFileOpen(wxCommandEvent& event);
+ void OnFileRevert(wxCommandEvent& event);
+ void OnFileSave(wxCommandEvent& event);
+ void OnFileSaveAs(wxCommandEvent& event);
+ void OnPrint(wxCommandEvent& event);
+ void OnPrintSetup(wxCommandEvent& event);
+ void OnPreview(wxCommandEvent& event);
+ void OnUndo(wxCommandEvent& event);
+ void OnRedo(wxCommandEvent& event);
+
+ // Extend event processing to search the view's event table
+ virtual bool ProcessEvent(wxEvent& event);
+
+ virtual wxDocument *CreateDocument(const wxString& path, long flags = 0);
+ virtual wxView *CreateView(wxDocument *doc, long flags = 0);
+ virtual void DeleteTemplate(wxDocTemplate *temp, long flags = 0);
+ virtual bool FlushDoc(wxDocument *doc);
+ virtual wxDocTemplate *MatchTemplate(const wxString& path);
+ virtual wxDocTemplate *SelectDocumentPath(wxDocTemplate **templates,
+ int noTemplates, wxString& path, long flags, bool save = FALSE);
+ virtual wxDocTemplate *SelectDocumentType(wxDocTemplate **templates,
+ int noTemplates);
+ virtual wxDocTemplate *SelectViewType(wxDocTemplate **templates,
+ int noTemplates);
+ virtual wxDocTemplate *FindTemplateForPath(const wxString& path);
+
+ void AssociateTemplate(wxDocTemplate *temp);
+ void DisassociateTemplate(wxDocTemplate *temp);
+
+ wxDocument *GetCurrentDocument() const;
+
+ void SetMaxDocsOpen(int n) { m_maxDocsOpen = n; }
+ int GetMaxDocsOpen() const { return m_maxDocsOpen; }
+
+ // Add and remove a document from the manager's list
+ void AddDocument(wxDocument *doc);
+ void RemoveDocument(wxDocument *doc);
+
+ // 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 ActivateView(wxView *view, bool activate = TRUE, bool deleting = FALSE);
+ virtual wxView *GetCurrentView() const;
+
+ virtual wxList& GetDocuments() const { return (wxList&) m_docs; }
+
+ // Make a default document name
+ virtual bool MakeDefaultName(wxString& buf);
+
+ virtual wxFileHistory *OnCreateFileHistory();
+ virtual wxFileHistory *GetFileHistory() const { return m_fileHistory; }
+
+ // File history management
+ virtual void AddFileToHistory(const wxString& file);
+ virtual void RemoveFileFromHistory(int i);
+ virtual int GetNoHistoryFiles() const;
+ virtual wxString GetHistoryFile(int i) const;
+ virtual void FileHistoryUseMenu(wxMenu *menu);
+ virtual void FileHistoryRemoveMenu(wxMenu *menu);
+#if wxUSE_CONFIG
+ virtual void FileHistoryLoad(wxConfigBase& config);
+ virtual void FileHistorySave(wxConfigBase& config);
+#endif // wxUSE_CONFIG
+
+ virtual void FileHistoryAddFilesToMenu();
+ virtual void FileHistoryAddFilesToMenu(wxMenu* menu);
+
+protected:
+ long m_flags;
+ int m_defaultDocumentNameCounter;
+ int m_maxDocsOpen;
+ wxList m_docs;
+ wxList m_templates;
+ wxView* m_currentView;
+ wxFileHistory* m_fileHistory;
+
+ DECLARE_EVENT_TABLE()
+};
+
+// ----------------------------------------------------------------------------
+// A default child frame
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxDocChildFrame : public wxFrame
+{
+ DECLARE_CLASS(wxDocChildFrame)
+
+public:
+ wxDocChildFrame(wxDocument *doc,
+ wxView *view,
+ wxFrame *frame,
+ wxWindowID id,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long type = wxDEFAULT_FRAME_STYLE,
+ const wxString& name = "frame");
+ ~wxDocChildFrame();
+
+ // Extend event processing to search the view's event table
+ virtual bool ProcessEvent(wxEvent& event);
+
+ void OnActivate(wxActivateEvent& event);
+ void OnCloseWindow(wxCloseEvent& event);
+
+ wxDocument *GetDocument() const { return m_childDocument; }
+ wxView *GetView() const { return m_childView; }
+ void SetDocument(wxDocument *doc) { m_childDocument = doc; }
+ void SetView(wxView *view) { m_childView = view; }
+
+protected:
+ wxDocument* m_childDocument;
+ wxView* m_childView;
+
+ DECLARE_EVENT_TABLE()