- DECLARE_CLASS(wxPrintPreviewBase)
-
- protected:
- wxPrintData printData;
- wxWindow *previewCanvas;
- wxFrame *previewFrame;
- wxBitmap *previewBitmap;
- wxPrintout *previewPrintout;
- wxPrintout *printPrintout;
- int currentPage;
- int currentZoom;
- float previewScale;
- int topMargin;
- int leftMargin;
- int pageWidth;
- int pageHeight;
- int minPage;
- int maxPage;
- protected:
- bool isOk;
- public:
- wxPrintPreviewBase(wxPrintout *printout, wxPrintout *printoutForPrinting = (wxPrintout *) NULL, wxPrintData *data = (wxPrintData *) NULL);
- ~wxPrintPreviewBase(void);
-
- virtual bool SetCurrentPage(int pageNum);
- inline int GetCurrentPage(void) { return currentPage; };
-
- inline void SetPrintout(wxPrintout *printout) { previewPrintout = printout; };
- inline wxPrintout *GetPrintout(void) { return previewPrintout; };
- inline wxPrintout *GetPrintoutForPrinting(void) { return printPrintout; };
-
- inline void SetFrame(wxFrame *frame) { previewFrame = frame; };
- inline void SetCanvas(wxWindow *canvas) { previewCanvas = canvas; };
-
- inline virtual wxFrame *GetFrame(void) { return previewFrame; }
- inline virtual wxWindow *GetCanvas(void) { return previewCanvas; }
-
- // The preview canvas should call this from OnPaint
- virtual bool PaintPage(wxWindow *canvas, wxDC& dc);
-
- // This draws a blank page onto the preview canvas
- virtual bool DrawBlankPage(wxWindow *canvas, wxDC& dc);
-
- // This is called by wxPrintPreview to render a page into
- // a wxMemoryDC.
- virtual bool RenderPage(int pageNum);
-
- inline wxPrintData& GetPrintData(void) { return printData; }
-
- virtual void SetZoom(int percent);
- int GetZoom(void) { return currentZoom; };
-
- inline int GetMaxPage(void) { return maxPage; }
- inline int GetMinPage(void) { return minPage; }
-
- inline bool Ok(void) { return isOk; }
- inline void SetOk(bool ok) { isOk = ok; }
-
- ///////////////////////////////////////////////////////////////////////////
- // OVERRIDES
-
- // If we own a wxPrintout that can be used for printing, this
- // will invoke the actual printing procedure. Called
- // by the wxPreviewControlBar.
- virtual bool Print(bool interactive) = 0;
-
- // Calculate scaling that needs to be done to get roughly
- // the right scaling for the screen pretending to be
- // the currently selected printer.
- virtual void DetermineScaling(void) = 0;
+public:
+ wxPrintPreviewBase(wxPrintout *printout,
+ wxPrintout *printoutForPrinting = (wxPrintout *) NULL,
+ wxPrintDialogData *data = (wxPrintDialogData *) NULL);
+ wxPrintPreviewBase(wxPrintout *printout,
+ wxPrintout *printoutForPrinting,
+ wxPrintData *data);
+ virtual ~wxPrintPreviewBase();
+
+ virtual bool SetCurrentPage(int pageNum);
+ virtual int GetCurrentPage() const;
+
+ virtual void SetPrintout(wxPrintout *printout);
+ virtual wxPrintout *GetPrintout() const;
+ virtual wxPrintout *GetPrintoutForPrinting() const;
+
+ virtual void SetFrame(wxFrame *frame);
+ virtual void SetCanvas(wxPreviewCanvas *canvas);
+
+ virtual wxFrame *GetFrame() const;
+ virtual wxPreviewCanvas *GetCanvas() const;
+
+ // The preview canvas should call this from OnPaint
+ virtual bool PaintPage(wxPreviewCanvas *canvas, wxDC& dc);
+
+ // This draws a blank page onto the preview canvas
+ virtual bool DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc);
+
+ // Adjusts the scrollbars for the current scale
+ virtual void AdjustScrollbars(wxPreviewCanvas *canvas);
+
+ // This is called by wxPrintPreview to render a page into a wxMemoryDC.
+ virtual bool RenderPage(int pageNum);
+
+
+ virtual void SetZoom(int percent);
+ virtual int GetZoom() const;
+
+ virtual wxPrintDialogData& GetPrintDialogData();
+
+ virtual int GetMaxPage() const;
+ virtual int GetMinPage() const;
+
+ virtual bool Ok() const;
+ virtual void SetOk(bool ok);
+
+ ///////////////////////////////////////////////////////////////////////////
+ // OVERRIDES
+
+ // If we own a wxPrintout that can be used for printing, this
+ // will invoke the actual printing procedure. Called
+ // by the wxPreviewControlBar.
+ virtual bool Print(bool interactive) = 0;
+
+ // Calculate scaling that needs to be done to get roughly
+ // the right scaling for the screen pretending to be
+ // the currently selected printer.
+ virtual void DetermineScaling() = 0;
+
+protected:
+ wxPrintDialogData m_printDialogData;
+ wxPreviewCanvas* m_previewCanvas;
+ wxFrame* m_previewFrame;
+ wxBitmap* m_previewBitmap;
+ wxPrintout* m_previewPrintout;
+ wxPrintout* m_printPrintout;
+ int m_currentPage;
+ int m_currentZoom;
+ float m_previewScale;
+ int m_topMargin;
+ int m_leftMargin;
+ int m_pageWidth;
+ int m_pageHeight;
+ int m_minPage;
+ int m_maxPage;
+
+ bool m_isOk;
+ bool m_printingPrepared; // Called OnPreparePrinting?
+
+private:
+ void Init(wxPrintout *printout, wxPrintout *printoutForPrinting);
+
+ DECLARE_NO_COPY_CLASS(wxPrintPreviewBase)
+ DECLARE_CLASS(wxPrintPreviewBase)
+};
+
+//----------------------------------------------------------------------------
+// wxPrintPreview
+//----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxPrintPreview: public wxPrintPreviewBase
+{
+public:
+ wxPrintPreview(wxPrintout *printout,
+ wxPrintout *printoutForPrinting = (wxPrintout *) NULL,
+ wxPrintDialogData *data = (wxPrintDialogData *) NULL);
+ wxPrintPreview(wxPrintout *printout,
+ wxPrintout *printoutForPrinting,
+ wxPrintData *data);
+ virtual ~wxPrintPreview();
+
+ virtual bool SetCurrentPage(int pageNum);
+ virtual int GetCurrentPage() const;
+ virtual void SetPrintout(wxPrintout *printout);
+ virtual wxPrintout *GetPrintout() const;
+ virtual wxPrintout *GetPrintoutForPrinting() const;
+ virtual void SetFrame(wxFrame *frame);
+ virtual void SetCanvas(wxPreviewCanvas *canvas);
+
+ virtual wxFrame *GetFrame() const;
+ virtual wxPreviewCanvas *GetCanvas() const;
+ virtual bool PaintPage(wxPreviewCanvas *canvas, wxDC& dc);
+ virtual bool DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc);
+ virtual void AdjustScrollbars(wxPreviewCanvas *canvas);
+ virtual bool RenderPage(int pageNum);
+ virtual void SetZoom(int percent);
+
+ virtual bool Print(bool interactive);
+ virtual void DetermineScaling();
+
+ virtual wxPrintDialogData& GetPrintDialogData();
+
+ virtual int GetMaxPage() const;
+ virtual int GetMinPage() const;
+
+ virtual bool Ok() const;
+ virtual void SetOk(bool ok);
+
+private:
+ wxPrintPreviewBase *m_pimpl;
+
+private:
+ DECLARE_CLASS(wxPrintPreview)
+ DECLARE_NO_COPY_CLASS(wxPrintPreview)