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