+
+enum {
+ wxPREVIEW_PRINT,
+ wxPREVIEW_PREVIOUS,
+ wxPREVIEW_NEXT,
+ wxPREVIEW_ZOOM,
+ wxPREVIEW_FIRST,
+ wxPREVIEW_LAST,
+ wxPREVIEW_GOTO,
+ wxPREVIEW_DEFAULT,
+
+ wxID_PREVIEW_CLOSE,
+ wxID_PREVIEW_NEXT,
+ wxID_PREVIEW_PREVIOUS,
+ wxID_PREVIEW_PRINT,
+ wxID_PREVIEW_ZOOM,
+ wxID_PREVIEW_FIRST,
+ wxID_PREVIEW_LAST,
+ wxID_PREVIEW_GOTO
+};
+
+class wxPreviewControlBar: public wxPanel
+{
+public:
+ wxPreviewControlBar(wxPrintPreview *preview,
+ long buttons,
+ wxWindow *parent,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxTAB_TRAVERSAL,
+ const wxString& name = wxPyPanelNameStr);
+ %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
+
+ int GetZoomControl();
+ void SetZoomControl(int zoom);
+ wxPrintPreview* GetPrintPreview();
+
+ void OnNext();
+ void OnPrevious();
+ void OnFirst();
+ void OnLast();
+ void OnGoto();
+};
+
+
+//----------------------------------------------------------------------
+// Python-derivable versions of the above preview classes
+
+%{
+
+#define DEC_PYCALLBACK_BOOL_PREWINDC(CBNAME) \
+ bool CBNAME(wxPreviewCanvas* a, wxDC& b); \
+ bool base_##CBNAME(wxPreviewCanvas* a, wxDC& b)
+
+
+#define IMP_PYCALLBACK_BOOL_PREWINDC(CLASS, PCLASS, CBNAME) \
+ bool CLASS::CBNAME(wxPreviewCanvas* a, wxDC& b) { \
+ bool rval=FALSE; \
+ bool found; \
+ wxPyBeginBlockThreads(); \
+ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
+ PyObject* win = wxPyMake_wxObject(a); \
+ PyObject* dc = wxPyMake_wxObject(&b); \
+ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", win, dc));\
+ Py_DECREF(win); \
+ Py_DECREF(dc); \
+ } \
+ wxPyEndBlockThreads(); \
+ if (! found) \
+ rval = PCLASS::CBNAME(a, b); \
+ return rval; \
+ } \
+ bool CLASS::base_##CBNAME(wxPreviewCanvas* a, wxDC& b) { \
+ return PCLASS::CBNAME(a, b); \
+ }
+
+
+
+
+class wxPyPrintPreview : public wxPrintPreview
+{
+ DECLARE_CLASS(wxPyPrintPreview)
+public:
+ wxPyPrintPreview(wxPyPrintout* printout,
+ wxPyPrintout* printoutForPrinting,
+ wxPrintData* data=NULL)
+ : wxPrintPreview(printout, printoutForPrinting, data)
+ {}
+
+ DEC_PYCALLBACK_BOOL_INT(SetCurrentPage);
+ DEC_PYCALLBACK_BOOL_PREWINDC(PaintPage);
+ DEC_PYCALLBACK_BOOL_PREWINDC(DrawBlankPage);
+ DEC_PYCALLBACK_BOOL_INT(RenderPage);
+ DEC_PYCALLBACK_VOID_INT(SetZoom);
+ DEC_PYCALLBACK_BOOL_BOOL(Print);
+ DEC_PYCALLBACK_VOID_(DetermineScaling);
+
+ PYPRIVATE;
+};
+
+// Stupid renamed classes... Fix this in 2.5...
+#if defined(__WXMSW__)
+IMPLEMENT_CLASS( wxPyPrintPreview, wxWindowsPrintPreview );
+#elif defined(__WXMAC__)
+IMPLEMENT_CLASS( wxPyPrintPreview, wxMacPrintPreview );
+#else
+IMPLEMENT_CLASS( wxPyPrintPreview, wxPostScriptPrintPreview );
+#endif
+
+IMP_PYCALLBACK_BOOL_INT (wxPyPrintPreview, wxPrintPreview, SetCurrentPage);
+IMP_PYCALLBACK_BOOL_PREWINDC(wxPyPrintPreview, wxPrintPreview, PaintPage);
+IMP_PYCALLBACK_BOOL_PREWINDC(wxPyPrintPreview, wxPrintPreview, DrawBlankPage);
+IMP_PYCALLBACK_BOOL_INT (wxPyPrintPreview, wxPrintPreview, RenderPage);
+IMP_PYCALLBACK_VOID_INT (wxPyPrintPreview, wxPrintPreview, SetZoom);
+IMP_PYCALLBACK_BOOL_BOOL (wxPyPrintPreview, wxPrintPreview, Print);
+IMP_PYCALLBACK_VOID_ (wxPyPrintPreview, wxPrintPreview, DetermineScaling);
+%}
+
+
+class wxPyPrintPreview : public wxPrintPreview
+{
+public:
+ wxPyPrintPreview(wxPyPrintout* printout,
+ wxPyPrintout* printoutForPrinting,
+ wxPrintData* data=NULL);
+
+ void _setCallbackInfo(PyObject* self, PyObject* _class);
+ %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyPrintPreview)"
+
+ bool base_SetCurrentPage(int pageNum);
+ bool base_PaintPage(wxPreviewCanvas *canvas, wxDC& dc);
+ bool base_DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc);
+ bool base_RenderPage(int pageNum);
+ void base_SetZoom(int percent);
+ bool base_Print(bool interactive);
+ void base_DetermineScaling();
+};
+
+
+
+
+%{
+class wxPyPreviewFrame : public wxPreviewFrame
+{
+ DECLARE_CLASS(wxPyPreviewFrame);
+public:
+ wxPyPreviewFrame(wxPrintPreview* preview, wxFrame* parent,
+ const wxString& title,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_FRAME_STYLE,
+ const wxString& name = wxPyFrameNameStr)
+ : wxPreviewFrame(preview, parent, title, pos, size, style, name)
+ {}
+
+ void SetPreviewCanvas(wxPreviewCanvas* canvas) { m_previewCanvas = canvas; }
+ void SetControlBar(wxPreviewControlBar* bar) { m_controlBar = bar; }
+
+ DEC_PYCALLBACK_VOID_(Initialize);
+ DEC_PYCALLBACK_VOID_(CreateCanvas);
+ DEC_PYCALLBACK_VOID_(CreateControlBar);
+
+ PYPRIVATE;