const wxString& name = wxT("canvas"));
virtual ~wxPreviewCanvas();
+ void SetPreview(wxPrintPreviewBase *preview) { m_printPreview = preview; }
+
void OnPaint(wxPaintEvent& event);
void OnChar(wxKeyEvent &event);
// Responds to colour changes
#if wxUSE_MOUSEWHEEL
void OnMouseWheel(wxMouseEvent& event);
#endif // wxUSE_MOUSEWHEEL
+ void OnIdle(wxIdleEvent& event);
wxPrintPreviewBase* m_printPreview;
// The preview canvas should call this from OnPaint
virtual bool PaintPage(wxPreviewCanvas *canvas, wxDC& dc);
+ // Updates rendered page by calling RenderPage() if needed, returns true
+ // if there was some change. Preview canvas should call it at idle time
+ virtual bool UpdatePageRendering();
+
// This draws a blank page onto the preview canvas
virtual bool DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc);
// the currently selected printer.
virtual void DetermineScaling() = 0;
+protected:
+ // helpers for RenderPage():
+ virtual bool RenderPageIntoDC(wxDC& dc, int pageNum);
+ // renders preview into m_previewBitmap
+ virtual bool RenderPageIntoBitmap(wxBitmap& bmp, int pageNum);
+
+ void InvalidatePreviewBitmap();
+
protected:
wxPrintDialogData m_printDialogData;
wxPreviewCanvas* m_previewCanvas;
wxFrame* m_previewFrame;
wxBitmap* m_previewBitmap;
+ bool m_previewFailed;
wxPrintout* m_previewPrintout;
wxPrintout* m_printPrintout;
int m_currentPage;
virtual wxFrame *GetFrame() const;
virtual wxPreviewCanvas *GetCanvas() const;
virtual bool PaintPage(wxPreviewCanvas *canvas, wxDC& dc);
+ virtual bool UpdatePageRendering();
virtual bool DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc);
virtual void AdjustScrollbars(wxPreviewCanvas *canvas);
virtual bool RenderPage(int pageNum);