Implemented high-quality preview for wxMSW (this approach doesn't work
[wxWidgets.git] / include / wx / msw / printwin.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: printwin.h
3 // Purpose: wxWindowsPrinter, wxWindowsPrintPreview classes
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_PRINTWIN_H_
13 #define _WX_PRINTWIN_H_
14
15 #include "wx/prntbase.h"
16
17 // ---------------------------------------------------------------------------
18 // Represents the printer: manages printing a wxPrintout object
19 // ---------------------------------------------------------------------------
20
21 class WXDLLIMPEXP_CORE wxWindowsPrinter : public wxPrinterBase
22 {
23 DECLARE_DYNAMIC_CLASS(wxWindowsPrinter)
24
25 public:
26 wxWindowsPrinter(wxPrintDialogData *data = NULL);
27 virtual ~wxWindowsPrinter();
28
29 virtual bool Print(wxWindow *parent,
30 wxPrintout *printout,
31 bool prompt = true);
32
33 virtual wxDC *PrintDialog(wxWindow *parent);
34 virtual bool Setup(wxWindow *parent);
35
36 private:
37 WXFARPROC m_lpAbortProc;
38
39 DECLARE_NO_COPY_CLASS(wxWindowsPrinter)
40 };
41
42 // ---------------------------------------------------------------------------
43 // wxPrintPreview: programmer creates an object of this class to preview a
44 // wxPrintout.
45 // ---------------------------------------------------------------------------
46
47 #define wxUSE_HIGH_QUALITY_PREVIEW (wxUSE_IMAGE && wxUSE_WXDIB)
48
49 class WXDLLIMPEXP_CORE wxWindowsPrintPreview : public wxPrintPreviewBase
50 {
51 public:
52 wxWindowsPrintPreview(wxPrintout *printout,
53 wxPrintout *printoutForPrinting = NULL,
54 wxPrintDialogData *data = NULL);
55 wxWindowsPrintPreview(wxPrintout *printout,
56 wxPrintout *printoutForPrinting,
57 wxPrintData *data);
58 virtual ~wxWindowsPrintPreview();
59
60 virtual bool Print(bool interactive);
61 virtual void DetermineScaling();
62
63 #if wxUSE_HIGH_QUALITY_PREVIEW
64 protected:
65 bool RenderPageIntoBitmapHQ(wxBitmap& bmp, int pageNum);
66 virtual bool RenderPageIntoBitmap(wxBitmap& bmp, int pageNum);
67
68 private:
69 bool RenderPageFragment(float scaleX, float scaleY,
70 int *nextFinalLine,
71 wxPrinterDC& printer,
72 wxMemoryDC& finalDC,
73 const wxRect& rect,
74 int pageNum);
75
76 bool m_hqPreviewFailed;
77 #endif // wxUSE_HIGH_QUALITY_PREVIEW
78
79 DECLARE_DYNAMIC_CLASS_NO_COPY(wxWindowsPrintPreview)
80 };
81
82 #endif
83 // _WX_PRINTWIN_H_