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