- 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 = NULL, wxPrintData *data = 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;
+ DECLARE_CLASS(wxPrintPreviewBase)
+
+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);
+ int GetCurrentPage() const { return m_currentPage; };
+
+ void SetPrintout(wxPrintout *printout) { m_previewPrintout = printout; };
+ wxPrintout *GetPrintout() const { return m_previewPrintout; };
+ wxPrintout *GetPrintoutForPrinting() const { return m_printPrintout; };
+
+ void SetFrame(wxFrame *frame) { m_previewFrame = frame; };
+ void SetCanvas(wxWindow *canvas) { m_previewCanvas = canvas; };
+
+ virtual wxFrame *GetFrame() const { return m_previewFrame; }
+ virtual wxWindow *GetCanvas() const { return m_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);
+
+ wxPrintDialogData& GetPrintDialogData() { return m_printDialogData; }
+
+ virtual void SetZoom(int percent);
+ int GetZoom() const { return m_currentZoom; };
+
+ int GetMaxPage() const { return m_maxPage; }
+ int GetMinPage() const { return m_minPage; }
+
+ bool Ok() const { return m_isOk; }
+ void SetOk(bool ok) { m_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() = 0;
+
+protected:
+ wxPrintDialogData m_printDialogData;
+ wxWindow* 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);