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