1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Base classes for printing framework
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_PRNTBASEH__
13 #define _WX_PRNTBASEH__
17 #if wxUSE_PRINTING_ARCHITECTURE
20 #include "wx/cmndata.h"
22 #include "wx/scrolwin.h"
23 #include "wx/dialog.h"
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 class wxPrintPageTextCtrl
;
45 //----------------------------------------------------------------------------
47 //----------------------------------------------------------------------------
51 wxPRINTER_NO_ERROR
= 0,
56 //----------------------------------------------------------------------------
58 //----------------------------------------------------------------------------
60 class WXDLLIMPEXP_CORE wxPrintFactory
64 virtual ~wxPrintFactory() {}
66 virtual wxPrinterBase
*CreatePrinter( wxPrintDialogData
* data
) = 0;
68 virtual wxPrintPreviewBase
*CreatePrintPreview( wxPrintout
*preview
,
69 wxPrintout
*printout
= NULL
,
70 wxPrintDialogData
*data
= NULL
) = 0;
71 virtual wxPrintPreviewBase
*CreatePrintPreview( wxPrintout
*preview
,
73 wxPrintData
*data
) = 0;
75 virtual wxPrintDialogBase
*CreatePrintDialog( wxWindow
*parent
,
76 wxPrintDialogData
*data
= NULL
) = 0;
77 virtual wxPrintDialogBase
*CreatePrintDialog( wxWindow
*parent
,
78 wxPrintData
*data
) = 0;
80 virtual wxPageSetupDialogBase
*CreatePageSetupDialog( wxWindow
*parent
,
81 wxPageSetupDialogData
* data
= NULL
) = 0;
83 virtual wxDCImpl
* CreatePrinterDCImpl( wxPrinterDC
*owner
, const wxPrintData
& data
) = 0;
85 // What to do and what to show in the wxPrintDialog
86 // a) Use the generic print setup dialog or a native one?
87 virtual bool HasPrintSetupDialog() = 0;
88 virtual wxDialog
*CreatePrintSetupDialog( wxWindow
*parent
, wxPrintData
*data
) = 0;
89 // b) Provide the "print to file" option ourselves or via print setup?
90 virtual bool HasOwnPrintToFile() = 0;
91 // c) Show current printer
92 virtual bool HasPrinterLine() = 0;
93 virtual wxString
CreatePrinterLine() = 0;
94 // d) Show Status line for current printer?
95 virtual bool HasStatusLine() = 0;
96 virtual wxString
CreateStatusLine() = 0;
99 virtual wxPrintNativeDataBase
*CreatePrintNativeData() = 0;
101 static void SetPrintFactory( wxPrintFactory
*factory
);
102 static wxPrintFactory
*GetFactory();
104 static wxPrintFactory
*m_factory
;
107 class WXDLLIMPEXP_CORE wxNativePrintFactory
: public wxPrintFactory
110 virtual wxPrinterBase
*CreatePrinter( wxPrintDialogData
*data
);
112 virtual wxPrintPreviewBase
*CreatePrintPreview( wxPrintout
*preview
,
113 wxPrintout
*printout
= NULL
,
114 wxPrintDialogData
*data
= NULL
);
115 virtual wxPrintPreviewBase
*CreatePrintPreview( wxPrintout
*preview
,
116 wxPrintout
*printout
,
119 virtual wxPrintDialogBase
*CreatePrintDialog( wxWindow
*parent
,
120 wxPrintDialogData
*data
= NULL
);
121 virtual wxPrintDialogBase
*CreatePrintDialog( wxWindow
*parent
,
124 virtual wxPageSetupDialogBase
*CreatePageSetupDialog( wxWindow
*parent
,
125 wxPageSetupDialogData
* data
= NULL
);
127 virtual wxDCImpl
* CreatePrinterDCImpl( wxPrinterDC
*owner
, const wxPrintData
& data
);
129 virtual bool HasPrintSetupDialog();
130 virtual wxDialog
*CreatePrintSetupDialog( wxWindow
*parent
, wxPrintData
*data
);
131 virtual bool HasOwnPrintToFile();
132 virtual bool HasPrinterLine();
133 virtual wxString
CreatePrinterLine();
134 virtual bool HasStatusLine();
135 virtual wxString
CreateStatusLine();
137 virtual wxPrintNativeDataBase
*CreatePrintNativeData();
140 //----------------------------------------------------------------------------
141 // wxPrintNativeDataBase
142 //----------------------------------------------------------------------------
144 class WXDLLIMPEXP_CORE wxPrintNativeDataBase
: public wxObject
147 wxPrintNativeDataBase();
148 virtual ~wxPrintNativeDataBase() {}
150 virtual bool TransferTo( wxPrintData
&data
) = 0;
151 virtual bool TransferFrom( const wxPrintData
&data
) = 0;
153 virtual bool Ok() const { return IsOk(); }
154 virtual bool IsOk() const = 0;
159 DECLARE_CLASS(wxPrintNativeDataBase
)
160 wxDECLARE_NO_COPY_CLASS(wxPrintNativeDataBase
);
163 //----------------------------------------------------------------------------
165 //----------------------------------------------------------------------------
168 * Represents the printer: manages printing a wxPrintout object
171 class WXDLLIMPEXP_CORE wxPrinterBase
: public wxObject
174 wxPrinterBase(wxPrintDialogData
*data
= NULL
);
175 virtual ~wxPrinterBase();
177 virtual wxWindow
*CreateAbortWindow(wxWindow
*parent
, wxPrintout
*printout
);
178 virtual void ReportError(wxWindow
*parent
, wxPrintout
*printout
, const wxString
& message
);
180 virtual wxPrintDialogData
& GetPrintDialogData() const;
181 bool GetAbort() const { return sm_abortIt
; }
183 static wxPrinterError
GetLastError() { return sm_lastError
; }
185 ///////////////////////////////////////////////////////////////////////////
188 virtual bool Setup(wxWindow
*parent
) = 0;
189 virtual bool Print(wxWindow
*parent
, wxPrintout
*printout
, bool prompt
= true) = 0;
190 virtual wxDC
* PrintDialog(wxWindow
*parent
) = 0;
193 wxPrintDialogData m_printDialogData
;
194 wxPrintout
* m_currentPrintout
;
196 static wxPrinterError sm_lastError
;
199 static wxWindow
* sm_abortWindow
;
200 static bool sm_abortIt
;
203 DECLARE_CLASS(wxPrinterBase
)
204 wxDECLARE_NO_COPY_CLASS(wxPrinterBase
);
207 //----------------------------------------------------------------------------
209 //----------------------------------------------------------------------------
211 class WXDLLIMPEXP_CORE wxPrinter
: public wxPrinterBase
214 wxPrinter(wxPrintDialogData
*data
= NULL
);
215 virtual ~wxPrinter();
217 virtual wxWindow
*CreateAbortWindow(wxWindow
*parent
, wxPrintout
*printout
);
218 virtual void ReportError(wxWindow
*parent
, wxPrintout
*printout
, const wxString
& message
);
220 virtual bool Setup(wxWindow
*parent
);
221 virtual bool Print(wxWindow
*parent
, wxPrintout
*printout
, bool prompt
= true);
222 virtual wxDC
* PrintDialog(wxWindow
*parent
);
224 virtual wxPrintDialogData
& GetPrintDialogData() const;
227 wxPrinterBase
*m_pimpl
;
230 DECLARE_CLASS(wxPrinter
)
231 wxDECLARE_NO_COPY_CLASS(wxPrinter
);
234 //----------------------------------------------------------------------------
236 //----------------------------------------------------------------------------
239 * Represents an object via which a document may be printed.
240 * The programmer derives from this, overrides (at least) OnPrintPage,
241 * and passes it to a wxPrinter object for printing, or a wxPrintPreview
242 * object for previewing.
245 class WXDLLIMPEXP_CORE wxPrintout
: public wxObject
248 wxPrintout(const wxString
& title
= _("Printout"));
249 virtual ~wxPrintout();
251 virtual bool OnBeginDocument(int startPage
, int endPage
);
252 virtual void OnEndDocument();
253 virtual void OnBeginPrinting();
254 virtual void OnEndPrinting();
256 // Guaranteed to be before any other functions are called
257 virtual void OnPreparePrinting() { }
259 virtual bool HasPage(int page
);
260 virtual bool OnPrintPage(int page
) = 0;
261 virtual void GetPageInfo(int *minPage
, int *maxPage
, int *pageFrom
, int *pageTo
);
263 virtual wxString
GetTitle() const { return m_printoutTitle
; }
265 wxDC
*GetDC() const { return m_printoutDC
; }
266 void SetDC(wxDC
*dc
) { m_printoutDC
= dc
; }
268 void FitThisSizeToPaper(const wxSize
& imageSize
);
269 void FitThisSizeToPage(const wxSize
& imageSize
);
270 void FitThisSizeToPageMargins(const wxSize
& imageSize
, const wxPageSetupDialogData
& pageSetupData
);
271 void MapScreenSizeToPaper();
272 void MapScreenSizeToPage();
273 void MapScreenSizeToPageMargins(const wxPageSetupDialogData
& pageSetupData
);
274 void MapScreenSizeToDevice();
276 wxRect
GetLogicalPaperRect() const;
277 wxRect
GetLogicalPageRect() const;
278 wxRect
GetLogicalPageMarginsRect(const wxPageSetupDialogData
& pageSetupData
) const;
280 void SetLogicalOrigin(wxCoord x
, wxCoord y
);
281 void OffsetLogicalOrigin(wxCoord xoff
, wxCoord yoff
);
283 void SetPageSizePixels(int w
, int h
) { m_pageWidthPixels
= w
; m_pageHeightPixels
= h
; }
284 void GetPageSizePixels(int *w
, int *h
) const { *w
= m_pageWidthPixels
; *h
= m_pageHeightPixels
; }
285 void SetPageSizeMM(int w
, int h
) { m_pageWidthMM
= w
; m_pageHeightMM
= h
; }
286 void GetPageSizeMM(int *w
, int *h
) const { *w
= m_pageWidthMM
; *h
= m_pageHeightMM
; }
288 void SetPPIScreen(int x
, int y
) { m_PPIScreenX
= x
; m_PPIScreenY
= y
; }
289 void SetPPIScreen(const wxSize
& ppi
) { SetPPIScreen(ppi
.x
, ppi
.y
); }
290 void GetPPIScreen(int *x
, int *y
) const { *x
= m_PPIScreenX
; *y
= m_PPIScreenY
; }
291 void SetPPIPrinter(int x
, int y
) { m_PPIPrinterX
= x
; m_PPIPrinterY
= y
; }
292 void SetPPIPrinter(const wxSize
& ppi
) { SetPPIPrinter(ppi
.x
, ppi
.y
); }
293 void GetPPIPrinter(int *x
, int *y
) const { *x
= m_PPIPrinterX
; *y
= m_PPIPrinterY
; }
295 void SetPaperRectPixels(const wxRect
& paperRectPixels
) { m_paperRectPixels
= paperRectPixels
; }
296 wxRect
GetPaperRectPixels() const { return m_paperRectPixels
; }
298 // This must be called by wxPrintPreview to associate itself with the
300 virtual void SetPreview(wxPrintPreview
*preview
) { m_preview
= preview
; }
302 wxPrintPreview
*GetPreview() const { return m_preview
; }
303 virtual bool IsPreview() const { return GetPreview() != NULL
; }
306 wxString m_printoutTitle
;
308 wxPrintPreview
*m_preview
;
310 int m_pageWidthPixels
;
311 int m_pageHeightPixels
;
321 wxRect m_paperRectPixels
;
324 DECLARE_ABSTRACT_CLASS(wxPrintout
)
325 wxDECLARE_NO_COPY_CLASS(wxPrintout
);
328 //----------------------------------------------------------------------------
330 //----------------------------------------------------------------------------
333 * Canvas upon which a preview is drawn.
336 class WXDLLIMPEXP_CORE wxPreviewCanvas
: public wxScrolledWindow
339 wxPreviewCanvas(wxPrintPreviewBase
*preview
,
341 const wxPoint
& pos
= wxDefaultPosition
,
342 const wxSize
& size
= wxDefaultSize
,
344 const wxString
& name
= wxT("canvas"));
345 virtual ~wxPreviewCanvas();
347 void SetPreview(wxPrintPreviewBase
*preview
) { m_printPreview
= preview
; }
349 void OnPaint(wxPaintEvent
& event
);
350 void OnChar(wxKeyEvent
&event
);
351 // Responds to colour changes
352 void OnSysColourChanged(wxSysColourChangedEvent
& event
);
356 void OnMouseWheel(wxMouseEvent
& event
);
357 #endif // wxUSE_MOUSEWHEEL
358 void OnIdle(wxIdleEvent
& event
);
360 wxPrintPreviewBase
* m_printPreview
;
362 DECLARE_CLASS(wxPreviewCanvas
)
363 DECLARE_EVENT_TABLE()
364 wxDECLARE_NO_COPY_CLASS(wxPreviewCanvas
);
367 //----------------------------------------------------------------------------
369 //----------------------------------------------------------------------------
372 * Default frame for showing preview.
375 class WXDLLIMPEXP_CORE wxPreviewFrame
: public wxFrame
378 wxPreviewFrame(wxPrintPreviewBase
*preview
,
380 const wxString
& title
= _("Print Preview"),
381 const wxPoint
& pos
= wxDefaultPosition
,
382 const wxSize
& size
= wxDefaultSize
,
383 long style
= wxDEFAULT_FRAME_STYLE
| wxFRAME_FLOAT_ON_PARENT
,
384 const wxString
& name
= wxFrameNameStr
);
385 virtual ~wxPreviewFrame();
387 void OnCloseWindow(wxCloseEvent
& event
);
388 virtual void Initialize();
389 virtual void CreateCanvas();
390 virtual void CreateControlBar();
392 inline wxPreviewControlBar
* GetControlBar() const { return m_controlBar
; }
395 wxPreviewCanvas
* m_previewCanvas
;
396 wxPreviewControlBar
* m_controlBar
;
397 wxPrintPreviewBase
* m_printPreview
;
398 wxWindowDisabler
* m_windowDisabler
;
401 void OnChar(wxKeyEvent
& event
);
403 DECLARE_EVENT_TABLE()
404 DECLARE_CLASS(wxPreviewFrame
)
405 wxDECLARE_NO_COPY_CLASS(wxPreviewFrame
);
408 //----------------------------------------------------------------------------
409 // wxPreviewControlBar
410 //----------------------------------------------------------------------------
413 * A panel with buttons for controlling a print preview.
414 * The programmer may wish to use other means for controlling
418 #define wxPREVIEW_PRINT 1
419 #define wxPREVIEW_PREVIOUS 2
420 #define wxPREVIEW_NEXT 4
421 #define wxPREVIEW_ZOOM 8
422 #define wxPREVIEW_FIRST 16
423 #define wxPREVIEW_LAST 32
424 #define wxPREVIEW_GOTO 64
426 #define wxPREVIEW_DEFAULT (wxPREVIEW_PREVIOUS|wxPREVIEW_NEXT|wxPREVIEW_ZOOM\
427 |wxPREVIEW_FIRST|wxPREVIEW_GOTO|wxPREVIEW_LAST)
430 #define wxID_PREVIEW_CLOSE 1
431 #define wxID_PREVIEW_NEXT 2
432 #define wxID_PREVIEW_PREVIOUS 3
433 #define wxID_PREVIEW_PRINT 4
434 #define wxID_PREVIEW_ZOOM 5
435 #define wxID_PREVIEW_FIRST 6
436 #define wxID_PREVIEW_LAST 7
437 #define wxID_PREVIEW_GOTO 8
438 #define wxID_PREVIEW_ZOOM_IN 9
439 #define wxID_PREVIEW_ZOOM_OUT 10
441 class WXDLLIMPEXP_CORE wxPreviewControlBar
: public wxPanel
443 DECLARE_CLASS(wxPreviewControlBar
)
446 wxPreviewControlBar(wxPrintPreviewBase
*preview
,
449 const wxPoint
& pos
= wxDefaultPosition
,
450 const wxSize
& size
= wxDefaultSize
,
451 long style
= wxTAB_TRAVERSAL
,
452 const wxString
& name
= wxT("panel"));
453 virtual ~wxPreviewControlBar();
455 virtual void CreateButtons();
456 virtual void SetZoomControl(int zoom
);
457 virtual int GetZoomControl();
458 virtual wxPrintPreviewBase
*GetPrintPreview() const
459 { return m_printPreview
; }
462 // Implementation only from now on.
463 void OnWindowClose(wxCommandEvent
& event
);
471 void OnPrintButton(wxCommandEvent
& WXUNUSED(event
)) { OnPrint(); }
472 void OnNextButton(wxCommandEvent
& WXUNUSED(event
)) { OnNext(); }
473 void OnPreviousButton(wxCommandEvent
& WXUNUSED(event
)) { OnPrevious(); }
474 void OnFirstButton(wxCommandEvent
& WXUNUSED(event
)) { OnFirst(); }
475 void OnLastButton(wxCommandEvent
& WXUNUSED(event
)) { OnLast(); }
476 void OnPaint(wxPaintEvent
& event
);
478 void OnUpdateNextButton(wxUpdateUIEvent
& event
)
479 { event
.Enable(IsNextEnabled()); }
480 void OnUpdatePreviousButton(wxUpdateUIEvent
& event
)
481 { event
.Enable(IsPreviousEnabled()); }
482 void OnUpdateFirstButton(wxUpdateUIEvent
& event
)
483 { event
.Enable(IsFirstEnabled()); }
484 void OnUpdateLastButton(wxUpdateUIEvent
& event
)
485 { event
.Enable(IsLastEnabled()); }
486 void OnUpdateZoomInButton(wxUpdateUIEvent
& event
)
487 { event
.Enable(IsZoomInEnabled()); }
488 void OnUpdateZoomOutButton(wxUpdateUIEvent
& event
)
489 { event
.Enable(IsZoomOutEnabled()); }
491 // These methods are not private because they are called by wxPreviewCanvas.
496 wxPrintPreviewBase
* m_printPreview
;
497 wxButton
* m_closeButton
;
498 wxChoice
* m_zoomControl
;
499 wxPrintPageTextCtrl
* m_currentPageText
;
504 void DoGotoPage(int page
);
508 bool IsNextEnabled() const;
509 bool IsPreviousEnabled() const;
510 bool IsFirstEnabled() const;
511 bool IsLastEnabled() const;
512 bool IsZoomInEnabled() const;
513 bool IsZoomOutEnabled() const;
515 void OnZoomInButton(wxCommandEvent
& WXUNUSED(event
)) { DoZoomIn(); }
516 void OnZoomOutButton(wxCommandEvent
& WXUNUSED(event
)) { DoZoomOut(); }
517 void OnZoomChoice(wxCommandEvent
& WXUNUSED(event
)) { DoZoom(); }
519 DECLARE_EVENT_TABLE()
520 wxDECLARE_NO_COPY_CLASS(wxPreviewControlBar
);
523 //----------------------------------------------------------------------------
524 // wxPrintPreviewBase
525 //----------------------------------------------------------------------------
528 * Programmer creates an object of this class to preview a wxPrintout.
531 class WXDLLIMPEXP_CORE wxPrintPreviewBase
: public wxObject
534 wxPrintPreviewBase(wxPrintout
*printout
,
535 wxPrintout
*printoutForPrinting
= NULL
,
536 wxPrintDialogData
*data
= NULL
);
537 wxPrintPreviewBase(wxPrintout
*printout
,
538 wxPrintout
*printoutForPrinting
,
540 virtual ~wxPrintPreviewBase();
542 virtual bool SetCurrentPage(int pageNum
);
543 virtual int GetCurrentPage() const;
545 virtual void SetPrintout(wxPrintout
*printout
);
546 virtual wxPrintout
*GetPrintout() const;
547 virtual wxPrintout
*GetPrintoutForPrinting() const;
549 virtual void SetFrame(wxFrame
*frame
);
550 virtual void SetCanvas(wxPreviewCanvas
*canvas
);
552 virtual wxFrame
*GetFrame() const;
553 virtual wxPreviewCanvas
*GetCanvas() const;
555 // This is a helper routine, used by the next 4 routines.
557 virtual void CalcRects(wxPreviewCanvas
*canvas
, wxRect
& printableAreaRect
, wxRect
& paperRect
);
559 // The preview canvas should call this from OnPaint
560 virtual bool PaintPage(wxPreviewCanvas
*canvas
, wxDC
& dc
);
562 // Updates rendered page by calling RenderPage() if needed, returns true
563 // if there was some change. Preview canvas should call it at idle time
564 virtual bool UpdatePageRendering();
566 // This draws a blank page onto the preview canvas
567 virtual bool DrawBlankPage(wxPreviewCanvas
*canvas
, wxDC
& dc
);
569 // Adjusts the scrollbars for the current scale
570 virtual void AdjustScrollbars(wxPreviewCanvas
*canvas
);
572 // This is called by wxPrintPreview to render a page into a wxMemoryDC.
573 virtual bool RenderPage(int pageNum
);
576 virtual void SetZoom(int percent
);
577 virtual int GetZoom() const;
579 virtual wxPrintDialogData
& GetPrintDialogData();
581 virtual int GetMaxPage() const;
582 virtual int GetMinPage() const;
584 virtual bool Ok() const { return IsOk(); }
585 virtual bool IsOk() const;
586 virtual void SetOk(bool ok
);
588 ///////////////////////////////////////////////////////////////////////////
591 // If we own a wxPrintout that can be used for printing, this
592 // will invoke the actual printing procedure. Called
593 // by the wxPreviewControlBar.
594 virtual bool Print(bool interactive
) = 0;
596 // Calculate scaling that needs to be done to get roughly
597 // the right scaling for the screen pretending to be
598 // the currently selected printer.
599 virtual void DetermineScaling() = 0;
602 // helpers for RenderPage():
603 virtual bool RenderPageIntoDC(wxDC
& dc
, int pageNum
);
604 // renders preview into m_previewBitmap
605 virtual bool RenderPageIntoBitmap(wxBitmap
& bmp
, int pageNum
);
607 void InvalidatePreviewBitmap();
610 wxPrintDialogData m_printDialogData
;
611 wxPreviewCanvas
* m_previewCanvas
;
612 wxFrame
* m_previewFrame
;
613 wxBitmap
* m_previewBitmap
;
614 bool m_previewFailed
;
615 wxPrintout
* m_previewPrintout
;
616 wxPrintout
* m_printPrintout
;
619 float m_previewScaleX
;
620 float m_previewScaleY
;
629 bool m_printingPrepared
; // Called OnPreparePrinting?
632 void Init(wxPrintout
*printout
, wxPrintout
*printoutForPrinting
);
634 wxDECLARE_NO_COPY_CLASS(wxPrintPreviewBase
);
635 DECLARE_CLASS(wxPrintPreviewBase
)
638 //----------------------------------------------------------------------------
640 //----------------------------------------------------------------------------
642 class WXDLLIMPEXP_CORE wxPrintPreview
: public wxPrintPreviewBase
645 wxPrintPreview(wxPrintout
*printout
,
646 wxPrintout
*printoutForPrinting
= NULL
,
647 wxPrintDialogData
*data
= NULL
);
648 wxPrintPreview(wxPrintout
*printout
,
649 wxPrintout
*printoutForPrinting
,
651 virtual ~wxPrintPreview();
653 virtual bool SetCurrentPage(int pageNum
);
654 virtual int GetCurrentPage() const;
655 virtual void SetPrintout(wxPrintout
*printout
);
656 virtual wxPrintout
*GetPrintout() const;
657 virtual wxPrintout
*GetPrintoutForPrinting() const;
658 virtual void SetFrame(wxFrame
*frame
);
659 virtual void SetCanvas(wxPreviewCanvas
*canvas
);
661 virtual wxFrame
*GetFrame() const;
662 virtual wxPreviewCanvas
*GetCanvas() const;
663 virtual bool PaintPage(wxPreviewCanvas
*canvas
, wxDC
& dc
);
664 virtual bool UpdatePageRendering();
665 virtual bool DrawBlankPage(wxPreviewCanvas
*canvas
, wxDC
& dc
);
666 virtual void AdjustScrollbars(wxPreviewCanvas
*canvas
);
667 virtual bool RenderPage(int pageNum
);
668 virtual void SetZoom(int percent
);
669 virtual int GetZoom() const;
671 virtual bool Print(bool interactive
);
672 virtual void DetermineScaling();
674 virtual wxPrintDialogData
& GetPrintDialogData();
676 virtual int GetMaxPage() const;
677 virtual int GetMinPage() const;
679 virtual bool Ok() const { return IsOk(); }
680 virtual bool IsOk() const;
681 virtual void SetOk(bool ok
);
684 wxPrintPreviewBase
*m_pimpl
;
687 DECLARE_CLASS(wxPrintPreview
)
688 wxDECLARE_NO_COPY_CLASS(wxPrintPreview
);
691 //----------------------------------------------------------------------------
692 // wxPrintAbortDialog
693 //----------------------------------------------------------------------------
695 class WXDLLIMPEXP_CORE wxPrintAbortDialog
: public wxDialog
698 wxPrintAbortDialog(wxWindow
*parent
,
699 const wxString
& title
,
700 const wxPoint
& pos
= wxDefaultPosition
,
701 const wxSize
& size
= wxDefaultSize
,
703 const wxString
& name
= wxT("dialog"))
704 : wxDialog(parent
, wxID_ANY
, title
, pos
, size
, style
, name
)
708 void OnCancel(wxCommandEvent
& event
);
711 DECLARE_EVENT_TABLE()
712 wxDECLARE_NO_COPY_CLASS(wxPrintAbortDialog
);
715 #endif // wxUSE_PRINTING_ARCHITECTURE