]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: prntbase.h | |
3 | // Purpose: Base classes for printing framework | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_PRNTBASEH__ | |
13 | #define _WX_PRNTBASEH__ | |
14 | ||
15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) | |
16 | #pragma interface "prntbase.h" | |
17 | #endif | |
18 | ||
19 | #include "wx/defs.h" | |
20 | ||
21 | #if wxUSE_PRINTING_ARCHITECTURE | |
22 | ||
23 | #include "wx/event.h" | |
24 | #include "wx/cmndata.h" | |
25 | #include "wx/panel.h" | |
26 | #include "wx/scrolwin.h" | |
27 | #include "wx/dialog.h" | |
28 | #include "wx/frame.h" | |
29 | ||
30 | class WXDLLEXPORT wxDC; | |
31 | class WXDLLEXPORT wxButton; | |
32 | class WXDLLEXPORT wxChoice; | |
33 | class WXDLLEXPORT wxPrintout; | |
34 | class WXDLLEXPORT wxPrinterBase; | |
35 | class WXDLLEXPORT wxPrintDialog; | |
36 | class WXDLLEXPORT wxPrintDialogBase; | |
37 | class WXDLLEXPORT wxPrintPreviewBase; | |
38 | class WXDLLEXPORT wxPreviewCanvas; | |
39 | class WXDLLEXPORT wxPreviewControlBar; | |
40 | class WXDLLEXPORT wxPreviewFrame; | |
41 | class WXDLLEXPORT wxPrintFactory; | |
42 | class WXDLLEXPORT wxPrintNativeDataBase; | |
43 | ||
44 | //---------------------------------------------------------------------------- | |
45 | // error consts | |
46 | //---------------------------------------------------------------------------- | |
47 | ||
48 | enum wxPrinterError | |
49 | { | |
50 | wxPRINTER_NO_ERROR = 0, | |
51 | wxPRINTER_CANCELLED, | |
52 | wxPRINTER_ERROR | |
53 | }; | |
54 | ||
55 | //---------------------------------------------------------------------------- | |
56 | // wxPrintFactory | |
57 | //---------------------------------------------------------------------------- | |
58 | ||
59 | class WXDLLEXPORT wxPrintFactory | |
60 | { | |
61 | public: | |
62 | wxPrintFactory() {} | |
63 | virtual ~wxPrintFactory() {} | |
64 | ||
65 | virtual wxPrinterBase *CreatePrinter( wxPrintDialogData* data ) = 0; | |
66 | ||
67 | virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview, | |
68 | wxPrintout *printout = NULL, | |
69 | wxPrintDialogData *data = NULL ) = 0; | |
70 | virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview, | |
71 | wxPrintout *printout, | |
72 | wxPrintData *data ) = 0; | |
73 | ||
74 | virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent, | |
75 | wxPrintDialogData *data = NULL ) = 0; | |
76 | virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent, | |
77 | wxPrintData *data ) = 0; | |
78 | ||
79 | // What to do and what to show in the wxPrintDialog | |
80 | // a) Use the generic print setup dialog or a native one? | |
81 | virtual bool HasPrintSetupDialog() = 0; | |
82 | virtual wxDialog *CreatePrintSetupDialog( wxWindow *parent, wxPrintData *data ) = 0; | |
83 | // b) Provide the "print to file" option ourselves or via print setup? | |
84 | virtual bool HasOwnPrintToFile() = 0; | |
85 | // c) Show current printer | |
86 | virtual bool HasPrinterLine() = 0; | |
87 | virtual wxString CreatePrinterLine() = 0; | |
88 | // d) Show Status line for current printer? | |
89 | virtual bool HasStatusLine() = 0; | |
90 | virtual wxString CreateStatusLine() = 0; | |
91 | ||
92 | ||
93 | virtual wxPrintNativeDataBase *CreatePrintNativeData() = 0; | |
94 | ||
95 | static void SetPrintFactory( wxPrintFactory *factory ); | |
96 | static wxPrintFactory *GetFactory(); | |
97 | static wxPrintFactory *m_factory; | |
98 | }; | |
99 | ||
100 | class WXDLLEXPORT wxNativePrintFactory: public wxPrintFactory | |
101 | { | |
102 | public: | |
103 | virtual wxPrinterBase *CreatePrinter( wxPrintDialogData *data ); | |
104 | ||
105 | virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview, | |
106 | wxPrintout *printout = NULL, | |
107 | wxPrintDialogData *data = NULL ); | |
108 | virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview, | |
109 | wxPrintout *printout, | |
110 | wxPrintData *data ); | |
111 | ||
112 | virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent, | |
113 | wxPrintDialogData *data = NULL ); | |
114 | virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent, | |
115 | wxPrintData *data ); | |
116 | ||
117 | virtual bool HasPrintSetupDialog(); | |
118 | virtual wxDialog *CreatePrintSetupDialog( wxWindow *parent, wxPrintData *data ); | |
119 | virtual bool HasOwnPrintToFile(); | |
120 | virtual bool HasPrinterLine(); | |
121 | virtual wxString CreatePrinterLine(); | |
122 | virtual bool HasStatusLine(); | |
123 | virtual wxString CreateStatusLine(); | |
124 | ||
125 | virtual wxPrintNativeDataBase *CreatePrintNativeData(); | |
126 | }; | |
127 | ||
128 | //---------------------------------------------------------------------------- | |
129 | // wxPrintNativeDataBase | |
130 | //---------------------------------------------------------------------------- | |
131 | ||
132 | class WXDLLEXPORT wxPrintNativeDataBase: public wxObject | |
133 | { | |
134 | public: | |
135 | wxPrintNativeDataBase(); | |
136 | virtual ~wxPrintNativeDataBase() {} | |
137 | ||
138 | virtual bool TransferTo( wxPrintData &data ) = 0; | |
139 | virtual bool TransferFrom( const wxPrintData &data ) = 0; | |
140 | ||
141 | virtual bool Ok() const = 0; | |
142 | ||
143 | int m_ref; | |
144 | ||
145 | private: | |
146 | DECLARE_CLASS(wxPrintNativeDataBase) | |
147 | DECLARE_NO_COPY_CLASS(wxPrintNativeDataBase) | |
148 | }; | |
149 | ||
150 | //---------------------------------------------------------------------------- | |
151 | // wxPrinterBase | |
152 | //---------------------------------------------------------------------------- | |
153 | ||
154 | /* | |
155 | * Represents the printer: manages printing a wxPrintout object | |
156 | */ | |
157 | ||
158 | class WXDLLEXPORT wxPrinterBase: public wxObject | |
159 | { | |
160 | public: | |
161 | wxPrinterBase(wxPrintDialogData *data = (wxPrintDialogData *) NULL); | |
162 | virtual ~wxPrinterBase(); | |
163 | ||
164 | virtual wxWindow *CreateAbortWindow(wxWindow *parent, wxPrintout *printout); | |
165 | virtual void ReportError(wxWindow *parent, wxPrintout *printout, const wxString& message); | |
166 | ||
167 | virtual wxPrintDialogData& GetPrintDialogData() const; | |
168 | bool GetAbort() const { return sm_abortIt; } | |
169 | ||
170 | static wxPrinterError GetLastError() { return sm_lastError; } | |
171 | ||
172 | /////////////////////////////////////////////////////////////////////////// | |
173 | // OVERRIDES | |
174 | ||
175 | virtual bool Setup(wxWindow *parent) = 0; | |
176 | virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = true) = 0; | |
177 | virtual wxDC* PrintDialog(wxWindow *parent) = 0; | |
178 | ||
179 | protected: | |
180 | wxPrintDialogData m_printDialogData; | |
181 | wxPrintout* m_currentPrintout; | |
182 | ||
183 | static wxPrinterError sm_lastError; | |
184 | ||
185 | public: | |
186 | static wxWindow* sm_abortWindow; | |
187 | static bool sm_abortIt; | |
188 | ||
189 | private: | |
190 | DECLARE_CLASS(wxPrinterBase) | |
191 | DECLARE_NO_COPY_CLASS(wxPrinterBase) | |
192 | }; | |
193 | ||
194 | //---------------------------------------------------------------------------- | |
195 | // wxPrinter | |
196 | //---------------------------------------------------------------------------- | |
197 | ||
198 | class WXDLLEXPORT wxPrinter: public wxPrinterBase | |
199 | { | |
200 | public: | |
201 | wxPrinter(wxPrintDialogData *data = (wxPrintDialogData *) NULL); | |
202 | virtual ~wxPrinter(); | |
203 | ||
204 | virtual wxWindow *CreateAbortWindow(wxWindow *parent, wxPrintout *printout); | |
205 | virtual void ReportError(wxWindow *parent, wxPrintout *printout, const wxString& message); | |
206 | ||
207 | virtual bool Setup(wxWindow *parent); | |
208 | virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = true); | |
209 | virtual wxDC* PrintDialog(wxWindow *parent); | |
210 | ||
211 | virtual wxPrintDialogData& GetPrintDialogData() const; | |
212 | ||
213 | protected: | |
214 | wxPrinterBase *m_pimpl; | |
215 | ||
216 | private: | |
217 | DECLARE_CLASS(wxPrinter) | |
218 | DECLARE_NO_COPY_CLASS(wxPrinter) | |
219 | }; | |
220 | ||
221 | //---------------------------------------------------------------------------- | |
222 | // wxPrintout | |
223 | //---------------------------------------------------------------------------- | |
224 | ||
225 | /* | |
226 | * Represents an object via which a document may be printed. | |
227 | * The programmer derives from this, overrides (at least) OnPrintPage, | |
228 | * and passes it to a wxPrinter object for printing, or a wxPrintPreview | |
229 | * object for previewing. | |
230 | */ | |
231 | ||
232 | class WXDLLEXPORT wxPrintout: public wxObject | |
233 | { | |
234 | public: | |
235 | wxPrintout(const wxString& title = wxT("Printout")); | |
236 | virtual ~wxPrintout(); | |
237 | ||
238 | virtual bool OnBeginDocument(int startPage, int endPage); | |
239 | virtual void OnEndDocument(); | |
240 | virtual void OnBeginPrinting(); | |
241 | virtual void OnEndPrinting(); | |
242 | ||
243 | // Guaranteed to be before any other functions are called | |
244 | virtual void OnPreparePrinting() { } | |
245 | ||
246 | virtual bool HasPage(int page); | |
247 | virtual bool OnPrintPage(int page) = 0; | |
248 | virtual void GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo); | |
249 | ||
250 | virtual wxString GetTitle() const { return m_printoutTitle; } | |
251 | ||
252 | wxDC *GetDC() const { return m_printoutDC; } | |
253 | void SetDC(wxDC *dc) { m_printoutDC = dc; } | |
254 | void SetPageSizePixels(int w, int h) { m_pageWidthPixels = w; m_pageHeightPixels = h; } | |
255 | void GetPageSizePixels(int *w, int *h) const { *w = m_pageWidthPixels; *h = m_pageHeightPixels; } | |
256 | void SetPageSizeMM(int w, int h) { m_pageWidthMM = w; m_pageHeightMM = h; } | |
257 | void GetPageSizeMM(int *w, int *h) const { *w = m_pageWidthMM; *h = m_pageHeightMM; } | |
258 | ||
259 | void SetPPIScreen(int x, int y) { m_PPIScreenX = x; m_PPIScreenY = y; } | |
260 | void GetPPIScreen(int *x, int *y) const { *x = m_PPIScreenX; *y = m_PPIScreenY; } | |
261 | void SetPPIPrinter(int x, int y) { m_PPIPrinterX = x; m_PPIPrinterY = y; } | |
262 | void GetPPIPrinter(int *x, int *y) const { *x = m_PPIPrinterX; *y = m_PPIPrinterY; } | |
263 | ||
264 | virtual bool IsPreview() const { return m_isPreview; } | |
265 | ||
266 | virtual void SetIsPreview(bool p) { m_isPreview = p; } | |
267 | ||
268 | private: | |
269 | wxString m_printoutTitle; | |
270 | wxDC* m_printoutDC; | |
271 | ||
272 | int m_pageWidthPixels; | |
273 | int m_pageHeightPixels; | |
274 | ||
275 | int m_pageWidthMM; | |
276 | int m_pageHeightMM; | |
277 | ||
278 | int m_PPIScreenX; | |
279 | int m_PPIScreenY; | |
280 | int m_PPIPrinterX; | |
281 | int m_PPIPrinterY; | |
282 | ||
283 | bool m_isPreview; | |
284 | ||
285 | private: | |
286 | DECLARE_ABSTRACT_CLASS(wxPrintout) | |
287 | DECLARE_NO_COPY_CLASS(wxPrintout) | |
288 | }; | |
289 | ||
290 | /* | |
291 | * wxPreviewCanvas | |
292 | * Canvas upon which a preview is drawn. | |
293 | */ | |
294 | ||
295 | class WXDLLEXPORT wxPreviewCanvas: public wxScrolledWindow | |
296 | { | |
297 | public: | |
298 | wxPreviewCanvas(wxPrintPreviewBase *preview, | |
299 | wxWindow *parent, | |
300 | const wxPoint& pos = wxDefaultPosition, | |
301 | const wxSize& size = wxDefaultSize, | |
302 | long style = 0, | |
303 | const wxString& name = wxT("canvas")); | |
304 | ~wxPreviewCanvas(); | |
305 | ||
306 | void OnPaint(wxPaintEvent& event); | |
307 | void OnChar(wxKeyEvent &event); | |
308 | ||
309 | // Responds to colour changes | |
310 | void OnSysColourChanged(wxSysColourChangedEvent& event); | |
311 | ||
312 | private: | |
313 | wxPrintPreviewBase* m_printPreview; | |
314 | ||
315 | DECLARE_CLASS(wxPreviewCanvas) | |
316 | DECLARE_EVENT_TABLE() | |
317 | DECLARE_NO_COPY_CLASS(wxPreviewCanvas) | |
318 | }; | |
319 | ||
320 | /* | |
321 | * wxPreviewFrame | |
322 | * Default frame for showing preview. | |
323 | */ | |
324 | ||
325 | class WXDLLEXPORT wxPreviewFrame: public wxFrame | |
326 | { | |
327 | public: | |
328 | wxPreviewFrame(wxPrintPreviewBase *preview, | |
329 | wxWindow *parent, | |
330 | const wxString& title = wxT("Print Preview"), | |
331 | const wxPoint& pos = wxDefaultPosition, | |
332 | const wxSize& size = wxDefaultSize, | |
333 | long style = wxDEFAULT_FRAME_STYLE, | |
334 | const wxString& name = wxT("frame")); | |
335 | ~wxPreviewFrame(); | |
336 | ||
337 | void OnCloseWindow(wxCloseEvent& event); | |
338 | virtual void Initialize(); | |
339 | virtual void CreateCanvas(); | |
340 | virtual void CreateControlBar(); | |
341 | ||
342 | inline wxPreviewControlBar* GetControlBar() const { return m_controlBar; } | |
343 | ||
344 | protected: | |
345 | wxPreviewCanvas* m_previewCanvas; | |
346 | wxPreviewControlBar* m_controlBar; | |
347 | wxPrintPreviewBase* m_printPreview; | |
348 | wxWindowDisabler* m_windowDisabler; | |
349 | ||
350 | private: | |
351 | DECLARE_CLASS(wxPreviewFrame) | |
352 | DECLARE_EVENT_TABLE() | |
353 | DECLARE_NO_COPY_CLASS(wxPreviewFrame) | |
354 | }; | |
355 | ||
356 | /* | |
357 | * wxPreviewControlBar | |
358 | * A panel with buttons for controlling a print preview. | |
359 | * The programmer may wish to use other means for controlling | |
360 | * the print preview. | |
361 | */ | |
362 | ||
363 | #define wxPREVIEW_PRINT 1 | |
364 | #define wxPREVIEW_PREVIOUS 2 | |
365 | #define wxPREVIEW_NEXT 4 | |
366 | #define wxPREVIEW_ZOOM 8 | |
367 | #define wxPREVIEW_FIRST 16 | |
368 | #define wxPREVIEW_LAST 32 | |
369 | #define wxPREVIEW_GOTO 64 | |
370 | ||
371 | #define wxPREVIEW_DEFAULT wxPREVIEW_PREVIOUS|wxPREVIEW_NEXT|wxPREVIEW_ZOOM\ | |
372 | |wxPREVIEW_FIRST|wxPREVIEW_GOTO|wxPREVIEW_LAST | |
373 | ||
374 | // Ids for controls | |
375 | #define wxID_PREVIEW_CLOSE 1 | |
376 | #define wxID_PREVIEW_NEXT 2 | |
377 | #define wxID_PREVIEW_PREVIOUS 3 | |
378 | #define wxID_PREVIEW_PRINT 4 | |
379 | #define wxID_PREVIEW_ZOOM 5 | |
380 | #define wxID_PREVIEW_FIRST 6 | |
381 | #define wxID_PREVIEW_LAST 7 | |
382 | #define wxID_PREVIEW_GOTO 8 | |
383 | ||
384 | class WXDLLEXPORT wxPreviewControlBar: public wxPanel | |
385 | { | |
386 | DECLARE_CLASS(wxPreviewControlBar) | |
387 | ||
388 | public: | |
389 | wxPreviewControlBar(wxPrintPreviewBase *preview, | |
390 | long buttons, | |
391 | wxWindow *parent, | |
392 | const wxPoint& pos = wxDefaultPosition, | |
393 | const wxSize& size = wxDefaultSize, | |
394 | long style = wxTAB_TRAVERSAL, | |
395 | const wxString& name = wxT("panel")); | |
396 | ~wxPreviewControlBar(); | |
397 | ||
398 | virtual void CreateButtons(); | |
399 | virtual void SetZoomControl(int zoom); | |
400 | virtual int GetZoomControl(); | |
401 | virtual wxPrintPreviewBase *GetPrintPreview() const | |
402 | { return m_printPreview; } | |
403 | ||
404 | void OnWindowClose(wxCommandEvent& event); | |
405 | void OnNext(); | |
406 | void OnPrevious(); | |
407 | void OnFirst(); | |
408 | void OnLast(); | |
409 | void OnGoto(); | |
410 | void OnPrint(); | |
411 | void OnPrintButton(wxCommandEvent& WXUNUSED(event)) { OnPrint(); } | |
412 | void OnNextButton(wxCommandEvent & WXUNUSED(event)) { OnNext(); } | |
413 | void OnPreviousButton(wxCommandEvent & WXUNUSED(event)) { OnPrevious(); } | |
414 | void OnFirstButton(wxCommandEvent & WXUNUSED(event)) { OnFirst(); } | |
415 | void OnLastButton(wxCommandEvent & WXUNUSED(event)) { OnLast(); } | |
416 | void OnGotoButton(wxCommandEvent & WXUNUSED(event)) { OnGoto(); } | |
417 | void OnZoom(wxCommandEvent& event); | |
418 | void OnPaint(wxPaintEvent& event); | |
419 | ||
420 | protected: | |
421 | wxPrintPreviewBase* m_printPreview; | |
422 | wxButton* m_closeButton; | |
423 | wxButton* m_nextPageButton; | |
424 | wxButton* m_previousPageButton; | |
425 | wxButton* m_printButton; | |
426 | wxChoice* m_zoomControl; | |
427 | wxButton* m_firstPageButton; | |
428 | wxButton* m_lastPageButton; | |
429 | wxButton* m_gotoPageButton; | |
430 | long m_buttonFlags; | |
431 | ||
432 | private: | |
433 | DECLARE_EVENT_TABLE() | |
434 | DECLARE_NO_COPY_CLASS(wxPreviewControlBar) | |
435 | }; | |
436 | ||
437 | //---------------------------------------------------------------------------- | |
438 | // wxPrintPreviewBase | |
439 | //---------------------------------------------------------------------------- | |
440 | ||
441 | /* | |
442 | * Programmer creates an object of this class to preview a wxPrintout. | |
443 | */ | |
444 | ||
445 | class WXDLLEXPORT wxPrintPreviewBase: public wxObject | |
446 | { | |
447 | public: | |
448 | wxPrintPreviewBase(wxPrintout *printout, | |
449 | wxPrintout *printoutForPrinting = (wxPrintout *) NULL, | |
450 | wxPrintDialogData *data = (wxPrintDialogData *) NULL); | |
451 | wxPrintPreviewBase(wxPrintout *printout, | |
452 | wxPrintout *printoutForPrinting, | |
453 | wxPrintData *data); | |
454 | virtual ~wxPrintPreviewBase(); | |
455 | ||
456 | virtual bool SetCurrentPage(int pageNum); | |
457 | virtual int GetCurrentPage() const; | |
458 | ||
459 | virtual void SetPrintout(wxPrintout *printout); | |
460 | virtual wxPrintout *GetPrintout() const; | |
461 | virtual wxPrintout *GetPrintoutForPrinting() const; | |
462 | ||
463 | virtual void SetFrame(wxFrame *frame); | |
464 | virtual void SetCanvas(wxPreviewCanvas *canvas); | |
465 | ||
466 | virtual wxFrame *GetFrame() const; | |
467 | virtual wxPreviewCanvas *GetCanvas() const; | |
468 | ||
469 | // The preview canvas should call this from OnPaint | |
470 | virtual bool PaintPage(wxPreviewCanvas *canvas, wxDC& dc); | |
471 | ||
472 | // This draws a blank page onto the preview canvas | |
473 | virtual bool DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc); | |
474 | ||
475 | // Adjusts the scrollbars for the current scale | |
476 | virtual void AdjustScrollbars(wxPreviewCanvas *canvas); | |
477 | ||
478 | // This is called by wxPrintPreview to render a page into a wxMemoryDC. | |
479 | virtual bool RenderPage(int pageNum); | |
480 | ||
481 | ||
482 | virtual void SetZoom(int percent); | |
483 | virtual int GetZoom() const; | |
484 | ||
485 | virtual wxPrintDialogData& GetPrintDialogData(); | |
486 | ||
487 | virtual int GetMaxPage() const; | |
488 | virtual int GetMinPage() const; | |
489 | ||
490 | virtual bool Ok() const; | |
491 | virtual void SetOk(bool ok); | |
492 | ||
493 | /////////////////////////////////////////////////////////////////////////// | |
494 | // OVERRIDES | |
495 | ||
496 | // If we own a wxPrintout that can be used for printing, this | |
497 | // will invoke the actual printing procedure. Called | |
498 | // by the wxPreviewControlBar. | |
499 | virtual bool Print(bool interactive) = 0; | |
500 | ||
501 | // Calculate scaling that needs to be done to get roughly | |
502 | // the right scaling for the screen pretending to be | |
503 | // the currently selected printer. | |
504 | virtual void DetermineScaling() = 0; | |
505 | ||
506 | protected: | |
507 | wxPrintDialogData m_printDialogData; | |
508 | wxPreviewCanvas* m_previewCanvas; | |
509 | wxFrame* m_previewFrame; | |
510 | wxBitmap* m_previewBitmap; | |
511 | wxPrintout* m_previewPrintout; | |
512 | wxPrintout* m_printPrintout; | |
513 | int m_currentPage; | |
514 | int m_currentZoom; | |
515 | float m_previewScale; | |
516 | int m_topMargin; | |
517 | int m_leftMargin; | |
518 | int m_pageWidth; | |
519 | int m_pageHeight; | |
520 | int m_minPage; | |
521 | int m_maxPage; | |
522 | ||
523 | bool m_isOk; | |
524 | bool m_printingPrepared; // Called OnPreparePrinting? | |
525 | ||
526 | private: | |
527 | void Init(wxPrintout *printout, wxPrintout *printoutForPrinting); | |
528 | ||
529 | DECLARE_NO_COPY_CLASS(wxPrintPreviewBase) | |
530 | DECLARE_CLASS(wxPrintPreviewBase) | |
531 | }; | |
532 | ||
533 | //---------------------------------------------------------------------------- | |
534 | // wxPrintPreview | |
535 | //---------------------------------------------------------------------------- | |
536 | ||
537 | class WXDLLEXPORT wxPrintPreview: public wxPrintPreviewBase | |
538 | { | |
539 | public: | |
540 | wxPrintPreview(wxPrintout *printout, | |
541 | wxPrintout *printoutForPrinting = (wxPrintout *) NULL, | |
542 | wxPrintDialogData *data = (wxPrintDialogData *) NULL); | |
543 | wxPrintPreview(wxPrintout *printout, | |
544 | wxPrintout *printoutForPrinting, | |
545 | wxPrintData *data); | |
546 | virtual ~wxPrintPreview(); | |
547 | ||
548 | virtual bool SetCurrentPage(int pageNum); | |
549 | virtual int GetCurrentPage() const; | |
550 | virtual void SetPrintout(wxPrintout *printout); | |
551 | virtual wxPrintout *GetPrintout() const; | |
552 | virtual wxPrintout *GetPrintoutForPrinting() const; | |
553 | virtual void SetFrame(wxFrame *frame); | |
554 | virtual void SetCanvas(wxPreviewCanvas *canvas); | |
555 | ||
556 | virtual wxFrame *GetFrame() const; | |
557 | virtual wxPreviewCanvas *GetCanvas() const; | |
558 | virtual bool PaintPage(wxPreviewCanvas *canvas, wxDC& dc); | |
559 | virtual bool DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc); | |
560 | virtual void AdjustScrollbars(wxPreviewCanvas *canvas); | |
561 | virtual bool RenderPage(int pageNum); | |
562 | virtual void SetZoom(int percent); | |
563 | ||
564 | virtual bool Print(bool interactive); | |
565 | virtual void DetermineScaling(); | |
566 | ||
567 | virtual wxPrintDialogData& GetPrintDialogData(); | |
568 | ||
569 | virtual int GetMaxPage() const; | |
570 | virtual int GetMinPage() const; | |
571 | ||
572 | virtual bool Ok() const; | |
573 | virtual void SetOk(bool ok); | |
574 | ||
575 | private: | |
576 | wxPrintPreviewBase *m_pimpl; | |
577 | ||
578 | private: | |
579 | DECLARE_CLASS(wxPrintPreview) | |
580 | DECLARE_NO_COPY_CLASS(wxPrintPreview) | |
581 | }; | |
582 | ||
583 | //---------------------------------------------------------------------------- | |
584 | // wxPrintAbortDialog | |
585 | //---------------------------------------------------------------------------- | |
586 | ||
587 | class WXDLLEXPORT wxPrintAbortDialog: public wxDialog | |
588 | { | |
589 | public: | |
590 | wxPrintAbortDialog(wxWindow *parent, | |
591 | const wxString& title, | |
592 | const wxPoint& pos = wxDefaultPosition, | |
593 | const wxSize& size = wxDefaultSize, | |
594 | long style = 0, | |
595 | const wxString& name = wxT("dialog")) | |
596 | : wxDialog(parent, wxID_ANY, title, pos, size, style, name) | |
597 | { | |
598 | } | |
599 | ||
600 | void OnCancel(wxCommandEvent& event); | |
601 | ||
602 | private: | |
603 | DECLARE_EVENT_TABLE() | |
604 | DECLARE_NO_COPY_CLASS(wxPrintAbortDialog) | |
605 | }; | |
606 | ||
607 | #endif // wxUSE_PRINTING_ARCHITECTURE | |
608 | ||
609 | #endif | |
610 | // _WX_PRNTBASEH__ |