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 wxPrintPageMaxCtrl
;
44 class wxPrintPageTextCtrl
;
46 //----------------------------------------------------------------------------
48 //----------------------------------------------------------------------------
52 wxPRINTER_NO_ERROR
= 0,
57 // Preview frame modality kind used with wxPreviewFrame::Initialize()
58 enum wxPreviewFrameModalityKind
60 // Disable all the other top level windows while the preview is shown.
61 wxPreviewFrame_AppModal
,
63 // Disable only the parent window while the preview is shown.
64 wxPreviewFrame_WindowModal
,
66 // Don't disable any windows.
67 wxPreviewFrame_NonModal
70 //----------------------------------------------------------------------------
72 //----------------------------------------------------------------------------
74 class WXDLLIMPEXP_CORE wxPrintFactory
78 virtual ~wxPrintFactory() {}
80 virtual wxPrinterBase
*CreatePrinter( wxPrintDialogData
* data
) = 0;
82 virtual wxPrintPreviewBase
*CreatePrintPreview( wxPrintout
*preview
,
83 wxPrintout
*printout
= NULL
,
84 wxPrintDialogData
*data
= NULL
) = 0;
85 virtual wxPrintPreviewBase
*CreatePrintPreview( wxPrintout
*preview
,
87 wxPrintData
*data
) = 0;
89 virtual wxPrintDialogBase
*CreatePrintDialog( wxWindow
*parent
,
90 wxPrintDialogData
*data
= NULL
) = 0;
91 virtual wxPrintDialogBase
*CreatePrintDialog( wxWindow
*parent
,
92 wxPrintData
*data
) = 0;
94 virtual wxPageSetupDialogBase
*CreatePageSetupDialog( wxWindow
*parent
,
95 wxPageSetupDialogData
* data
= NULL
) = 0;
97 virtual wxDCImpl
* CreatePrinterDCImpl( wxPrinterDC
*owner
, const wxPrintData
& data
) = 0;
99 // What to do and what to show in the wxPrintDialog
100 // a) Use the generic print setup dialog or a native one?
101 virtual bool HasPrintSetupDialog() = 0;
102 virtual wxDialog
*CreatePrintSetupDialog( wxWindow
*parent
, wxPrintData
*data
) = 0;
103 // b) Provide the "print to file" option ourselves or via print setup?
104 virtual bool HasOwnPrintToFile() = 0;
105 // c) Show current printer
106 virtual bool HasPrinterLine() = 0;
107 virtual wxString
CreatePrinterLine() = 0;
108 // d) Show Status line for current printer?
109 virtual bool HasStatusLine() = 0;
110 virtual wxString
CreateStatusLine() = 0;
113 virtual wxPrintNativeDataBase
*CreatePrintNativeData() = 0;
115 static void SetPrintFactory( wxPrintFactory
*factory
);
116 static wxPrintFactory
*GetFactory();
118 static wxPrintFactory
*m_factory
;
121 class WXDLLIMPEXP_CORE wxNativePrintFactory
: public wxPrintFactory
124 virtual wxPrinterBase
*CreatePrinter( wxPrintDialogData
*data
);
126 virtual wxPrintPreviewBase
*CreatePrintPreview( wxPrintout
*preview
,
127 wxPrintout
*printout
= NULL
,
128 wxPrintDialogData
*data
= NULL
);
129 virtual wxPrintPreviewBase
*CreatePrintPreview( wxPrintout
*preview
,
130 wxPrintout
*printout
,
133 virtual wxPrintDialogBase
*CreatePrintDialog( wxWindow
*parent
,
134 wxPrintDialogData
*data
= NULL
);
135 virtual wxPrintDialogBase
*CreatePrintDialog( wxWindow
*parent
,
138 virtual wxPageSetupDialogBase
*CreatePageSetupDialog( wxWindow
*parent
,
139 wxPageSetupDialogData
* data
= NULL
);
141 virtual wxDCImpl
* CreatePrinterDCImpl( wxPrinterDC
*owner
, const wxPrintData
& data
);
143 virtual bool HasPrintSetupDialog();
144 virtual wxDialog
*CreatePrintSetupDialog( wxWindow
*parent
, wxPrintData
*data
);
145 virtual bool HasOwnPrintToFile();
146 virtual bool HasPrinterLine();
147 virtual wxString
CreatePrinterLine();
148 virtual bool HasStatusLine();
149 virtual wxString
CreateStatusLine();
151 virtual wxPrintNativeDataBase
*CreatePrintNativeData();
154 //----------------------------------------------------------------------------
155 // wxPrintNativeDataBase
156 //----------------------------------------------------------------------------
158 class WXDLLIMPEXP_CORE wxPrintNativeDataBase
: public wxObject
161 wxPrintNativeDataBase();
162 virtual ~wxPrintNativeDataBase() {}
164 virtual bool TransferTo( wxPrintData
&data
) = 0;
165 virtual bool TransferFrom( const wxPrintData
&data
) = 0;
167 virtual bool Ok() const { return IsOk(); }
168 virtual bool IsOk() const = 0;
173 DECLARE_CLASS(wxPrintNativeDataBase
)
174 wxDECLARE_NO_COPY_CLASS(wxPrintNativeDataBase
);
177 //----------------------------------------------------------------------------
179 //----------------------------------------------------------------------------
182 * Represents the printer: manages printing a wxPrintout object
185 class WXDLLIMPEXP_CORE wxPrinterBase
: public wxObject
188 wxPrinterBase(wxPrintDialogData
*data
= NULL
);
189 virtual ~wxPrinterBase();
191 virtual wxWindow
*CreateAbortWindow(wxWindow
*parent
, wxPrintout
*printout
);
192 virtual void ReportError(wxWindow
*parent
, wxPrintout
*printout
, const wxString
& message
);
194 virtual wxPrintDialogData
& GetPrintDialogData() const;
195 bool GetAbort() const { return sm_abortIt
; }
197 static wxPrinterError
GetLastError() { return sm_lastError
; }
199 ///////////////////////////////////////////////////////////////////////////
202 virtual bool Setup(wxWindow
*parent
) = 0;
203 virtual bool Print(wxWindow
*parent
, wxPrintout
*printout
, bool prompt
= true) = 0;
204 virtual wxDC
* PrintDialog(wxWindow
*parent
) = 0;
207 wxPrintDialogData m_printDialogData
;
208 wxPrintout
* m_currentPrintout
;
210 static wxPrinterError sm_lastError
;
213 static wxWindow
* sm_abortWindow
;
214 static bool sm_abortIt
;
217 DECLARE_CLASS(wxPrinterBase
)
218 wxDECLARE_NO_COPY_CLASS(wxPrinterBase
);
221 //----------------------------------------------------------------------------
223 //----------------------------------------------------------------------------
225 class WXDLLIMPEXP_CORE wxPrinter
: public wxPrinterBase
228 wxPrinter(wxPrintDialogData
*data
= NULL
);
229 virtual ~wxPrinter();
231 virtual wxWindow
*CreateAbortWindow(wxWindow
*parent
, wxPrintout
*printout
);
232 virtual void ReportError(wxWindow
*parent
, wxPrintout
*printout
, const wxString
& message
);
234 virtual bool Setup(wxWindow
*parent
);
235 virtual bool Print(wxWindow
*parent
, wxPrintout
*printout
, bool prompt
= true);
236 virtual wxDC
* PrintDialog(wxWindow
*parent
);
238 virtual wxPrintDialogData
& GetPrintDialogData() const;
241 wxPrinterBase
*m_pimpl
;
244 DECLARE_CLASS(wxPrinter
)
245 wxDECLARE_NO_COPY_CLASS(wxPrinter
);
248 //----------------------------------------------------------------------------
250 //----------------------------------------------------------------------------
253 * Represents an object via which a document may be printed.
254 * The programmer derives from this, overrides (at least) OnPrintPage,
255 * and passes it to a wxPrinter object for printing, or a wxPrintPreview
256 * object for previewing.
259 class WXDLLIMPEXP_CORE wxPrintout
: public wxObject
262 wxPrintout(const wxString
& title
= _("Printout"));
263 virtual ~wxPrintout();
265 virtual bool OnBeginDocument(int startPage
, int endPage
);
266 virtual void OnEndDocument();
267 virtual void OnBeginPrinting();
268 virtual void OnEndPrinting();
270 // Guaranteed to be before any other functions are called
271 virtual void OnPreparePrinting() { }
273 virtual bool HasPage(int page
);
274 virtual bool OnPrintPage(int page
) = 0;
275 virtual void GetPageInfo(int *minPage
, int *maxPage
, int *pageFrom
, int *pageTo
);
277 virtual wxString
GetTitle() const { return m_printoutTitle
; }
279 wxDC
*GetDC() const { return m_printoutDC
; }
280 void SetDC(wxDC
*dc
) { m_printoutDC
= dc
; }
282 void FitThisSizeToPaper(const wxSize
& imageSize
);
283 void FitThisSizeToPage(const wxSize
& imageSize
);
284 void FitThisSizeToPageMargins(const wxSize
& imageSize
, const wxPageSetupDialogData
& pageSetupData
);
285 void MapScreenSizeToPaper();
286 void MapScreenSizeToPage();
287 void MapScreenSizeToPageMargins(const wxPageSetupDialogData
& pageSetupData
);
288 void MapScreenSizeToDevice();
290 wxRect
GetLogicalPaperRect() const;
291 wxRect
GetLogicalPageRect() const;
292 wxRect
GetLogicalPageMarginsRect(const wxPageSetupDialogData
& pageSetupData
) const;
294 void SetLogicalOrigin(wxCoord x
, wxCoord y
);
295 void OffsetLogicalOrigin(wxCoord xoff
, wxCoord yoff
);
297 void SetPageSizePixels(int w
, int h
) { m_pageWidthPixels
= w
; m_pageHeightPixels
= h
; }
298 void GetPageSizePixels(int *w
, int *h
) const { *w
= m_pageWidthPixels
; *h
= m_pageHeightPixels
; }
299 void SetPageSizeMM(int w
, int h
) { m_pageWidthMM
= w
; m_pageHeightMM
= h
; }
300 void GetPageSizeMM(int *w
, int *h
) const { *w
= m_pageWidthMM
; *h
= m_pageHeightMM
; }
302 void SetPPIScreen(int x
, int y
) { m_PPIScreenX
= x
; m_PPIScreenY
= y
; }
303 void SetPPIScreen(const wxSize
& ppi
) { SetPPIScreen(ppi
.x
, ppi
.y
); }
304 void GetPPIScreen(int *x
, int *y
) const { *x
= m_PPIScreenX
; *y
= m_PPIScreenY
; }
305 void SetPPIPrinter(int x
, int y
) { m_PPIPrinterX
= x
; m_PPIPrinterY
= y
; }
306 void SetPPIPrinter(const wxSize
& ppi
) { SetPPIPrinter(ppi
.x
, ppi
.y
); }
307 void GetPPIPrinter(int *x
, int *y
) const { *x
= m_PPIPrinterX
; *y
= m_PPIPrinterY
; }
309 void SetPaperRectPixels(const wxRect
& paperRectPixels
) { m_paperRectPixels
= paperRectPixels
; }
310 wxRect
GetPaperRectPixels() const { return m_paperRectPixels
; }
312 // This must be called by wxPrintPreview to associate itself with the
314 virtual void SetPreview(wxPrintPreview
*preview
) { m_preview
= preview
; }
316 wxPrintPreview
*GetPreview() const { return m_preview
; }
317 virtual bool IsPreview() const { return GetPreview() != NULL
; }
320 wxString m_printoutTitle
;
322 wxPrintPreview
*m_preview
;
324 int m_pageWidthPixels
;
325 int m_pageHeightPixels
;
335 wxRect m_paperRectPixels
;
338 DECLARE_ABSTRACT_CLASS(wxPrintout
)
339 wxDECLARE_NO_COPY_CLASS(wxPrintout
);
342 //----------------------------------------------------------------------------
344 //----------------------------------------------------------------------------
347 * Canvas upon which a preview is drawn.
350 class WXDLLIMPEXP_CORE wxPreviewCanvas
: public wxScrolledWindow
353 wxPreviewCanvas(wxPrintPreviewBase
*preview
,
355 const wxPoint
& pos
= wxDefaultPosition
,
356 const wxSize
& size
= wxDefaultSize
,
358 const wxString
& name
= wxT("canvas"));
359 virtual ~wxPreviewCanvas();
361 void SetPreview(wxPrintPreviewBase
*preview
) { m_printPreview
= preview
; }
363 void OnPaint(wxPaintEvent
& event
);
364 void OnChar(wxKeyEvent
&event
);
365 // Responds to colour changes
366 void OnSysColourChanged(wxSysColourChangedEvent
& event
);
370 void OnMouseWheel(wxMouseEvent
& event
);
371 #endif // wxUSE_MOUSEWHEEL
372 void OnIdle(wxIdleEvent
& event
);
374 wxPrintPreviewBase
* m_printPreview
;
376 DECLARE_CLASS(wxPreviewCanvas
)
377 DECLARE_EVENT_TABLE()
378 wxDECLARE_NO_COPY_CLASS(wxPreviewCanvas
);
381 //----------------------------------------------------------------------------
383 //----------------------------------------------------------------------------
386 * Default frame for showing preview.
389 class WXDLLIMPEXP_CORE wxPreviewFrame
: public wxFrame
392 wxPreviewFrame(wxPrintPreviewBase
*preview
,
394 const wxString
& title
= _("Print Preview"),
395 const wxPoint
& pos
= wxDefaultPosition
,
396 const wxSize
& size
= wxDefaultSize
,
397 long style
= wxDEFAULT_FRAME_STYLE
| wxFRAME_FLOAT_ON_PARENT
,
398 const wxString
& name
= wxFrameNameStr
);
399 virtual ~wxPreviewFrame();
401 void OnCloseWindow(wxCloseEvent
& event
);
402 virtual void Initialize(wxPreviewFrameModalityKind kind
403 = wxPreviewFrame_AppModal
);
404 virtual void CreateCanvas();
405 virtual void CreateControlBar();
407 inline wxPreviewControlBar
* GetControlBar() const { return m_controlBar
; }
410 wxPreviewCanvas
* m_previewCanvas
;
411 wxPreviewControlBar
* m_controlBar
;
412 wxPrintPreviewBase
* m_printPreview
;
413 wxWindowDisabler
* m_windowDisabler
;
415 wxPreviewFrameModalityKind m_modalityKind
;
419 void OnChar(wxKeyEvent
& event
);
421 DECLARE_EVENT_TABLE()
422 DECLARE_CLASS(wxPreviewFrame
)
423 wxDECLARE_NO_COPY_CLASS(wxPreviewFrame
);
426 //----------------------------------------------------------------------------
427 // wxPreviewControlBar
428 //----------------------------------------------------------------------------
431 * A panel with buttons for controlling a print preview.
432 * The programmer may wish to use other means for controlling
436 #define wxPREVIEW_PRINT 1
437 #define wxPREVIEW_PREVIOUS 2
438 #define wxPREVIEW_NEXT 4
439 #define wxPREVIEW_ZOOM 8
440 #define wxPREVIEW_FIRST 16
441 #define wxPREVIEW_LAST 32
442 #define wxPREVIEW_GOTO 64
444 #define wxPREVIEW_DEFAULT (wxPREVIEW_PREVIOUS|wxPREVIEW_NEXT|wxPREVIEW_ZOOM\
445 |wxPREVIEW_FIRST|wxPREVIEW_GOTO|wxPREVIEW_LAST)
448 #define wxID_PREVIEW_CLOSE 1
449 #define wxID_PREVIEW_NEXT 2
450 #define wxID_PREVIEW_PREVIOUS 3
451 #define wxID_PREVIEW_PRINT 4
452 #define wxID_PREVIEW_ZOOM 5
453 #define wxID_PREVIEW_FIRST 6
454 #define wxID_PREVIEW_LAST 7
455 #define wxID_PREVIEW_GOTO 8
456 #define wxID_PREVIEW_ZOOM_IN 9
457 #define wxID_PREVIEW_ZOOM_OUT 10
459 class WXDLLIMPEXP_CORE wxPreviewControlBar
: public wxPanel
461 DECLARE_CLASS(wxPreviewControlBar
)
464 wxPreviewControlBar(wxPrintPreviewBase
*preview
,
467 const wxPoint
& pos
= wxDefaultPosition
,
468 const wxSize
& size
= wxDefaultSize
,
469 long style
= wxTAB_TRAVERSAL
,
470 const wxString
& name
= wxT("panel"));
471 virtual ~wxPreviewControlBar();
473 virtual void CreateButtons();
474 virtual void SetPageInfo(int minPage
, int maxPage
);
475 virtual void SetZoomControl(int zoom
);
476 virtual int GetZoomControl();
477 virtual wxPrintPreviewBase
*GetPrintPreview() const
478 { return m_printPreview
; }
481 // Implementation only from now on.
482 void OnWindowClose(wxCommandEvent
& event
);
490 void OnPrintButton(wxCommandEvent
& WXUNUSED(event
)) { OnPrint(); }
491 void OnNextButton(wxCommandEvent
& WXUNUSED(event
)) { OnNext(); }
492 void OnPreviousButton(wxCommandEvent
& WXUNUSED(event
)) { OnPrevious(); }
493 void OnFirstButton(wxCommandEvent
& WXUNUSED(event
)) { OnFirst(); }
494 void OnLastButton(wxCommandEvent
& WXUNUSED(event
)) { OnLast(); }
495 void OnPaint(wxPaintEvent
& event
);
497 void OnUpdateNextButton(wxUpdateUIEvent
& event
)
498 { event
.Enable(IsNextEnabled()); }
499 void OnUpdatePreviousButton(wxUpdateUIEvent
& event
)
500 { event
.Enable(IsPreviousEnabled()); }
501 void OnUpdateFirstButton(wxUpdateUIEvent
& event
)
502 { event
.Enable(IsFirstEnabled()); }
503 void OnUpdateLastButton(wxUpdateUIEvent
& event
)
504 { event
.Enable(IsLastEnabled()); }
505 void OnUpdateZoomInButton(wxUpdateUIEvent
& event
)
506 { event
.Enable(IsZoomInEnabled()); }
507 void OnUpdateZoomOutButton(wxUpdateUIEvent
& event
)
508 { event
.Enable(IsZoomOutEnabled()); }
510 // These methods are not private because they are called by wxPreviewCanvas.
515 wxPrintPreviewBase
* m_printPreview
;
516 wxButton
* m_closeButton
;
517 wxChoice
* m_zoomControl
;
518 wxPrintPageTextCtrl
* m_currentPageText
;
519 wxPrintPageMaxCtrl
* m_maxPageText
;
524 void DoGotoPage(int page
);
528 bool IsNextEnabled() const;
529 bool IsPreviousEnabled() const;
530 bool IsFirstEnabled() const;
531 bool IsLastEnabled() const;
532 bool IsZoomInEnabled() const;
533 bool IsZoomOutEnabled() const;
535 void OnZoomInButton(wxCommandEvent
& WXUNUSED(event
)) { DoZoomIn(); }
536 void OnZoomOutButton(wxCommandEvent
& WXUNUSED(event
)) { DoZoomOut(); }
537 void OnZoomChoice(wxCommandEvent
& WXUNUSED(event
)) { DoZoom(); }
539 DECLARE_EVENT_TABLE()
540 wxDECLARE_NO_COPY_CLASS(wxPreviewControlBar
);
543 //----------------------------------------------------------------------------
544 // wxPrintPreviewBase
545 //----------------------------------------------------------------------------
548 * Programmer creates an object of this class to preview a wxPrintout.
551 class WXDLLIMPEXP_CORE wxPrintPreviewBase
: public wxObject
554 wxPrintPreviewBase(wxPrintout
*printout
,
555 wxPrintout
*printoutForPrinting
= NULL
,
556 wxPrintDialogData
*data
= NULL
);
557 wxPrintPreviewBase(wxPrintout
*printout
,
558 wxPrintout
*printoutForPrinting
,
560 virtual ~wxPrintPreviewBase();
562 virtual bool SetCurrentPage(int pageNum
);
563 virtual int GetCurrentPage() const;
565 virtual void SetPrintout(wxPrintout
*printout
);
566 virtual wxPrintout
*GetPrintout() const;
567 virtual wxPrintout
*GetPrintoutForPrinting() const;
569 virtual void SetFrame(wxFrame
*frame
);
570 virtual void SetCanvas(wxPreviewCanvas
*canvas
);
572 virtual wxFrame
*GetFrame() const;
573 virtual wxPreviewCanvas
*GetCanvas() const;
575 // This is a helper routine, used by the next 4 routines.
577 virtual void CalcRects(wxPreviewCanvas
*canvas
, wxRect
& printableAreaRect
, wxRect
& paperRect
);
579 // The preview canvas should call this from OnPaint
580 virtual bool PaintPage(wxPreviewCanvas
*canvas
, wxDC
& dc
);
582 // Updates rendered page by calling RenderPage() if needed, returns true
583 // if there was some change. Preview canvas should call it at idle time
584 virtual bool UpdatePageRendering();
586 // This draws a blank page onto the preview canvas
587 virtual bool DrawBlankPage(wxPreviewCanvas
*canvas
, wxDC
& dc
);
589 // Adjusts the scrollbars for the current scale
590 virtual void AdjustScrollbars(wxPreviewCanvas
*canvas
);
592 // This is called by wxPrintPreview to render a page into a wxMemoryDC.
593 virtual bool RenderPage(int pageNum
);
596 virtual void SetZoom(int percent
);
597 virtual int GetZoom() const;
599 virtual wxPrintDialogData
& GetPrintDialogData();
601 virtual int GetMaxPage() const;
602 virtual int GetMinPage() const;
604 virtual bool Ok() const { return IsOk(); }
605 virtual bool IsOk() const;
606 virtual void SetOk(bool ok
);
608 ///////////////////////////////////////////////////////////////////////////
611 // If we own a wxPrintout that can be used for printing, this
612 // will invoke the actual printing procedure. Called
613 // by the wxPreviewControlBar.
614 virtual bool Print(bool interactive
) = 0;
616 // Calculate scaling that needs to be done to get roughly
617 // the right scaling for the screen pretending to be
618 // the currently selected printer.
619 virtual void DetermineScaling() = 0;
622 // helpers for RenderPage():
623 virtual bool RenderPageIntoDC(wxDC
& dc
, int pageNum
);
624 // renders preview into m_previewBitmap
625 virtual bool RenderPageIntoBitmap(wxBitmap
& bmp
, int pageNum
);
627 void InvalidatePreviewBitmap();
630 wxPrintDialogData m_printDialogData
;
631 wxPreviewCanvas
* m_previewCanvas
;
632 wxFrame
* m_previewFrame
;
633 wxBitmap
* m_previewBitmap
;
634 bool m_previewFailed
;
635 wxPrintout
* m_previewPrintout
;
636 wxPrintout
* m_printPrintout
;
639 float m_previewScaleX
;
640 float m_previewScaleY
;
649 bool m_printingPrepared
; // Called OnPreparePrinting?
652 void Init(wxPrintout
*printout
, wxPrintout
*printoutForPrinting
);
654 wxDECLARE_NO_COPY_CLASS(wxPrintPreviewBase
);
655 DECLARE_CLASS(wxPrintPreviewBase
)
658 //----------------------------------------------------------------------------
660 //----------------------------------------------------------------------------
662 class WXDLLIMPEXP_CORE wxPrintPreview
: public wxPrintPreviewBase
665 wxPrintPreview(wxPrintout
*printout
,
666 wxPrintout
*printoutForPrinting
= NULL
,
667 wxPrintDialogData
*data
= NULL
);
668 wxPrintPreview(wxPrintout
*printout
,
669 wxPrintout
*printoutForPrinting
,
671 virtual ~wxPrintPreview();
673 virtual bool SetCurrentPage(int pageNum
);
674 virtual int GetCurrentPage() const;
675 virtual void SetPrintout(wxPrintout
*printout
);
676 virtual wxPrintout
*GetPrintout() const;
677 virtual wxPrintout
*GetPrintoutForPrinting() const;
678 virtual void SetFrame(wxFrame
*frame
);
679 virtual void SetCanvas(wxPreviewCanvas
*canvas
);
681 virtual wxFrame
*GetFrame() const;
682 virtual wxPreviewCanvas
*GetCanvas() const;
683 virtual bool PaintPage(wxPreviewCanvas
*canvas
, wxDC
& dc
);
684 virtual bool UpdatePageRendering();
685 virtual bool DrawBlankPage(wxPreviewCanvas
*canvas
, wxDC
& dc
);
686 virtual void AdjustScrollbars(wxPreviewCanvas
*canvas
);
687 virtual bool RenderPage(int pageNum
);
688 virtual void SetZoom(int percent
);
689 virtual int GetZoom() const;
691 virtual bool Print(bool interactive
);
692 virtual void DetermineScaling();
694 virtual wxPrintDialogData
& GetPrintDialogData();
696 virtual int GetMaxPage() const;
697 virtual int GetMinPage() const;
699 virtual bool Ok() const { return IsOk(); }
700 virtual bool IsOk() const;
701 virtual void SetOk(bool ok
);
704 wxPrintPreviewBase
*m_pimpl
;
707 DECLARE_CLASS(wxPrintPreview
)
708 wxDECLARE_NO_COPY_CLASS(wxPrintPreview
);
711 //----------------------------------------------------------------------------
712 // wxPrintAbortDialog
713 //----------------------------------------------------------------------------
715 class WXDLLIMPEXP_CORE wxPrintAbortDialog
: public wxDialog
718 wxPrintAbortDialog(wxWindow
*parent
,
719 const wxString
& title
,
720 const wxPoint
& pos
= wxDefaultPosition
,
721 const wxSize
& size
= wxDefaultSize
,
723 const wxString
& name
= wxT("dialog"))
724 : wxDialog(parent
, wxID_ANY
, title
, pos
, size
, style
, name
)
728 void OnCancel(wxCommandEvent
& event
);
731 DECLARE_EVENT_TABLE()
732 wxDECLARE_NO_COPY_CLASS(wxPrintAbortDialog
);
735 #endif // wxUSE_PRINTING_ARCHITECTURE