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