]>
Commit | Line | Data |
---|---|---|
c801d85f | 1 | ///////////////////////////////////////////////////////////////////////////// |
ca3e85cf | 2 | // Name: wx/docview.h |
c801d85f KB |
3 | // Purpose: Doc/View classes |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
99d80019 | 8 | // Copyright: (c) Julian Smart |
65571936 | 9 | // Licence: wxWindows licence |
c801d85f KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
34138703 JS |
12 | #ifndef _WX_DOCH__ |
13 | #define _WX_DOCH__ | |
c801d85f | 14 | |
c801d85f | 15 | #include "wx/defs.h" |
e30285ab VZ |
16 | |
17 | #if wxUSE_DOC_VIEW_ARCHITECTURE | |
18 | ||
c801d85f | 19 | #include "wx/list.h" |
c801d85f | 20 | #include "wx/string.h" |
2f7adba0 | 21 | #include "wx/frame.h" |
a0219e45 | 22 | #include "wx/filehistory.h" |
c801d85f | 23 | |
47d67540 | 24 | #if wxUSE_PRINTING_ARCHITECTURE |
caf0debf | 25 | #include "wx/print.h" |
c801d85f KB |
26 | #endif |
27 | ||
b5dbe15d VS |
28 | class WXDLLIMPEXP_FWD_CORE wxWindow; |
29 | class WXDLLIMPEXP_FWD_CORE wxDocument; | |
30 | class WXDLLIMPEXP_FWD_CORE wxView; | |
31 | class WXDLLIMPEXP_FWD_CORE wxDocTemplate; | |
32 | class WXDLLIMPEXP_FWD_CORE wxDocManager; | |
33 | class WXDLLIMPEXP_FWD_CORE wxPrintInfo; | |
34 | class WXDLLIMPEXP_FWD_CORE wxCommandProcessor; | |
4f7d425f | 35 | class WXDLLIMPEXP_FWD_BASE wxConfigBase; |
c801d85f | 36 | |
a9e2e6e5 VZ |
37 | class wxDocChildFrameAnyBase; |
38 | ||
a533f5c1 | 39 | #if wxUSE_STD_IOSTREAM |
65f19af1 | 40 | #include "wx/iosfwrap.h" |
a533f5c1 RR |
41 | #else |
42 | #include "wx/stream.h" | |
43 | #endif | |
c801d85f | 44 | |
c77049a0 | 45 | // Flags for wxDocManager (can be combined). |
caf0debf VZ |
46 | enum |
47 | { | |
c77049a0 VZ |
48 | wxDOC_NEW = 1, |
49 | wxDOC_SILENT = 2 | |
caf0debf | 50 | }; |
c801d85f KB |
51 | |
52 | // Document template flags | |
caf0debf VZ |
53 | enum |
54 | { | |
55 | wxTEMPLATE_VISIBLE = 1, | |
89d94e04 | 56 | wxTEMPLATE_INVISIBLE = 2, |
caf0debf VZ |
57 | wxDEFAULT_TEMPLATE_FLAGS = wxTEMPLATE_VISIBLE |
58 | }; | |
c801d85f | 59 | |
caf0debf | 60 | #define wxMAX_FILE_HISTORY 9 |
c801d85f | 61 | |
53a2db12 | 62 | class WXDLLIMPEXP_CORE wxDocument : public wxEvtHandler |
c801d85f | 63 | { |
caf0debf | 64 | public: |
c77049a0 | 65 | wxDocument(wxDocument *parent = NULL); |
d3c7fc99 | 66 | virtual ~wxDocument(); |
caf0debf VZ |
67 | |
68 | // accessors | |
68379eaf | 69 | void SetFilename(const wxString& filename, bool notifyViews = false); |
caf0debf VZ |
70 | wxString GetFilename() const { return m_documentFile; } |
71 | ||
47b378bd | 72 | void SetTitle(const wxString& title) { m_documentTitle = title; } |
caf0debf VZ |
73 | wxString GetTitle() const { return m_documentTitle; } |
74 | ||
47b378bd | 75 | void SetDocumentName(const wxString& name) { m_documentTypeName = name; } |
caf0debf VZ |
76 | wxString GetDocumentName() const { return m_documentTypeName; } |
77 | ||
d7b3a73d VZ |
78 | // access the flag indicating whether this document had been already saved, |
79 | // SetDocumentSaved() is only used internally, don't call it | |
caf0debf | 80 | bool GetDocumentSaved() const { return m_savedYet; } |
68379eaf | 81 | void SetDocumentSaved(bool saved = true) { m_savedYet = saved; } |
caf0debf | 82 | |
de56f240 VZ |
83 | // return true if the document hasn't been modified since the last time it |
84 | // was saved (implying that it returns false if it was never saved, even if | |
85 | // the document is not modified) | |
86 | bool AlreadySaved() const { return !IsModified() && GetDocumentSaved(); } | |
87 | ||
caf0debf VZ |
88 | virtual bool Close(); |
89 | virtual bool Save(); | |
90 | virtual bool SaveAs(); | |
91 | virtual bool Revert(); | |
92 | ||
a533f5c1 | 93 | #if wxUSE_STD_IOSTREAM |
dd107c50 VZ |
94 | virtual wxSTD ostream& SaveObject(wxSTD ostream& stream); |
95 | virtual wxSTD istream& LoadObject(wxSTD istream& stream); | |
a533f5c1 | 96 | #else |
23a54e14 RR |
97 | virtual wxOutputStream& SaveObject(wxOutputStream& stream); |
98 | virtual wxInputStream& LoadObject(wxInputStream& stream); | |
a533f5c1 | 99 | #endif |
caf0debf | 100 | |
77ffb593 | 101 | // Called by wxWidgets |
caf0debf VZ |
102 | virtual bool OnSaveDocument(const wxString& filename); |
103 | virtual bool OnOpenDocument(const wxString& filename); | |
104 | virtual bool OnNewDocument(); | |
105 | virtual bool OnCloseDocument(); | |
106 | ||
68379eaf | 107 | // Prompts for saving if about to close a modified document. Returns true |
caf0debf | 108 | // if ok to close the document (may have saved in the meantime, or set |
68379eaf | 109 | // modified to false) |
caf0debf VZ |
110 | virtual bool OnSaveModified(); |
111 | ||
8cc208e3 | 112 | // if you override, remember to call the default |
00e3ea1c FM |
113 | // implementation (wxDocument::OnChangeFilename) |
114 | virtual void OnChangeFilename(bool notifyViews); | |
115 | ||
caf0debf VZ |
116 | // Called by framework if created automatically by the default document |
117 | // manager: gives document a chance to initialise and (usually) create a | |
118 | // view | |
119 | virtual bool OnCreate(const wxString& path, long flags); | |
120 | ||
121 | // By default, creates a base wxCommandProcessor. | |
122 | virtual wxCommandProcessor *OnCreateCommandProcessor(); | |
89d94e04 VZ |
123 | virtual wxCommandProcessor *GetCommandProcessor() const |
124 | { return m_commandProcessor; } | |
125 | virtual void SetCommandProcessor(wxCommandProcessor *proc) | |
126 | { m_commandProcessor = proc; } | |
caf0debf VZ |
127 | |
128 | // Called after a view is added or removed. The default implementation | |
129 | // deletes the document if this is there are no more views. | |
130 | virtual void OnChangedViewList(); | |
131 | ||
29548835 VZ |
132 | // Called from OnCloseDocument(), does nothing by default but may be |
133 | // overridden. Return value is ignored. | |
caf0debf VZ |
134 | virtual bool DeleteContents(); |
135 | ||
136 | virtual bool Draw(wxDC&); | |
137 | virtual bool IsModified() const { return m_documentModified; } | |
250ab35a | 138 | virtual void Modify(bool mod); |
caf0debf VZ |
139 | |
140 | virtual bool AddView(wxView *view); | |
141 | virtual bool RemoveView(wxView *view); | |
b80388aa VZ |
142 | wxList& GetViews() { return m_documentViews; } |
143 | const wxList& GetViews() const { return m_documentViews; } | |
caf0debf VZ |
144 | wxView *GetFirstView() const; |
145 | ||
c77049a0 | 146 | virtual void UpdateAllViews(wxView *sender = NULL, wxObject *hint = NULL); |
b23e843b | 147 | virtual void NotifyClosing(); |
caf0debf VZ |
148 | |
149 | // Remove all views (because we're closing the document) | |
150 | virtual bool DeleteAllViews(); | |
151 | ||
152 | // Other stuff | |
153 | virtual wxDocManager *GetDocumentManager() const; | |
89d94e04 VZ |
154 | virtual wxDocTemplate *GetDocumentTemplate() const |
155 | { return m_documentTemplate; } | |
156 | virtual void SetDocumentTemplate(wxDocTemplate *temp) | |
157 | { m_documentTemplate = temp; } | |
caf0debf | 158 | |
724b119a VZ |
159 | // Get the document name to be shown to the user: the title if there is |
160 | // any, otherwise the filename if the document was saved and, finally, | |
161 | // "unnamed" otherwise | |
162 | virtual wxString GetUserReadableName() const; | |
163 | ||
164 | #if WXWIN_COMPATIBILITY_2_8 | |
165 | // use GetUserReadableName() instead | |
166 | wxDEPRECATED_BUT_USED_INTERNALLY( | |
167 | virtual bool GetPrintableName(wxString& buf) const | |
168 | ); | |
169 | #endif // WXWIN_COMPATIBILITY_2_8 | |
caf0debf VZ |
170 | |
171 | // Returns a window that can be used as a parent for document-related | |
172 | // dialogs. Override if necessary. | |
173 | virtual wxWindow *GetDocumentWindow() const; | |
174 | ||
175 | protected: | |
176 | wxList m_documentViews; | |
177 | wxString m_documentFile; | |
178 | wxString m_documentTitle; | |
179 | wxString m_documentTypeName; | |
180 | wxDocTemplate* m_documentTemplate; | |
181 | bool m_documentModified; | |
182 | wxDocument* m_documentParent; | |
183 | wxCommandProcessor* m_commandProcessor; | |
184 | bool m_savedYet; | |
b5f159ac | 185 | |
69936aea VZ |
186 | // Called by OnSaveDocument and OnOpenDocument to implement standard |
187 | // Save/Load behavior. Re-implement in derived class for custom | |
188 | // behavior. | |
189 | virtual bool DoSaveDocument(const wxString& file); | |
190 | virtual bool DoOpenDocument(const wxString& file); | |
191 | ||
724b119a VZ |
192 | // the default implementation of GetUserReadableName() |
193 | wxString DoGetUserReadableName() const; | |
194 | ||
2b5f62a0 VZ |
195 | private: |
196 | DECLARE_ABSTRACT_CLASS(wxDocument) | |
c0c133e1 | 197 | wxDECLARE_NO_COPY_CLASS(wxDocument); |
c801d85f KB |
198 | }; |
199 | ||
53a2db12 | 200 | class WXDLLIMPEXP_CORE wxView: public wxEvtHandler |
c801d85f | 201 | { |
caf0debf | 202 | public: |
caf0debf | 203 | wxView(); |
d3c7fc99 | 204 | virtual ~wxView(); |
c801d85f | 205 | |
caf0debf | 206 | wxDocument *GetDocument() const { return m_viewDocument; } |
bb28b477 | 207 | virtual void SetDocument(wxDocument *doc); |
c801d85f | 208 | |
caf0debf | 209 | wxString GetViewName() const { return m_viewTypeName; } |
47b378bd | 210 | void SetViewName(const wxString& name) { m_viewTypeName = name; } |
c801d85f | 211 | |
b9f933ab JS |
212 | wxWindow *GetFrame() const { return m_viewFrame ; } |
213 | void SetFrame(wxWindow *frame) { m_viewFrame = frame; } | |
c801d85f | 214 | |
89d94e04 VZ |
215 | virtual void OnActivateView(bool activate, |
216 | wxView *activeView, | |
217 | wxView *deactiveView); | |
caf0debf VZ |
218 | virtual void OnDraw(wxDC *dc) = 0; |
219 | virtual void OnPrint(wxDC *dc, wxObject *info); | |
c77049a0 | 220 | virtual void OnUpdate(wxView *sender, wxObject *hint = NULL); |
6fb99eb3 | 221 | virtual void OnClosingDocument() {} |
caf0debf | 222 | virtual void OnChangeFilename(); |
c801d85f | 223 | |
caf0debf VZ |
224 | // Called by framework if created automatically by the default document |
225 | // manager class: gives view a chance to initialise | |
c77049a0 VZ |
226 | virtual bool OnCreate(wxDocument *WXUNUSED(doc), long WXUNUSED(flags)) |
227 | { return true; } | |
c801d85f | 228 | |
caf0debf VZ |
229 | // Checks if the view is the last one for the document; if so, asks user |
230 | // to confirm save data (if modified). If ok, deletes itself and returns | |
68379eaf WS |
231 | // true. |
232 | virtual bool Close(bool deleteWindow = true); | |
caf0debf VZ |
233 | |
234 | // Override to do cleanup/veto close | |
235 | virtual bool OnClose(bool deleteWindow); | |
2b854a32 | 236 | |
caf0debf VZ |
237 | // A view's window can call this to notify the view it is (in)active. |
238 | // The function then notifies the document manager. | |
239 | virtual void Activate(bool activate); | |
c801d85f | 240 | |
caf0debf VZ |
241 | wxDocManager *GetDocumentManager() const |
242 | { return m_viewDocument->GetDocumentManager(); } | |
c801d85f | 243 | |
47d67540 | 244 | #if wxUSE_PRINTING_ARCHITECTURE |
caf0debf | 245 | virtual wxPrintout *OnCreatePrintout(); |
c801d85f KB |
246 | #endif |
247 | ||
a9e2e6e5 VZ |
248 | // implementation only |
249 | // ------------------- | |
250 | ||
251 | // set the associated frame, it is used to reset its view when we're | |
252 | // destroyed | |
ada1ff0d | 253 | void SetDocChildFrame(wxDocChildFrameAnyBase *docChildFrame); |
a9e2e6e5 | 254 | |
caf0debf | 255 | protected: |
bba5e72a | 256 | // hook the document into event handlers chain here |
8cc208e3 | 257 | virtual bool TryBefore(wxEvent& event); |
bba5e72a | 258 | |
caf0debf VZ |
259 | wxDocument* m_viewDocument; |
260 | wxString m_viewTypeName; | |
b9f933ab | 261 | wxWindow* m_viewFrame; |
22f3361e | 262 | |
a9e2e6e5 VZ |
263 | wxDocChildFrameAnyBase *m_docChildFrame; |
264 | ||
2b5f62a0 VZ |
265 | private: |
266 | DECLARE_ABSTRACT_CLASS(wxView) | |
c0c133e1 | 267 | wxDECLARE_NO_COPY_CLASS(wxView); |
c801d85f KB |
268 | }; |
269 | ||
270 | // Represents user interface (and other) properties of documents and views | |
53a2db12 | 271 | class WXDLLIMPEXP_CORE wxDocTemplate: public wxObject |
c801d85f | 272 | { |
caf0debf | 273 | |
b5dbe15d | 274 | friend class WXDLLIMPEXP_FWD_CORE wxDocManager; |
caf0debf VZ |
275 | |
276 | public: | |
277 | // Associate document and view types. They're for identifying what view is | |
278 | // associated with what template/document type | |
279 | wxDocTemplate(wxDocManager *manager, | |
280 | const wxString& descr, | |
281 | const wxString& filter, | |
282 | const wxString& dir, | |
283 | const wxString& ext, | |
284 | const wxString& docTypeName, | |
285 | const wxString& viewTypeName, | |
c77049a0 VZ |
286 | wxClassInfo *docClassInfo = NULL, |
287 | wxClassInfo *viewClassInfo = NULL, | |
caf0debf VZ |
288 | long flags = wxDEFAULT_TEMPLATE_FLAGS); |
289 | ||
d3c7fc99 | 290 | virtual ~wxDocTemplate(); |
caf0debf VZ |
291 | |
292 | // By default, these two member functions dynamically creates document and | |
293 | // view using dynamic instance construction. Override these if you need a | |
294 | // different method of construction. | |
295 | virtual wxDocument *CreateDocument(const wxString& path, long flags = 0); | |
296 | virtual wxView *CreateView(wxDocument *doc, long flags = 0); | |
297 | ||
217b7140 JS |
298 | // Helper method for CreateDocument; also allows you to do your own document |
299 | // creation | |
89d94e04 VZ |
300 | virtual bool InitDocument(wxDocument* doc, |
301 | const wxString& path, | |
302 | long flags = 0); | |
217b7140 | 303 | |
47b378bd | 304 | wxString GetDefaultExtension() const { return m_defaultExt; } |
caf0debf | 305 | wxString GetDescription() const { return m_description; } |
47b378bd | 306 | wxString GetDirectory() const { return m_directory; } |
caf0debf | 307 | wxDocManager *GetDocumentManager() const { return m_documentManager; } |
89d94e04 VZ |
308 | void SetDocumentManager(wxDocManager *manager) |
309 | { m_documentManager = manager; } | |
47b378bd VS |
310 | wxString GetFileFilter() const { return m_fileFilter; } |
311 | long GetFlags() const { return m_flags; } | |
caf0debf VZ |
312 | virtual wxString GetViewName() const { return m_viewTypeName; } |
313 | virtual wxString GetDocumentName() const { return m_docTypeName; } | |
314 | ||
47b378bd VS |
315 | void SetFileFilter(const wxString& filter) { m_fileFilter = filter; } |
316 | void SetDirectory(const wxString& dir) { m_directory = dir; } | |
317 | void SetDescription(const wxString& descr) { m_description = descr; } | |
318 | void SetDefaultExtension(const wxString& ext) { m_defaultExt = ext; } | |
319 | void SetFlags(long flags) { m_flags = flags; } | |
caf0debf | 320 | |
89d94e04 | 321 | bool IsVisible() const { return (m_flags & wxTEMPLATE_VISIBLE) != 0; } |
caf0debf | 322 | |
04129514 JS |
323 | wxClassInfo* GetDocClassInfo() const { return m_docClassInfo; } |
324 | wxClassInfo* GetViewClassInfo() const { return m_viewClassInfo; } | |
325 | ||
caf0debf VZ |
326 | virtual bool FileMatchesTemplate(const wxString& path); |
327 | ||
328 | protected: | |
329 | long m_flags; | |
330 | wxString m_fileFilter; | |
331 | wxString m_directory; | |
332 | wxString m_description; | |
333 | wxString m_defaultExt; | |
334 | wxString m_docTypeName; | |
335 | wxString m_viewTypeName; | |
336 | wxDocManager* m_documentManager; | |
337 | ||
338 | // For dynamic creation of appropriate instances. | |
339 | wxClassInfo* m_docClassInfo; | |
340 | wxClassInfo* m_viewClassInfo; | |
b5f159ac | 341 | |
89d94e04 VZ |
342 | // Called by CreateDocument and CreateView to create the actual |
343 | // document/view object. | |
344 | // | |
345 | // By default uses the ClassInfo provided to the constructor. Override | |
346 | // these functions to provide a different method of creation. | |
69936aea VZ |
347 | virtual wxDocument *DoCreateDocument(); |
348 | virtual wxView *DoCreateView(); | |
349 | ||
2b5f62a0 VZ |
350 | private: |
351 | DECLARE_CLASS(wxDocTemplate) | |
c0c133e1 | 352 | wxDECLARE_NO_COPY_CLASS(wxDocTemplate); |
c801d85f KB |
353 | }; |
354 | ||
caf0debf VZ |
355 | // One object of this class may be created in an application, to manage all |
356 | // the templates and documents. | |
53a2db12 | 357 | class WXDLLIMPEXP_CORE wxDocManager: public wxEvtHandler |
c801d85f | 358 | { |
caf0debf | 359 | public: |
c77049a0 VZ |
360 | // NB: flags are unused, don't pass wxDOC_XXX to this ctor |
361 | wxDocManager(long flags = 0, bool initialize = true); | |
d3c7fc99 | 362 | virtual ~wxDocManager(); |
caf0debf VZ |
363 | |
364 | virtual bool Initialize(); | |
365 | ||
366 | // Handlers for common user commands | |
367 | void OnFileClose(wxCommandEvent& event); | |
33a20136 | 368 | void OnFileCloseAll(wxCommandEvent& event); |
caf0debf VZ |
369 | void OnFileNew(wxCommandEvent& event); |
370 | void OnFileOpen(wxCommandEvent& event); | |
371 | void OnFileRevert(wxCommandEvent& event); | |
372 | void OnFileSave(wxCommandEvent& event); | |
373 | void OnFileSaveAs(wxCommandEvent& event); | |
b99017ce | 374 | #if wxUSE_PRINTING_ARCHITECTURE |
caf0debf | 375 | void OnPrint(wxCommandEvent& event); |
caf0debf | 376 | void OnPreview(wxCommandEvent& event); |
b99017ce VZ |
377 | void OnPageSetup(wxCommandEvent& event); |
378 | #endif // wxUSE_PRINTING_ARCHITECTURE | |
caf0debf VZ |
379 | void OnUndo(wxCommandEvent& event); |
380 | void OnRedo(wxCommandEvent& event); | |
381 | ||
f2506310 JS |
382 | // Handlers for UI update commands |
383 | void OnUpdateFileOpen(wxUpdateUIEvent& event); | |
c77049a0 | 384 | void OnUpdateDisableIfNoDoc(wxUpdateUIEvent& event); |
4311588b | 385 | void OnUpdateFileRevert(wxUpdateUIEvent& event); |
f2506310 JS |
386 | void OnUpdateFileNew(wxUpdateUIEvent& event); |
387 | void OnUpdateFileSave(wxUpdateUIEvent& event); | |
f2506310 JS |
388 | void OnUpdateUndo(wxUpdateUIEvent& event); |
389 | void OnUpdateRedo(wxUpdateUIEvent& event); | |
390 | ||
5f170f33 VZ |
391 | // called when file format detection didn't work, can be overridden to do |
392 | // something in this case | |
0a0352f2 | 393 | virtual void OnOpenFileFailure() { } |
5f170f33 | 394 | |
caf0debf | 395 | virtual wxDocument *CreateDocument(const wxString& path, long flags = 0); |
b5412983 VZ |
396 | |
397 | // wrapper around CreateDocument() with a more clear name | |
398 | wxDocument *CreateNewDocument() | |
399 | { return CreateDocument(wxString(), wxDOC_NEW); } | |
400 | ||
caf0debf VZ |
401 | virtual wxView *CreateView(wxDocument *doc, long flags = 0); |
402 | virtual void DeleteTemplate(wxDocTemplate *temp, long flags = 0); | |
403 | virtual bool FlushDoc(wxDocument *doc); | |
404 | virtual wxDocTemplate *MatchTemplate(const wxString& path); | |
405 | virtual wxDocTemplate *SelectDocumentPath(wxDocTemplate **templates, | |
68379eaf | 406 | int noTemplates, wxString& path, long flags, bool save = false); |
caf0debf | 407 | virtual wxDocTemplate *SelectDocumentType(wxDocTemplate **templates, |
68379eaf | 408 | int noTemplates, bool sort = false); |
caf0debf | 409 | virtual wxDocTemplate *SelectViewType(wxDocTemplate **templates, |
68379eaf | 410 | int noTemplates, bool sort = false); |
caf0debf VZ |
411 | virtual wxDocTemplate *FindTemplateForPath(const wxString& path); |
412 | ||
413 | void AssociateTemplate(wxDocTemplate *temp); | |
414 | void DisassociateTemplate(wxDocTemplate *temp); | |
415 | ||
416 | wxDocument *GetCurrentDocument() const; | |
417 | ||
418 | void SetMaxDocsOpen(int n) { m_maxDocsOpen = n; } | |
419 | int GetMaxDocsOpen() const { return m_maxDocsOpen; } | |
420 | ||
421 | // Add and remove a document from the manager's list | |
422 | void AddDocument(wxDocument *doc); | |
423 | void RemoveDocument(wxDocument *doc); | |
424 | ||
33a20136 | 425 | // closes all currently open documents |
68379eaf | 426 | bool CloseDocuments(bool force = true); |
33a20136 | 427 | |
b72b1920 | 428 | // closes the specified document |
68379eaf | 429 | bool CloseDocument(wxDocument* doc, bool force = false); |
b72b1920 | 430 | |
caf0debf | 431 | // Clear remaining documents and templates |
68379eaf | 432 | bool Clear(bool force = true); |
caf0debf VZ |
433 | |
434 | // Views or windows should inform the document manager | |
435 | // when a view is going in or out of focus | |
68379eaf | 436 | virtual void ActivateView(wxView *view, bool activate = true); |
575e4cd6 | 437 | virtual wxView *GetCurrentView() const { return m_currentView; } |
caf0debf | 438 | |
0b237b67 JS |
439 | wxList& GetDocuments() { return m_docs; } |
440 | wxList& GetTemplates() { return m_templates; } | |
caf0debf | 441 | |
724b119a VZ |
442 | // Return the default name for a new document (by default returns strings |
443 | // in the form "unnamed <counter>" but can be overridden) | |
444 | virtual wxString MakeNewDocumentName(); | |
caf0debf | 445 | |
f2506310 JS |
446 | // Make a frame title (override this to do something different) |
447 | virtual wxString MakeFrameTitle(wxDocument* doc); | |
448 | ||
caf0debf VZ |
449 | virtual wxFileHistory *OnCreateFileHistory(); |
450 | virtual wxFileHistory *GetFileHistory() const { return m_fileHistory; } | |
451 | ||
452 | // File history management | |
453 | virtual void AddFileToHistory(const wxString& file); | |
e49c85af | 454 | virtual void RemoveFileFromHistory(size_t i); |
7af6b69e | 455 | virtual size_t GetHistoryFilesCount() const; |
e49c85af | 456 | virtual wxString GetHistoryFile(size_t i) const; |
caf0debf VZ |
457 | virtual void FileHistoryUseMenu(wxMenu *menu); |
458 | virtual void FileHistoryRemoveMenu(wxMenu *menu); | |
702ca7c0 | 459 | #if wxUSE_CONFIG |
9c8116f8 | 460 | virtual void FileHistoryLoad(const wxConfigBase& config); |
caf0debf VZ |
461 | virtual void FileHistorySave(wxConfigBase& config); |
462 | #endif // wxUSE_CONFIG | |
463 | ||
464 | virtual void FileHistoryAddFilesToMenu(); | |
465 | virtual void FileHistoryAddFilesToMenu(wxMenu* menu); | |
466 | ||
d8efd219 | 467 | wxString GetLastDirectory() const; |
7af6b69e | 468 | void SetLastDirectory(const wxString& dir) { m_lastDirectory = dir; } |
ac0ac824 | 469 | |
f2506310 JS |
470 | // Get the current document manager |
471 | static wxDocManager* GetDocumentManager() { return sm_docManager; } | |
472 | ||
724b119a VZ |
473 | #if WXWIN_COMPATIBILITY_2_8 |
474 | // deprecated, override GetDefaultName() instead | |
475 | wxDEPRECATED_BUT_USED_INTERNALLY( | |
476 | virtual bool MakeDefaultName(wxString& buf) | |
477 | ); | |
478 | #endif | |
479 | ||
ca3e85cf | 480 | #if WXWIN_COMPATIBILITY_2_6 |
b5f159ac VZ |
481 | // deprecated, use GetHistoryFilesCount() instead |
482 | wxDEPRECATED( size_t GetNoHistoryFiles() const ); | |
ca3e85cf | 483 | #endif // WXWIN_COMPATIBILITY_2_6 |
7af6b69e | 484 | |
b99017ce | 485 | |
caf0debf | 486 | protected: |
94dc70d1 VZ |
487 | #if wxUSE_PRINTING_ARCHITECTURE |
488 | virtual wxPreviewFrame* CreatePreviewFrame(wxPrintPreviewBase* preview, | |
489 | wxWindow *parent, | |
490 | const wxString& title); | |
491 | #endif // wxUSE_PRINTING_ARCHITECTURE | |
492 | ||
bba5e72a | 493 | // hook the currently active view into event handlers chain here |
8cc208e3 | 494 | virtual bool TryBefore(wxEvent& event); |
bba5e72a | 495 | |
89d94e04 VZ |
496 | // return the command processor for the current document, if any |
497 | wxCommandProcessor *GetCurrentCommandProcessor() const; | |
498 | ||
575e4cd6 VZ |
499 | // this method tries to find an active view harder than GetCurrentView(): |
500 | // if the latter is NULL, it also checks if we don't have just a single | |
501 | // view and returns it then | |
502 | wxView *GetActiveView() const; | |
503 | ||
8325504f VZ |
504 | // activate the first view of the given document if any |
505 | void ActivateDocument(wxDocument *doc); | |
506 | ||
89d94e04 | 507 | |
caf0debf VZ |
508 | int m_defaultDocumentNameCounter; |
509 | int m_maxDocsOpen; | |
510 | wxList m_docs; | |
511 | wxList m_templates; | |
512 | wxView* m_currentView; | |
513 | wxFileHistory* m_fileHistory; | |
ac0ac824 | 514 | wxString m_lastDirectory; |
f2506310 | 515 | static wxDocManager* sm_docManager; |
caf0debf | 516 | |
b99017ce VZ |
517 | #if wxUSE_PRINTING_ARCHITECTURE |
518 | wxPageSetupDialogData m_pageSetupDialogData; | |
519 | #endif // wxUSE_PRINTING_ARCHITECTURE | |
520 | ||
caf0debf | 521 | DECLARE_EVENT_TABLE() |
b5f159ac | 522 | DECLARE_DYNAMIC_CLASS(wxDocManager) |
c0c133e1 | 523 | wxDECLARE_NO_COPY_CLASS(wxDocManager); |
c801d85f KB |
524 | }; |
525 | ||
ca3e85cf | 526 | #if WXWIN_COMPATIBILITY_2_6 |
b5f159ac VZ |
527 | inline size_t wxDocManager::GetNoHistoryFiles() const |
528 | { | |
529 | return GetHistoryFilesCount(); | |
530 | } | |
ca3e85cf | 531 | #endif // WXWIN_COMPATIBILITY_2_6 |
b5f159ac | 532 | |
caf0debf | 533 | // ---------------------------------------------------------------------------- |
a9e2e6e5 VZ |
534 | // Base class for child frames -- this is what wxView renders itself into |
535 | // | |
536 | // Notice that this is a mix-in class so it doesn't derive from wxWindow, only | |
537 | // wxDocChildFrameAny does | |
caf0debf | 538 | // ---------------------------------------------------------------------------- |
c801d85f | 539 | |
73bde1ef | 540 | class WXDLLIMPEXP_CORE wxDocChildFrameAnyBase |
c801d85f | 541 | { |
caf0debf | 542 | public: |
c65c67be | 543 | // default ctor, use Create() after it |
e5033ed2 VZ |
544 | wxDocChildFrameAnyBase() |
545 | { | |
546 | m_childDocument = NULL; | |
547 | m_childView = NULL; | |
548 | m_win = NULL; | |
549 | } | |
c65c67be VZ |
550 | |
551 | // full ctor equivalent to using the default one and Create(0 | |
ada1ff0d | 552 | wxDocChildFrameAnyBase(wxDocument *doc, wxView *view, wxWindow *win) |
c65c67be VZ |
553 | { |
554 | Create(doc, view, win); | |
555 | } | |
556 | ||
557 | // method which must be called for an object created using the default ctor | |
558 | // | |
559 | // note that it returns bool just for consistency with Create() methods in | |
560 | // other classes, we never return false from here | |
561 | bool Create(wxDocument *doc, wxView *view, wxWindow *win) | |
a9e2e6e5 VZ |
562 | { |
563 | m_childDocument = doc; | |
564 | m_childView = view; | |
c65c67be | 565 | m_win = win; |
caf0debf | 566 | |
a9e2e6e5 VZ |
567 | if ( view ) |
568 | view->SetDocChildFrame(this); | |
c65c67be VZ |
569 | |
570 | return true; | |
a9e2e6e5 | 571 | } |
caf0debf | 572 | |
c65c67be VZ |
573 | // dtor doesn't need to be virtual, an object should never be destroyed via |
574 | // a pointer to this class | |
b7341fe0 VZ |
575 | ~wxDocChildFrameAnyBase() |
576 | { | |
577 | // prevent the view from deleting us if we're being deleted directly | |
578 | // (and not via Close() + Destroy()) | |
579 | if ( m_childView ) | |
580 | m_childView->SetDocChildFrame(NULL); | |
581 | } | |
582 | ||
caf0debf VZ |
583 | wxDocument *GetDocument() const { return m_childDocument; } |
584 | wxView *GetView() const { return m_childView; } | |
585 | void SetDocument(wxDocument *doc) { m_childDocument = doc; } | |
586 | void SetView(wxView *view) { m_childView = view; } | |
587 | ||
ada1ff0d VZ |
588 | wxWindow *GetWindow() const { return m_win; } |
589 | ||
caf0debf | 590 | protected: |
a9e2e6e5 VZ |
591 | // we're not a wxEvtHandler but we provide this wxEvtHandler-like function |
592 | // which is called from TryBefore() of the derived classes to give our view | |
593 | // a chance to process the message before the frame event handlers are used | |
594 | bool TryProcessEvent(wxEvent& event) | |
595 | { | |
44070fd3 | 596 | return m_childView && m_childView->ProcessEventLocally(event); |
a9e2e6e5 VZ |
597 | } |
598 | ||
599 | // called from EVT_CLOSE handler in the frame: check if we can close and do | |
600 | // cleanup if so; veto the event otherwise | |
601 | bool CloseView(wxCloseEvent& event); | |
602 | ||
bba5e72a | 603 | |
caf0debf VZ |
604 | wxDocument* m_childDocument; |
605 | wxView* m_childView; | |
606 | ||
ada1ff0d VZ |
607 | // the associated window: having it here is not terribly elegant but it |
608 | // allows us to avoid having any virtual functions in this class | |
c65c67be | 609 | wxWindow* m_win; |
ada1ff0d VZ |
610 | |
611 | ||
a9e2e6e5 VZ |
612 | wxDECLARE_NO_COPY_CLASS(wxDocChildFrameAnyBase); |
613 | }; | |
614 | ||
615 | // ---------------------------------------------------------------------------- | |
616 | // Template implementing child frame concept using the given wxFrame-like class | |
617 | // | |
618 | // This is used to define wxDocChildFrame and wxDocMDIChildFrame: ChildFrame is | |
619 | // a wxFrame or wxMDIChildFrame (although in theory it could be any wxWindow- | |
620 | // derived class as long as it provided a ctor with the same signature as | |
621 | // wxFrame and OnActivate() method) and ParentFrame is either wxFrame or | |
622 | // wxMDIParentFrame. | |
623 | // ---------------------------------------------------------------------------- | |
624 | ||
625 | template <class ChildFrame, class ParentFrame> | |
626 | class WXDLLIMPEXP_CORE wxDocChildFrameAny : public ChildFrame, | |
627 | public wxDocChildFrameAnyBase | |
628 | { | |
629 | public: | |
630 | typedef ChildFrame BaseClass; | |
631 | ||
c65c67be VZ |
632 | // default ctor, use Create after it |
633 | wxDocChildFrameAny() { } | |
634 | ||
a9e2e6e5 VZ |
635 | // ctor for a frame showing the given view of the specified document |
636 | wxDocChildFrameAny(wxDocument *doc, | |
637 | wxView *view, | |
638 | ParentFrame *parent, | |
639 | wxWindowID id, | |
640 | const wxString& title, | |
641 | const wxPoint& pos = wxDefaultPosition, | |
642 | const wxSize& size = wxDefaultSize, | |
643 | long style = wxDEFAULT_FRAME_STYLE, | |
644 | const wxString& name = wxFrameNameStr) | |
a9e2e6e5 | 645 | { |
c65c67be VZ |
646 | Create(doc, view, parent, id, title, pos, size, style, name); |
647 | } | |
648 | ||
649 | bool Create(wxDocument *doc, | |
650 | wxView *view, | |
651 | ParentFrame *parent, | |
652 | wxWindowID id, | |
653 | const wxString& title, | |
654 | const wxPoint& pos = wxDefaultPosition, | |
655 | const wxSize& size = wxDefaultSize, | |
656 | long style = wxDEFAULT_FRAME_STYLE, | |
657 | const wxString& name = wxFrameNameStr) | |
658 | { | |
e5033ed2 | 659 | if ( !wxDocChildFrameAnyBase::Create(doc, view, this) ) |
c65c67be VZ |
660 | return false; |
661 | ||
e5033ed2 | 662 | if ( !BaseClass::Create(parent, id, title, pos, size, style, name) ) |
c65c67be VZ |
663 | return false; |
664 | ||
a9e2e6e5 VZ |
665 | this->Connect(wxEVT_ACTIVATE, |
666 | wxActivateEventHandler(wxDocChildFrameAny::OnActivate)); | |
667 | this->Connect(wxEVT_CLOSE_WINDOW, | |
668 | wxCloseEventHandler(wxDocChildFrameAny::OnCloseWindow)); | |
c65c67be VZ |
669 | |
670 | return true; | |
a9e2e6e5 VZ |
671 | } |
672 | ||
673 | virtual bool Destroy() | |
674 | { | |
675 | // FIXME: why exactly do we do this? to avoid activation events during | |
676 | // destructions maybe? | |
677 | m_childView = NULL; | |
678 | return BaseClass::Destroy(); | |
679 | } | |
680 | ||
681 | protected: | |
682 | // hook the child view into event handlers chain here | |
683 | virtual bool TryBefore(wxEvent& event) | |
684 | { | |
685 | return TryProcessEvent(event) || BaseClass::TryBefore(event); | |
686 | } | |
687 | ||
688 | private: | |
689 | void OnActivate(wxActivateEvent& event) | |
690 | { | |
691 | BaseClass::OnActivate(event); | |
692 | ||
693 | if ( m_childView ) | |
694 | m_childView->Activate(event.GetActive()); | |
695 | } | |
696 | ||
697 | void OnCloseWindow(wxCloseEvent& event) | |
698 | { | |
699 | if ( CloseView(event) ) | |
700 | Destroy(); | |
701 | //else: vetoed | |
702 | } | |
703 | ||
704 | wxDECLARE_NO_COPY_TEMPLATE_CLASS_2(wxDocChildFrameAny, | |
705 | ChildFrame, ParentFrame); | |
706 | }; | |
707 | ||
708 | // ---------------------------------------------------------------------------- | |
709 | // A default child frame: we need to define it as a class just for wxRTTI, | |
710 | // otherwise we could simply typedef it | |
711 | // ---------------------------------------------------------------------------- | |
712 | ||
27d77a59 VZ |
713 | #ifdef __VISUALC6__ |
714 | // "non dll-interface class 'wxDocChildFrameAny<>' used as base interface | |
715 | // for dll-interface class 'wxDocChildFrame'" -- this is bogus as the | |
716 | // template will be DLL-exported but only once it is used as base class | |
717 | // here! | |
fb330c2e | 718 | #pragma warning (push) |
27d77a59 VZ |
719 | #pragma warning (disable:4275) |
720 | #endif | |
721 | ||
a9e2e6e5 VZ |
722 | typedef wxDocChildFrameAny<wxFrame, wxFrame> wxDocChildFrameBase; |
723 | ||
724 | class WXDLLIMPEXP_CORE wxDocChildFrame : public wxDocChildFrameBase | |
725 | { | |
726 | public: | |
c65c67be VZ |
727 | wxDocChildFrame() |
728 | { | |
729 | } | |
730 | ||
a9e2e6e5 VZ |
731 | wxDocChildFrame(wxDocument *doc, |
732 | wxView *view, | |
733 | wxFrame *parent, | |
734 | wxWindowID id, | |
735 | const wxString& title, | |
736 | const wxPoint& pos = wxDefaultPosition, | |
737 | const wxSize& size = wxDefaultSize, | |
738 | long style = wxDEFAULT_FRAME_STYLE, | |
739 | const wxString& name = wxFrameNameStr) | |
740 | : wxDocChildFrameBase(doc, view, | |
741 | parent, id, title, pos, size, style, name) | |
742 | { | |
743 | } | |
744 | ||
c65c67be VZ |
745 | bool Create(wxDocument *doc, |
746 | wxView *view, | |
747 | wxFrame *parent, | |
748 | wxWindowID id, | |
749 | const wxString& title, | |
750 | const wxPoint& pos = wxDefaultPosition, | |
751 | const wxSize& size = wxDefaultSize, | |
752 | long style = wxDEFAULT_FRAME_STYLE, | |
753 | const wxString& name = wxFrameNameStr) | |
754 | { | |
755 | return wxDocChildFrameBase::Create | |
756 | ( | |
757 | doc, view, | |
758 | parent, id, title, pos, size, style, name | |
759 | ); | |
760 | } | |
761 | ||
2b5f62a0 VZ |
762 | private: |
763 | DECLARE_CLASS(wxDocChildFrame) | |
c0c133e1 | 764 | wxDECLARE_NO_COPY_CLASS(wxDocChildFrame); |
caf0debf | 765 | }; |
c801d85f | 766 | |
caf0debf | 767 | // ---------------------------------------------------------------------------- |
c48bdb0c VZ |
768 | // wxDocParentFrame and related classes. |
769 | // | |
770 | // As with wxDocChildFrame we define a template base class used by both normal | |
771 | // and MDI versions | |
caf0debf | 772 | // ---------------------------------------------------------------------------- |
c801d85f | 773 | |
c48bdb0c VZ |
774 | // Base class containing type-independent code of wxDocParentFrameAny |
775 | // | |
776 | // Similarly to wxDocChildFrameAnyBase, this class is a mix-in and doesn't | |
777 | // derive from wxWindow. | |
778 | class WXDLLIMPEXP_CORE wxDocParentFrameAnyBase | |
caf0debf | 779 | { |
caf0debf | 780 | public: |
c48bdb0c VZ |
781 | wxDocParentFrameAnyBase() { m_docManager = NULL; } |
782 | ||
783 | wxDocManager *GetDocumentManager() const { return m_docManager; } | |
784 | ||
785 | protected: | |
786 | // Open the MRU file with the given index in our associated file history. | |
787 | // | |
788 | // This is called from the derived class event handler for the MRU menu | |
789 | // items. | |
790 | void DoOpenMRUFile(unsigned n); | |
791 | ||
792 | wxDocManager *m_docManager; | |
793 | ||
794 | wxDECLARE_NO_COPY_CLASS(wxDocParentFrameAnyBase); | |
795 | }; | |
796 | ||
797 | // This is similar to wxDocChildFrameAny and is used to provide common | |
798 | // implementation for both wxDocParentFrame and wxDocMDIParentFrame | |
799 | template <class BaseFrame> | |
800 | class WXDLLIMPEXP_CORE wxDocParentFrameAny : public BaseFrame, | |
801 | public wxDocParentFrameAnyBase | |
802 | { | |
803 | public: | |
804 | wxDocParentFrameAny() { } | |
805 | wxDocParentFrameAny(wxDocManager *manager, | |
806 | wxFrame *frame, | |
807 | wxWindowID id, | |
808 | const wxString& title, | |
809 | const wxPoint& pos = wxDefaultPosition, | |
810 | const wxSize& size = wxDefaultSize, | |
811 | long style = wxDEFAULT_FRAME_STYLE, | |
812 | const wxString& name = wxFrameNameStr) | |
813 | { | |
814 | Create(manager, frame, id, title, pos, size, style, name); | |
815 | } | |
0c246b3c PC |
816 | |
817 | bool Create(wxDocManager *manager, | |
818 | wxFrame *frame, | |
819 | wxWindowID id, | |
820 | const wxString& title, | |
821 | const wxPoint& pos = wxDefaultPosition, | |
822 | const wxSize& size = wxDefaultSize, | |
823 | long style = wxDEFAULT_FRAME_STYLE, | |
c48bdb0c VZ |
824 | const wxString& name = wxFrameNameStr) |
825 | { | |
826 | m_docManager = manager; | |
c801d85f | 827 | |
c48bdb0c VZ |
828 | if ( !BaseFrame::Create(frame, id, title, pos, size, style, name) ) |
829 | return false; | |
830 | ||
831 | this->Connect(wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED, | |
832 | wxCommandEventHandler(wxDocParentFrameAny::OnExit)); | |
833 | this->Connect(wxID_FILE1, wxID_FILE9, wxEVT_COMMAND_MENU_SELECTED, | |
834 | wxCommandEventHandler(wxDocParentFrameAny::OnMRUFile)); | |
835 | this->Connect(wxEVT_CLOSE_WINDOW, | |
836 | wxCloseEventHandler(wxDocParentFrameAny::OnCloseWindow)); | |
c801d85f | 837 | |
c48bdb0c VZ |
838 | return true; |
839 | } | |
c801d85f | 840 | |
caf0debf | 841 | protected: |
bba5e72a | 842 | // hook the document manager into event handling chain here |
c48bdb0c VZ |
843 | virtual bool TryBefore(wxEvent& event) |
844 | { | |
845 | if ( m_docManager && m_docManager->ProcessEventLocally(event) ) | |
846 | return true; | |
bba5e72a | 847 | |
c48bdb0c VZ |
848 | return BaseFrame::TryBefore(event); |
849 | } | |
850 | ||
851 | private: | |
852 | void OnExit(wxCommandEvent& WXUNUSED(event)) | |
853 | { | |
854 | this->Close(); | |
855 | } | |
856 | ||
857 | void OnMRUFile(wxCommandEvent& event) | |
858 | { | |
859 | DoOpenMRUFile(event.GetId() - wxID_FILE1); | |
860 | } | |
861 | ||
862 | void OnCloseWindow(wxCloseEvent& event) | |
863 | { | |
864 | if ( m_docManager && !m_docManager->Clear(!event.CanVeto()) ) | |
865 | { | |
866 | // The user decided not to close finally, abort. | |
867 | event.Veto(); | |
868 | } | |
869 | else | |
870 | { | |
871 | // Just skip the event, base class handler will destroy the window. | |
872 | event.Skip(); | |
873 | } | |
874 | } | |
875 | ||
876 | ||
877 | wxDECLARE_NO_COPY_CLASS(wxDocParentFrameAny); | |
878 | }; | |
879 | ||
880 | typedef wxDocParentFrameAny<wxFrame> wxDocParentFrameBase; | |
881 | ||
882 | class WXDLLIMPEXP_CORE wxDocParentFrame : public wxDocParentFrameBase | |
883 | { | |
884 | public: | |
885 | wxDocParentFrame() : wxDocParentFrameBase() { } | |
886 | ||
887 | wxDocParentFrame(wxDocManager *manager, | |
888 | wxFrame *parent, | |
889 | wxWindowID id, | |
890 | const wxString& title, | |
891 | const wxPoint& pos = wxDefaultPosition, | |
892 | const wxSize& size = wxDefaultSize, | |
893 | long style = wxDEFAULT_FRAME_STYLE, | |
894 | const wxString& name = wxFrameNameStr) | |
895 | : wxDocParentFrameBase(manager, | |
896 | parent, id, title, pos, size, style, name) | |
897 | { | |
898 | } | |
899 | ||
900 | bool Create(wxDocManager *manager, | |
901 | wxFrame *parent, | |
902 | wxWindowID id, | |
903 | const wxString& title, | |
904 | const wxPoint& pos = wxDefaultPosition, | |
905 | const wxSize& size = wxDefaultSize, | |
906 | long style = wxDEFAULT_FRAME_STYLE, | |
907 | const wxString& name = wxFrameNameStr) | |
908 | { | |
909 | return wxDocParentFrameBase::Create(manager, | |
910 | parent, id, title, | |
911 | pos, size, style, name); | |
912 | } | |
caf0debf | 913 | |
2b5f62a0 VZ |
914 | private: |
915 | DECLARE_CLASS(wxDocParentFrame) | |
c0c133e1 | 916 | wxDECLARE_NO_COPY_CLASS(wxDocParentFrame); |
caf0debf | 917 | }; |
c801d85f | 918 | |
c48bdb0c VZ |
919 | #ifdef __VISUALC6__ |
920 | // reenable warning 4275 | |
921 | #pragma warning (pop) | |
922 | #endif | |
923 | ||
caf0debf VZ |
924 | // ---------------------------------------------------------------------------- |
925 | // Provide simple default printing facilities | |
926 | // ---------------------------------------------------------------------------- | |
c801d85f | 927 | |
caf0debf | 928 | #if wxUSE_PRINTING_ARCHITECTURE |
53a2db12 | 929 | class WXDLLIMPEXP_CORE wxDocPrintout : public wxPrintout |
caf0debf | 930 | { |
caf0debf | 931 | public: |
6c4da6d6 | 932 | wxDocPrintout(wxView *view = NULL, const wxString& title = _("Printout")); |
89d94e04 VZ |
933 | |
934 | // implement wxPrintout methods | |
935 | virtual bool OnPrintPage(int page); | |
936 | virtual bool HasPage(int page); | |
937 | virtual bool OnBeginDocument(int startPage, int endPage); | |
938 | virtual void GetPageInfo(int *minPage, int *maxPage, | |
939 | int *selPageFrom, int *selPageTo); | |
c801d85f | 940 | |
caf0debf | 941 | virtual wxView *GetView() { return m_printoutView; } |
c801d85f | 942 | |
caf0debf VZ |
943 | protected: |
944 | wxView* m_printoutView; | |
2b5f62a0 VZ |
945 | |
946 | private: | |
947 | DECLARE_DYNAMIC_CLASS(wxDocPrintout) | |
c0c133e1 | 948 | wxDECLARE_NO_COPY_CLASS(wxDocPrintout); |
c801d85f | 949 | }; |
caf0debf | 950 | #endif // wxUSE_PRINTING_ARCHITECTURE |
c801d85f | 951 | |
c801d85f KB |
952 | // For compatibility with existing file formats: |
953 | // converts from/to a stream to/from a temporary file. | |
89d94e04 VZ |
954 | #if wxUSE_STD_IOSTREAM |
955 | bool WXDLLIMPEXP_CORE | |
956 | wxTransferFileToStream(const wxString& filename, wxSTD ostream& stream); | |
957 | bool WXDLLIMPEXP_CORE | |
958 | wxTransferStreamToFile(wxSTD istream& stream, const wxString& filename); | |
dc1efb1d | 959 | #else |
89d94e04 VZ |
960 | bool WXDLLIMPEXP_CORE |
961 | wxTransferFileToStream(const wxString& filename, wxOutputStream& stream); | |
962 | bool WXDLLIMPEXP_CORE | |
963 | wxTransferStreamToFile(wxInputStream& stream, const wxString& filename); | |
e30285ab VZ |
964 | #endif // wxUSE_STD_IOSTREAM |
965 | ||
c77049a0 VZ |
966 | |
967 | // these flags are not used anywhere by wxWidgets and kept only for an unlikely | |
968 | // case of existing user code using them for its own purposes | |
969 | #ifdef WXWIN_COMPATIBILITY_2_8 | |
970 | enum | |
971 | { | |
972 | wxDOC_SDI = 1, | |
973 | wxDOC_MDI, | |
974 | wxDEFAULT_DOCMAN_FLAGS = wxDOC_SDI | |
975 | }; | |
976 | #endif // WXWIN_COMPATIBILITY_2_8 | |
977 | ||
e30285ab | 978 | #endif // wxUSE_DOC_VIEW_ARCHITECTURE |
c801d85f | 979 | |
caf0debf | 980 | #endif // _WX_DOCH__ |