- protected:
- wxDocument* m_viewDocument;
- wxString m_viewTypeName;
- wxFrame* m_viewFrame;
-};
-
-// Represents user interface (and other) properties of documents and views
-class WXDLLEXPORT wxDocTemplate: public wxObject
-{
- DECLARE_CLASS(wxDocTemplate)
-
- friend class WXDLLEXPORT wxDocManager;
-
- public:
-
- // Associate document and view types.
- // They're for identifying what view is associated with what
- // template/document type
- wxDocTemplate(wxDocManager *manager, const wxString& descr, const wxString& filter, const wxString& dir,
- const wxString& ext, const wxString& docTypeName, const wxString& viewTypeName,
- wxClassInfo *docClassInfo = (wxClassInfo *) NULL, wxClassInfo *viewClassInfo = (wxClassInfo *)NULL,
- long flags = wxDEFAULT_TEMPLATE_FLAGS);
-
- ~wxDocTemplate(void);
-
- // By default, these two member functions dynamically creates document
- // and view using dynamic instance construction.
- // Override these if you need a different method of construction.
- virtual wxDocument *CreateDocument(const wxString& path, long flags = 0);
- virtual wxView *CreateView(wxDocument *doc, long flags = 0);
-
- inline wxString GetDefaultExtension(void) const { return m_defaultExt; };
- inline wxString GetDescription(void) const { return m_description; }
- inline wxString GetDirectory(void) const { return m_directory; };
- inline wxDocManager *GetDocumentManager(void) const { return m_documentManager; }
- inline void SetDocumentManager(wxDocManager *manager) { m_documentManager = manager; }
- inline wxString GetFileFilter(void) const { return m_fileFilter; };
- inline long GetFlags(void) const { return m_flags; };
- virtual wxString GetViewName(void) const { return m_viewTypeName; }
- virtual wxString GetDocumentName(void) const { return m_docTypeName; }
-
- inline void SetFileFilter(const wxString& filter) { m_fileFilter = filter; };
- inline void SetDirectory(const wxString& dir) { m_directory = dir; };
- inline void SetDescription(const wxString& descr) { m_description = descr; };
- inline void SetDefaultExtension(const wxString& ext) { m_defaultExt = ext; };
- inline void SetFlags(long flags) { m_flags = flags; };
-
- inline bool IsVisible(void) const { return ((m_flags & wxTEMPLATE_VISIBLE) == wxTEMPLATE_VISIBLE); }
-
- protected:
- long m_flags;
- wxString m_fileFilter;
- wxString m_directory;
- wxString m_description;
- wxString m_defaultExt;
- wxString m_docTypeName;
- wxString m_viewTypeName;
- wxDocManager* m_documentManager;
-
- // 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
-{
- 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);
- virtual void FileHistoryLoad(wxConfigBase& config);
- virtual void FileHistorySave(wxConfigBase& 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(void);