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