1
/////////////////////////////////////////////////////////////////////////////
3
// Purpose: Base classes for printing framework
4
// Author: Julian Smart
7
// RCS-ID: $Id: prntbase.h 68026 2011-06-22 22:58:07Z VZ $
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
// Either Initialize() or InitializeWithModality() must be called before
402
// showing the preview frame, the former being just a particular case of
403
// the latter initializing the frame for being showing app-modally.
405
// Notice that we must keep Initialize() with its existing signature to
406
// avoid breaking the old code that overrides it and we can't reuse the
407
// same name for the other functions to avoid virtual function hiding
408
// problem and the associated warnings given by some compilers (e.g. from
409
// g++ with -Woverloaded-virtual).
410
virtual void Initialize()
412
InitializeWithModality(wxPreviewFrame_AppModal);
415
// Also note that this method is not virtual as it doesn't need to be
416
// overridden: it's never called by wxWidgets (of course, the same is true
417
// for Initialize() but, again, it must remain virtual for compatibility).
418
void InitializeWithModality(wxPreviewFrameModalityKind kind);
420
void OnCloseWindow(wxCloseEvent& event);
421
virtual void CreateCanvas();
422
virtual void CreateControlBar();
424
inline wxPreviewControlBar* GetControlBar() const { return m_controlBar; }
427
wxPreviewCanvas* m_previewCanvas;
428
wxPreviewControlBar* m_controlBar;
429
wxPrintPreviewBase* m_printPreview;
430
wxWindowDisabler* m_windowDisabler;
432
wxPreviewFrameModalityKind m_modalityKind;
436
void OnChar(wxKeyEvent& event);
438
DECLARE_EVENT_TABLE()
439
DECLARE_CLASS(wxPreviewFrame)
440
wxDECLARE_NO_COPY_CLASS(wxPreviewFrame);
443
//----------------------------------------------------------------------------
444
// wxPreviewControlBar
445
//----------------------------------------------------------------------------
448
* A panel with buttons for controlling a print preview.
449
* The programmer may wish to use other means for controlling
453
#define wxPREVIEW_PRINT 1
454
#define wxPREVIEW_PREVIOUS 2
455
#define wxPREVIEW_NEXT 4
456
#define wxPREVIEW_ZOOM 8
457
#define wxPREVIEW_FIRST 16
458
#define wxPREVIEW_LAST 32
459
#define wxPREVIEW_GOTO 64
461
#define wxPREVIEW_DEFAULT (wxPREVIEW_PREVIOUS|wxPREVIEW_NEXT|wxPREVIEW_ZOOM\
462
|wxPREVIEW_FIRST|wxPREVIEW_GOTO|wxPREVIEW_LAST)
465
#define wxID_PREVIEW_CLOSE 1
466
#define wxID_PREVIEW_NEXT 2
467
#define wxID_PREVIEW_PREVIOUS 3
468
#define wxID_PREVIEW_PRINT 4
469
#define wxID_PREVIEW_ZOOM 5
470
#define wxID_PREVIEW_FIRST 6
471
#define wxID_PREVIEW_LAST 7
472
#define wxID_PREVIEW_GOTO 8
473
#define wxID_PREVIEW_ZOOM_IN 9
474
#define wxID_PREVIEW_ZOOM_OUT 10
476
class WXDLLIMPEXP_CORE wxPreviewControlBar: public wxPanel
478
DECLARE_CLASS(wxPreviewControlBar)
481
wxPreviewControlBar(wxPrintPreviewBase *preview,
484
const wxPoint& pos = wxDefaultPosition,
485
const wxSize& size = wxDefaultSize,
486
long style = wxTAB_TRAVERSAL,
487
const wxString& name = wxT("panel"));
488
virtual ~wxPreviewControlBar();
490
virtual void CreateButtons();
491
virtual void SetPageInfo(int minPage, int maxPage);
492
virtual void SetZoomControl(int zoom);
493
virtual int GetZoomControl();
494
virtual wxPrintPreviewBase *GetPrintPreview() const
495
{ return m_printPreview; }
498
// Implementation only from now on.
499
void OnWindowClose(wxCommandEvent& event);
507
void OnPrintButton(wxCommandEvent& WXUNUSED(event)) { OnPrint(); }
508
void OnNextButton(wxCommandEvent & WXUNUSED(event)) { OnNext(); }
509
void OnPreviousButton(wxCommandEvent & WXUNUSED(event)) { OnPrevious(); }
510
void OnFirstButton(wxCommandEvent & WXUNUSED(event)) { OnFirst(); }
511
void OnLastButton(wxCommandEvent & WXUNUSED(event)) { OnLast(); }
512
void OnPaint(wxPaintEvent& event);
514
void OnUpdateNextButton(wxUpdateUIEvent& event)
515
{ event.Enable(IsNextEnabled()); }
516
void OnUpdatePreviousButton(wxUpdateUIEvent& event)
517
{ event.Enable(IsPreviousEnabled()); }
518
void OnUpdateFirstButton(wxUpdateUIEvent& event)
519
{ event.Enable(IsFirstEnabled()); }
520
void OnUpdateLastButton(wxUpdateUIEvent& event)
521
{ event.Enable(IsLastEnabled()); }
522
void OnUpdateZoomInButton(wxUpdateUIEvent& event)
523
{ event.Enable(IsZoomInEnabled()); }
524
void OnUpdateZoomOutButton(wxUpdateUIEvent& event)
525
{ event.Enable(IsZoomOutEnabled()); }
527
// These methods are not private because they are called by wxPreviewCanvas.
532
wxPrintPreviewBase* m_printPreview;
533
wxButton* m_closeButton;
534
wxChoice* m_zoomControl;
535
wxPrintPageTextCtrl* m_currentPageText;
536
wxPrintPageMaxCtrl* m_maxPageText;
541
void DoGotoPage(int page);
545
bool IsNextEnabled() const;
546
bool IsPreviousEnabled() const;
547
bool IsFirstEnabled() const;
548
bool IsLastEnabled() const;
549
bool IsZoomInEnabled() const;
550
bool IsZoomOutEnabled() const;
552
void OnZoomInButton(wxCommandEvent & WXUNUSED(event)) { DoZoomIn(); }
553
void OnZoomOutButton(wxCommandEvent & WXUNUSED(event)) { DoZoomOut(); }
554
void OnZoomChoice(wxCommandEvent& WXUNUSED(event)) { DoZoom(); }
556
DECLARE_EVENT_TABLE()
557
wxDECLARE_NO_COPY_CLASS(wxPreviewControlBar);
560
//----------------------------------------------------------------------------
561
// wxPrintPreviewBase
562
//----------------------------------------------------------------------------
565
* Programmer creates an object of this class to preview a wxPrintout.
568
class WXDLLIMPEXP_CORE wxPrintPreviewBase: public wxObject
571
wxPrintPreviewBase(wxPrintout *printout,
572
wxPrintout *printoutForPrinting = NULL,
573
wxPrintDialogData *data = NULL);
574
wxPrintPreviewBase(wxPrintout *printout,
575
wxPrintout *printoutForPrinting,
577
virtual ~wxPrintPreviewBase();
579
virtual bool SetCurrentPage(int pageNum);
580
virtual int GetCurrentPage() const;
582
virtual void SetPrintout(wxPrintout *printout);
583
virtual wxPrintout *GetPrintout() const;
584
virtual wxPrintout *GetPrintoutForPrinting() const;
586
virtual void SetFrame(wxFrame *frame);
587
virtual void SetCanvas(wxPreviewCanvas *canvas);
589
virtual wxFrame *GetFrame() const;
590
virtual wxPreviewCanvas *GetCanvas() const;
592
// This is a helper routine, used by the next 4 routines.
594
virtual void CalcRects(wxPreviewCanvas *canvas, wxRect& printableAreaRect, wxRect& paperRect);
596
// The preview canvas should call this from OnPaint
597
virtual bool PaintPage(wxPreviewCanvas *canvas, wxDC& dc);
599
// Updates rendered page by calling RenderPage() if needed, returns true
600
// if there was some change. Preview canvas should call it at idle time
601
virtual bool UpdatePageRendering();
603
// This draws a blank page onto the preview canvas
604
virtual bool DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc);
606
// Adjusts the scrollbars for the current scale
607
virtual void AdjustScrollbars(wxPreviewCanvas *canvas);
609
// This is called by wxPrintPreview to render a page into a wxMemoryDC.
610
virtual bool RenderPage(int pageNum);
613
virtual void SetZoom(int percent);
614
virtual int GetZoom() const;
616
virtual wxPrintDialogData& GetPrintDialogData();
618
virtual int GetMaxPage() const;
619
virtual int GetMinPage() const;
621
virtual bool Ok() const { return IsOk(); }
622
virtual bool IsOk() const;
623
virtual void SetOk(bool ok);
625
///////////////////////////////////////////////////////////////////////////
628
// If we own a wxPrintout that can be used for printing, this
629
// will invoke the actual printing procedure. Called
630
// by the wxPreviewControlBar.
631
virtual bool Print(bool interactive) = 0;
633
// Calculate scaling that needs to be done to get roughly
634
// the right scaling for the screen pretending to be
635
// the currently selected printer.
636
virtual void DetermineScaling() = 0;
639
// helpers for RenderPage():
640
virtual bool RenderPageIntoDC(wxDC& dc, int pageNum);
641
// renders preview into m_previewBitmap
642
virtual bool RenderPageIntoBitmap(wxBitmap& bmp, int pageNum);
644
void InvalidatePreviewBitmap();
647
wxPrintDialogData m_printDialogData;
648
wxPreviewCanvas* m_previewCanvas;
649
wxFrame* m_previewFrame;
650
wxBitmap* m_previewBitmap;
651
bool m_previewFailed;
652
wxPrintout* m_previewPrintout;
653
wxPrintout* m_printPrintout;
656
float m_previewScaleX;
657
float m_previewScaleY;
666
bool m_printingPrepared; // Called OnPreparePrinting?
669
void Init(wxPrintout *printout, wxPrintout *printoutForPrinting);
671
wxDECLARE_NO_COPY_CLASS(wxPrintPreviewBase);
672
DECLARE_CLASS(wxPrintPreviewBase)
675
//----------------------------------------------------------------------------
677
//----------------------------------------------------------------------------
679
class WXDLLIMPEXP_CORE wxPrintPreview: public wxPrintPreviewBase
682
wxPrintPreview(wxPrintout *printout,
683
wxPrintout *printoutForPrinting = NULL,
684
wxPrintDialogData *data = NULL);
685
wxPrintPreview(wxPrintout *printout,
686
wxPrintout *printoutForPrinting,
688
virtual ~wxPrintPreview();
690
virtual bool SetCurrentPage(int pageNum);
691
virtual int GetCurrentPage() const;
692
virtual void SetPrintout(wxPrintout *printout);
693
virtual wxPrintout *GetPrintout() const;
694
virtual wxPrintout *GetPrintoutForPrinting() const;
695
virtual void SetFrame(wxFrame *frame);
696
virtual void SetCanvas(wxPreviewCanvas *canvas);
698
virtual wxFrame *GetFrame() const;
699
virtual wxPreviewCanvas *GetCanvas() const;
700
virtual bool PaintPage(wxPreviewCanvas *canvas, wxDC& dc);
701
virtual bool UpdatePageRendering();
702
virtual bool DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc);
703
virtual void AdjustScrollbars(wxPreviewCanvas *canvas);
704
virtual bool RenderPage(int pageNum);
705
virtual void SetZoom(int percent);
706
virtual int GetZoom() const;
708
virtual bool Print(bool interactive);
709
virtual void DetermineScaling();
711
virtual wxPrintDialogData& GetPrintDialogData();
713
virtual int GetMaxPage() const;
714
virtual int GetMinPage() const;
716
virtual bool Ok() const { return IsOk(); }
717
virtual bool IsOk() const;
718
virtual void SetOk(bool ok);
721
wxPrintPreviewBase *m_pimpl;
724
DECLARE_CLASS(wxPrintPreview)
725
wxDECLARE_NO_COPY_CLASS(wxPrintPreview);
728
//----------------------------------------------------------------------------
729
// wxPrintAbortDialog
730
//----------------------------------------------------------------------------
732
class WXDLLIMPEXP_CORE wxPrintAbortDialog: public wxDialog
735
wxPrintAbortDialog(wxWindow *parent,
736
const wxString& title,
737
const wxPoint& pos = wxDefaultPosition,
738
const wxSize& size = wxDefaultSize,
740
const wxString& name = wxT("dialog"))
741
: wxDialog(parent, wxID_ANY, title, pos, size, style, name)
745
void OnCancel(wxCommandEvent& event);
748
DECLARE_EVENT_TABLE()
749
wxDECLARE_NO_COPY_CLASS(wxPrintAbortDialog);
752
#endif // wxUSE_PRINTING_ARCHITECTURE