]> git.saurik.com Git - wxWidgets.git/blob - include/wx/prntbase.h
Fix AUI compilation without PCH after recent changes.
[wxWidgets.git] / include / wx / prntbase.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/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 #include "wx/defs.h"
16
17 #if wxUSE_PRINTING_ARCHITECTURE
18
19 #include "wx/event.h"
20 #include "wx/cmndata.h"
21 #include "wx/panel.h"
22 #include "wx/scrolwin.h"
23 #include "wx/dialog.h"
24 #include "wx/frame.h"
25 #include "wx/dc.h"
26
27 class WXDLLIMPEXP_FWD_CORE wxDC;
28 class WXDLLIMPEXP_FWD_CORE wxButton;
29 class WXDLLIMPEXP_FWD_CORE wxChoice;
30 class WXDLLIMPEXP_FWD_CORE wxPrintout;
31 class WXDLLIMPEXP_FWD_CORE wxPrinterBase;
32 class WXDLLIMPEXP_FWD_CORE wxPrintDialogBase;
33 class WXDLLIMPEXP_FWD_CORE wxPrintDialog;
34 class WXDLLIMPEXP_FWD_CORE wxPageSetupDialogBase;
35 class WXDLLIMPEXP_FWD_CORE wxPageSetupDialog;
36 class WXDLLIMPEXP_FWD_CORE wxPrintPreviewBase;
37 class WXDLLIMPEXP_FWD_CORE wxPreviewCanvas;
38 class WXDLLIMPEXP_FWD_CORE wxPreviewControlBar;
39 class WXDLLIMPEXP_FWD_CORE wxPreviewFrame;
40 class WXDLLIMPEXP_FWD_CORE wxPrintFactory;
41 class WXDLLIMPEXP_FWD_CORE wxPrintNativeDataBase;
42 class WXDLLIMPEXP_FWD_CORE wxPrintPreview;
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 WXDLLIMPEXP_CORE 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 virtual wxPageSetupDialogBase *CreatePageSetupDialog( wxWindow *parent,
80 wxPageSetupDialogData * data = NULL ) = 0;
81
82 virtual wxDCImpl* CreatePrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data ) = 0;
83
84 // What to do and what to show in the wxPrintDialog
85 // a) Use the generic print setup dialog or a native one?
86 virtual bool HasPrintSetupDialog() = 0;
87 virtual wxDialog *CreatePrintSetupDialog( wxWindow *parent, wxPrintData *data ) = 0;
88 // b) Provide the "print to file" option ourselves or via print setup?
89 virtual bool HasOwnPrintToFile() = 0;
90 // c) Show current printer
91 virtual bool HasPrinterLine() = 0;
92 virtual wxString CreatePrinterLine() = 0;
93 // d) Show Status line for current printer?
94 virtual bool HasStatusLine() = 0;
95 virtual wxString CreateStatusLine() = 0;
96
97
98 virtual wxPrintNativeDataBase *CreatePrintNativeData() = 0;
99
100 static void SetPrintFactory( wxPrintFactory *factory );
101 static wxPrintFactory *GetFactory();
102 private:
103 static wxPrintFactory *m_factory;
104 };
105
106 class WXDLLIMPEXP_CORE wxNativePrintFactory: public wxPrintFactory
107 {
108 public:
109 virtual wxPrinterBase *CreatePrinter( wxPrintDialogData *data );
110
111 virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview,
112 wxPrintout *printout = NULL,
113 wxPrintDialogData *data = NULL );
114 virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview,
115 wxPrintout *printout,
116 wxPrintData *data );
117
118 virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent,
119 wxPrintDialogData *data = NULL );
120 virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent,
121 wxPrintData *data );
122
123 virtual wxPageSetupDialogBase *CreatePageSetupDialog( wxWindow *parent,
124 wxPageSetupDialogData * data = NULL );
125
126 virtual wxDCImpl* CreatePrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data );
127
128 virtual bool HasPrintSetupDialog();
129 virtual wxDialog *CreatePrintSetupDialog( wxWindow *parent, wxPrintData *data );
130 virtual bool HasOwnPrintToFile();
131 virtual bool HasPrinterLine();
132 virtual wxString CreatePrinterLine();
133 virtual bool HasStatusLine();
134 virtual wxString CreateStatusLine();
135
136 virtual wxPrintNativeDataBase *CreatePrintNativeData();
137 };
138
139 //----------------------------------------------------------------------------
140 // wxPrintNativeDataBase
141 //----------------------------------------------------------------------------
142
143 class WXDLLIMPEXP_CORE wxPrintNativeDataBase: public wxObject
144 {
145 public:
146 wxPrintNativeDataBase();
147 virtual ~wxPrintNativeDataBase() {}
148
149 virtual bool TransferTo( wxPrintData &data ) = 0;
150 virtual bool TransferFrom( const wxPrintData &data ) = 0;
151
152 virtual bool Ok() const { return IsOk(); }
153 virtual bool IsOk() const = 0;
154
155 int m_ref;
156
157 private:
158 DECLARE_CLASS(wxPrintNativeDataBase)
159 wxDECLARE_NO_COPY_CLASS(wxPrintNativeDataBase);
160 };
161
162 //----------------------------------------------------------------------------
163 // wxPrinterBase
164 //----------------------------------------------------------------------------
165
166 /*
167 * Represents the printer: manages printing a wxPrintout object
168 */
169
170 class WXDLLIMPEXP_CORE wxPrinterBase: public wxObject
171 {
172 public:
173 wxPrinterBase(wxPrintDialogData *data = NULL);
174 virtual ~wxPrinterBase();
175
176 virtual wxWindow *CreateAbortWindow(wxWindow *parent, wxPrintout *printout);
177 virtual void ReportError(wxWindow *parent, wxPrintout *printout, const wxString& message);
178
179 virtual wxPrintDialogData& GetPrintDialogData() const;
180 bool GetAbort() const { return sm_abortIt; }
181
182 static wxPrinterError GetLastError() { return sm_lastError; }
183
184 ///////////////////////////////////////////////////////////////////////////
185 // OVERRIDES
186
187 virtual bool Setup(wxWindow *parent) = 0;
188 virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = true) = 0;
189 virtual wxDC* PrintDialog(wxWindow *parent) = 0;
190
191 protected:
192 wxPrintDialogData m_printDialogData;
193 wxPrintout* m_currentPrintout;
194
195 static wxPrinterError sm_lastError;
196
197 public:
198 static wxWindow* sm_abortWindow;
199 static bool sm_abortIt;
200
201 private:
202 DECLARE_CLASS(wxPrinterBase)
203 wxDECLARE_NO_COPY_CLASS(wxPrinterBase);
204 };
205
206 //----------------------------------------------------------------------------
207 // wxPrinter
208 //----------------------------------------------------------------------------
209
210 class WXDLLIMPEXP_CORE wxPrinter: public wxPrinterBase
211 {
212 public:
213 wxPrinter(wxPrintDialogData *data = NULL);
214 virtual ~wxPrinter();
215
216 virtual wxWindow *CreateAbortWindow(wxWindow *parent, wxPrintout *printout);
217 virtual void ReportError(wxWindow *parent, wxPrintout *printout, const wxString& message);
218
219 virtual bool Setup(wxWindow *parent);
220 virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = true);
221 virtual wxDC* PrintDialog(wxWindow *parent);
222
223 virtual wxPrintDialogData& GetPrintDialogData() const;
224
225 protected:
226 wxPrinterBase *m_pimpl;
227
228 private:
229 DECLARE_CLASS(wxPrinter)
230 wxDECLARE_NO_COPY_CLASS(wxPrinter);
231 };
232
233 //----------------------------------------------------------------------------
234 // wxPrintout
235 //----------------------------------------------------------------------------
236
237 /*
238 * Represents an object via which a document may be printed.
239 * The programmer derives from this, overrides (at least) OnPrintPage,
240 * and passes it to a wxPrinter object for printing, or a wxPrintPreview
241 * object for previewing.
242 */
243
244 class WXDLLIMPEXP_CORE wxPrintout: public wxObject
245 {
246 public:
247 wxPrintout(const wxString& title = _("Printout"));
248 virtual ~wxPrintout();
249
250 virtual bool OnBeginDocument(int startPage, int endPage);
251 virtual void OnEndDocument();
252 virtual void OnBeginPrinting();
253 virtual void OnEndPrinting();
254
255 // Guaranteed to be before any other functions are called
256 virtual void OnPreparePrinting() { }
257
258 virtual bool HasPage(int page);
259 virtual bool OnPrintPage(int page) = 0;
260 virtual void GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo);
261
262 virtual wxString GetTitle() const { return m_printoutTitle; }
263
264 wxDC *GetDC() const { return m_printoutDC; }
265 void SetDC(wxDC *dc) { m_printoutDC = dc; }
266
267 void FitThisSizeToPaper(const wxSize& imageSize);
268 void FitThisSizeToPage(const wxSize& imageSize);
269 void FitThisSizeToPageMargins(const wxSize& imageSize, const wxPageSetupDialogData& pageSetupData);
270 void MapScreenSizeToPaper();
271 void MapScreenSizeToPage();
272 void MapScreenSizeToPageMargins(const wxPageSetupDialogData& pageSetupData);
273 void MapScreenSizeToDevice();
274
275 wxRect GetLogicalPaperRect() const;
276 wxRect GetLogicalPageRect() const;
277 wxRect GetLogicalPageMarginsRect(const wxPageSetupDialogData& pageSetupData) const;
278
279 void SetLogicalOrigin(wxCoord x, wxCoord y);
280 void OffsetLogicalOrigin(wxCoord xoff, wxCoord yoff);
281
282 void SetPageSizePixels(int w, int h) { m_pageWidthPixels = w; m_pageHeightPixels = h; }
283 void GetPageSizePixels(int *w, int *h) const { *w = m_pageWidthPixels; *h = m_pageHeightPixels; }
284 void SetPageSizeMM(int w, int h) { m_pageWidthMM = w; m_pageHeightMM = h; }
285 void GetPageSizeMM(int *w, int *h) const { *w = m_pageWidthMM; *h = m_pageHeightMM; }
286
287 void SetPPIScreen(int x, int y) { m_PPIScreenX = x; m_PPIScreenY = y; }
288 void SetPPIScreen(const wxSize& ppi) { SetPPIScreen(ppi.x, ppi.y); }
289 void GetPPIScreen(int *x, int *y) const { *x = m_PPIScreenX; *y = m_PPIScreenY; }
290 void SetPPIPrinter(int x, int y) { m_PPIPrinterX = x; m_PPIPrinterY = y; }
291 void SetPPIPrinter(const wxSize& ppi) { SetPPIPrinter(ppi.x, ppi.y); }
292 void GetPPIPrinter(int *x, int *y) const { *x = m_PPIPrinterX; *y = m_PPIPrinterY; }
293
294 void SetPaperRectPixels(const wxRect& paperRectPixels) { m_paperRectPixels = paperRectPixels; }
295 wxRect GetPaperRectPixels() const { return m_paperRectPixels; }
296
297 // This must be called by wxPrintPreview to associate itself with the
298 // printout it uses.
299 virtual void SetPreview(wxPrintPreview *preview) { m_preview = preview; }
300
301 wxPrintPreview *GetPreview() const { return m_preview; }
302 virtual bool IsPreview() const { return GetPreview() != NULL; }
303
304 private:
305 wxString m_printoutTitle;
306 wxDC* m_printoutDC;
307 wxPrintPreview *m_preview;
308
309 int m_pageWidthPixels;
310 int m_pageHeightPixels;
311
312 int m_pageWidthMM;
313 int m_pageHeightMM;
314
315 int m_PPIScreenX;
316 int m_PPIScreenY;
317 int m_PPIPrinterX;
318 int m_PPIPrinterY;
319
320 wxRect m_paperRectPixels;
321
322 private:
323 DECLARE_ABSTRACT_CLASS(wxPrintout)
324 wxDECLARE_NO_COPY_CLASS(wxPrintout);
325 };
326
327 //----------------------------------------------------------------------------
328 // wxPreviewCanvas
329 //----------------------------------------------------------------------------
330
331 /*
332 * Canvas upon which a preview is drawn.
333 */
334
335 class WXDLLIMPEXP_CORE wxPreviewCanvas: public wxScrolledWindow
336 {
337 public:
338 wxPreviewCanvas(wxPrintPreviewBase *preview,
339 wxWindow *parent,
340 const wxPoint& pos = wxDefaultPosition,
341 const wxSize& size = wxDefaultSize,
342 long style = 0,
343 const wxString& name = wxT("canvas"));
344 virtual ~wxPreviewCanvas();
345
346 void SetPreview(wxPrintPreviewBase *preview) { m_printPreview = preview; }
347
348 void OnPaint(wxPaintEvent& event);
349 void OnChar(wxKeyEvent &event);
350 // Responds to colour changes
351 void OnSysColourChanged(wxSysColourChangedEvent& event);
352
353 private:
354 #if wxUSE_MOUSEWHEEL
355 void OnMouseWheel(wxMouseEvent& event);
356 #endif // wxUSE_MOUSEWHEEL
357 void OnIdle(wxIdleEvent& event);
358
359 wxPrintPreviewBase* m_printPreview;
360
361 DECLARE_CLASS(wxPreviewCanvas)
362 DECLARE_EVENT_TABLE()
363 wxDECLARE_NO_COPY_CLASS(wxPreviewCanvas);
364 };
365
366 //----------------------------------------------------------------------------
367 // wxPreviewFrame
368 //----------------------------------------------------------------------------
369
370 /*
371 * Default frame for showing preview.
372 */
373
374 class WXDLLIMPEXP_CORE wxPreviewFrame: public wxFrame
375 {
376 public:
377 wxPreviewFrame(wxPrintPreviewBase *preview,
378 wxWindow *parent,
379 const wxString& title = _("Print Preview"),
380 const wxPoint& pos = wxDefaultPosition,
381 const wxSize& size = wxDefaultSize,
382 long style = wxDEFAULT_FRAME_STYLE | wxFRAME_FLOAT_ON_PARENT,
383 const wxString& name = wxFrameNameStr);
384 virtual ~wxPreviewFrame();
385
386 void OnCloseWindow(wxCloseEvent& event);
387 virtual void Initialize();
388 virtual void CreateCanvas();
389 virtual void CreateControlBar();
390
391 inline wxPreviewControlBar* GetControlBar() const { return m_controlBar; }
392
393 protected:
394 wxPreviewCanvas* m_previewCanvas;
395 wxPreviewControlBar* m_controlBar;
396 wxPrintPreviewBase* m_printPreview;
397 wxWindowDisabler* m_windowDisabler;
398
399 private:
400 void OnChar(wxKeyEvent& event);
401
402 DECLARE_EVENT_TABLE()
403 DECLARE_CLASS(wxPreviewFrame)
404 wxDECLARE_NO_COPY_CLASS(wxPreviewFrame);
405 };
406
407 //----------------------------------------------------------------------------
408 // wxPreviewControlBar
409 //----------------------------------------------------------------------------
410
411 /*
412 * A panel with buttons for controlling a print preview.
413 * The programmer may wish to use other means for controlling
414 * the print preview.
415 */
416
417 #define wxPREVIEW_PRINT 1
418 #define wxPREVIEW_PREVIOUS 2
419 #define wxPREVIEW_NEXT 4
420 #define wxPREVIEW_ZOOM 8
421 #define wxPREVIEW_FIRST 16
422 #define wxPREVIEW_LAST 32
423 #define wxPREVIEW_GOTO 64
424
425 #define wxPREVIEW_DEFAULT (wxPREVIEW_PREVIOUS|wxPREVIEW_NEXT|wxPREVIEW_ZOOM\
426 |wxPREVIEW_FIRST|wxPREVIEW_GOTO|wxPREVIEW_LAST)
427
428 // Ids for controls
429 #define wxID_PREVIEW_CLOSE 1
430 #define wxID_PREVIEW_NEXT 2
431 #define wxID_PREVIEW_PREVIOUS 3
432 #define wxID_PREVIEW_PRINT 4
433 #define wxID_PREVIEW_ZOOM 5
434 #define wxID_PREVIEW_FIRST 6
435 #define wxID_PREVIEW_LAST 7
436 #define wxID_PREVIEW_GOTO 8
437
438 class WXDLLIMPEXP_CORE wxPreviewControlBar: public wxPanel
439 {
440 DECLARE_CLASS(wxPreviewControlBar)
441
442 public:
443 wxPreviewControlBar(wxPrintPreviewBase *preview,
444 long buttons,
445 wxWindow *parent,
446 const wxPoint& pos = wxDefaultPosition,
447 const wxSize& size = wxDefaultSize,
448 long style = wxTAB_TRAVERSAL,
449 const wxString& name = wxT("panel"));
450 virtual ~wxPreviewControlBar();
451
452 virtual void CreateButtons();
453 virtual void SetZoomControl(int zoom);
454 virtual int GetZoomControl();
455 virtual wxPrintPreviewBase *GetPrintPreview() const
456 { return m_printPreview; }
457
458 void OnWindowClose(wxCommandEvent& event);
459 void OnNext();
460 void OnPrevious();
461 void OnFirst();
462 void OnLast();
463 void OnGoto();
464 void OnPrint();
465 void OnPrintButton(wxCommandEvent& WXUNUSED(event)) { OnPrint(); }
466 void OnNextButton(wxCommandEvent & WXUNUSED(event)) { OnNext(); }
467 void OnPreviousButton(wxCommandEvent & WXUNUSED(event)) { OnPrevious(); }
468 void OnFirstButton(wxCommandEvent & WXUNUSED(event)) { OnFirst(); }
469 void OnLastButton(wxCommandEvent & WXUNUSED(event)) { OnLast(); }
470 void OnGotoButton(wxCommandEvent & WXUNUSED(event)) { OnGoto(); }
471 void OnZoom(wxCommandEvent& event);
472 void OnPaint(wxPaintEvent& event);
473
474 protected:
475 wxPrintPreviewBase* m_printPreview;
476 wxButton* m_closeButton;
477 wxButton* m_nextPageButton;
478 wxButton* m_previousPageButton;
479 wxButton* m_printButton;
480 wxChoice* m_zoomControl;
481 wxButton* m_firstPageButton;
482 wxButton* m_lastPageButton;
483 wxButton* m_gotoPageButton;
484 long m_buttonFlags;
485
486 private:
487 DECLARE_EVENT_TABLE()
488 wxDECLARE_NO_COPY_CLASS(wxPreviewControlBar);
489 };
490
491 //----------------------------------------------------------------------------
492 // wxPrintPreviewBase
493 //----------------------------------------------------------------------------
494
495 /*
496 * Programmer creates an object of this class to preview a wxPrintout.
497 */
498
499 class WXDLLIMPEXP_CORE wxPrintPreviewBase: public wxObject
500 {
501 public:
502 wxPrintPreviewBase(wxPrintout *printout,
503 wxPrintout *printoutForPrinting = NULL,
504 wxPrintDialogData *data = NULL);
505 wxPrintPreviewBase(wxPrintout *printout,
506 wxPrintout *printoutForPrinting,
507 wxPrintData *data);
508 virtual ~wxPrintPreviewBase();
509
510 virtual bool SetCurrentPage(int pageNum);
511 virtual int GetCurrentPage() const;
512
513 virtual void SetPrintout(wxPrintout *printout);
514 virtual wxPrintout *GetPrintout() const;
515 virtual wxPrintout *GetPrintoutForPrinting() const;
516
517 virtual void SetFrame(wxFrame *frame);
518 virtual void SetCanvas(wxPreviewCanvas *canvas);
519
520 virtual wxFrame *GetFrame() const;
521 virtual wxPreviewCanvas *GetCanvas() const;
522
523 // This is a helper routine, used by the next 4 routines.
524
525 virtual void CalcRects(wxPreviewCanvas *canvas, wxRect& printableAreaRect, wxRect& paperRect);
526
527 // The preview canvas should call this from OnPaint
528 virtual bool PaintPage(wxPreviewCanvas *canvas, wxDC& dc);
529
530 // Updates rendered page by calling RenderPage() if needed, returns true
531 // if there was some change. Preview canvas should call it at idle time
532 virtual bool UpdatePageRendering();
533
534 // This draws a blank page onto the preview canvas
535 virtual bool DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc);
536
537 // Adjusts the scrollbars for the current scale
538 virtual void AdjustScrollbars(wxPreviewCanvas *canvas);
539
540 // This is called by wxPrintPreview to render a page into a wxMemoryDC.
541 virtual bool RenderPage(int pageNum);
542
543
544 virtual void SetZoom(int percent);
545 virtual int GetZoom() const;
546
547 virtual wxPrintDialogData& GetPrintDialogData();
548
549 virtual int GetMaxPage() const;
550 virtual int GetMinPage() const;
551
552 virtual bool Ok() const { return IsOk(); }
553 virtual bool IsOk() const;
554 virtual void SetOk(bool ok);
555
556 ///////////////////////////////////////////////////////////////////////////
557 // OVERRIDES
558
559 // If we own a wxPrintout that can be used for printing, this
560 // will invoke the actual printing procedure. Called
561 // by the wxPreviewControlBar.
562 virtual bool Print(bool interactive) = 0;
563
564 // Calculate scaling that needs to be done to get roughly
565 // the right scaling for the screen pretending to be
566 // the currently selected printer.
567 virtual void DetermineScaling() = 0;
568
569 protected:
570 // helpers for RenderPage():
571 virtual bool RenderPageIntoDC(wxDC& dc, int pageNum);
572 // renders preview into m_previewBitmap
573 virtual bool RenderPageIntoBitmap(wxBitmap& bmp, int pageNum);
574
575 void InvalidatePreviewBitmap();
576
577 protected:
578 wxPrintDialogData m_printDialogData;
579 wxPreviewCanvas* m_previewCanvas;
580 wxFrame* m_previewFrame;
581 wxBitmap* m_previewBitmap;
582 bool m_previewFailed;
583 wxPrintout* m_previewPrintout;
584 wxPrintout* m_printPrintout;
585 int m_currentPage;
586 int m_currentZoom;
587 float m_previewScaleX;
588 float m_previewScaleY;
589 int m_topMargin;
590 int m_leftMargin;
591 int m_pageWidth;
592 int m_pageHeight;
593 int m_minPage;
594 int m_maxPage;
595
596 bool m_isOk;
597 bool m_printingPrepared; // Called OnPreparePrinting?
598
599 private:
600 void Init(wxPrintout *printout, wxPrintout *printoutForPrinting);
601
602 wxDECLARE_NO_COPY_CLASS(wxPrintPreviewBase);
603 DECLARE_CLASS(wxPrintPreviewBase)
604 };
605
606 //----------------------------------------------------------------------------
607 // wxPrintPreview
608 //----------------------------------------------------------------------------
609
610 class WXDLLIMPEXP_CORE wxPrintPreview: public wxPrintPreviewBase
611 {
612 public:
613 wxPrintPreview(wxPrintout *printout,
614 wxPrintout *printoutForPrinting = NULL,
615 wxPrintDialogData *data = NULL);
616 wxPrintPreview(wxPrintout *printout,
617 wxPrintout *printoutForPrinting,
618 wxPrintData *data);
619 virtual ~wxPrintPreview();
620
621 virtual bool SetCurrentPage(int pageNum);
622 virtual int GetCurrentPage() const;
623 virtual void SetPrintout(wxPrintout *printout);
624 virtual wxPrintout *GetPrintout() const;
625 virtual wxPrintout *GetPrintoutForPrinting() const;
626 virtual void SetFrame(wxFrame *frame);
627 virtual void SetCanvas(wxPreviewCanvas *canvas);
628
629 virtual wxFrame *GetFrame() const;
630 virtual wxPreviewCanvas *GetCanvas() const;
631 virtual bool PaintPage(wxPreviewCanvas *canvas, wxDC& dc);
632 virtual bool UpdatePageRendering();
633 virtual bool DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc);
634 virtual void AdjustScrollbars(wxPreviewCanvas *canvas);
635 virtual bool RenderPage(int pageNum);
636 virtual void SetZoom(int percent);
637 virtual int GetZoom() const;
638
639 virtual bool Print(bool interactive);
640 virtual void DetermineScaling();
641
642 virtual wxPrintDialogData& GetPrintDialogData();
643
644 virtual int GetMaxPage() const;
645 virtual int GetMinPage() const;
646
647 virtual bool Ok() const { return IsOk(); }
648 virtual bool IsOk() const;
649 virtual void SetOk(bool ok);
650
651 private:
652 wxPrintPreviewBase *m_pimpl;
653
654 private:
655 DECLARE_CLASS(wxPrintPreview)
656 wxDECLARE_NO_COPY_CLASS(wxPrintPreview);
657 };
658
659 //----------------------------------------------------------------------------
660 // wxPrintAbortDialog
661 //----------------------------------------------------------------------------
662
663 class WXDLLIMPEXP_CORE wxPrintAbortDialog: public wxDialog
664 {
665 public:
666 wxPrintAbortDialog(wxWindow *parent,
667 const wxString& title,
668 const wxPoint& pos = wxDefaultPosition,
669 const wxSize& size = wxDefaultSize,
670 long style = 0,
671 const wxString& name = wxT("dialog"))
672 : wxDialog(parent, wxID_ANY, title, pos, size, style, name)
673 {
674 }
675
676 void OnCancel(wxCommandEvent& event);
677
678 private:
679 DECLARE_EVENT_TABLE()
680 wxDECLARE_NO_COPY_CLASS(wxPrintAbortDialog);
681 };
682
683 #endif // wxUSE_PRINTING_ARCHITECTURE
684
685 #endif
686 // _WX_PRNTBASEH__