public:
wxPrintDialog(wxWindow* parent, wxPrintDialogData* data = NULL);
- %pragma(python) addtomethod = "__init__:#wx._StdDialogCallbacks(self)"
-
wxPrintDialogData& GetPrintDialogData();
%new wxDC* GetPrintDC();
int ShowModal();
wxPyPrintout *GetPrintoutForPrinting();
void SetFrame(wxFrame *frame);
- void SetCanvas(wxWindow *canvas);
+ void SetCanvas(wxPreviewCanvas *canvas);
virtual wxFrame *GetFrame();
- virtual wxWindow *GetCanvas();
+ virtual wxPreviewCanvas *GetCanvas();
// The preview canvas should call this from OnPaint
- virtual bool PaintPage(wxWindow *canvas, wxDC& dc);
+ virtual bool PaintPage(wxPreviewCanvas *canvas, wxDC& dc);
// This draws a blank page onto the preview canvas
- virtual bool DrawBlankPage(wxWindow *canvas, wxDC& dc);
+ virtual bool DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc);
// This is called by wxPrintPreview to render a page into a wxMemoryDC.
virtual bool RenderPage(int pageNum);
+ // Adjusts the scrollbars for the current scale
+ virtual void AdjustScrollbars(wxPreviewCanvas *canvas);
+
wxPrintDialogData& GetPrintDialogData();
virtual void SetZoom(int percent);
void Initialize();
void CreateControlBar();
void CreateCanvas();
+
+ wxPreviewControlBar* GetControlBar() const;
};
wxWindow *parent,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
- long style = 0,
+ long style = wxTAB_TRAVERSAL,
const wxString& name = wxPyPanelNameStr);
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
// 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)
{}
DEC_PYCALLBACK_BOOL_INT(SetCurrentPage);
- DEC_PYCALLBACK_BOOL_WXWINDC(PaintPage);
- DEC_PYCALLBACK_BOOL_WXWINDC(DrawBlankPage);
+ 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);
IMPLEMENT_CLASS( wxPyPrintPreview, wxPostScriptPrintPreview );
#endif
-IMP_PYCALLBACK_BOOL_INT (wxPyPrintPreview, wxPrintPreview, SetCurrentPage);
-IMP_PYCALLBACK_BOOL_WXWINDC(wxPyPrintPreview, wxPrintPreview, PaintPage);
-IMP_PYCALLBACK_BOOL_WXWINDC(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);
+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);
%}
%pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyPrintPreview)"
bool base_SetCurrentPage(int pageNum);
- bool base_PaintPage(wxWindow *canvas, wxDC& dc);
- bool base_DrawBlankPage(wxWindow *canvas, wxDC& dc);
+ 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);
: wxPreviewFrame(preview, parent, title, pos, size, style, name)
{}
- void SetPreviewCanvas(wxWindow* canvas) { m_previewCanvas = canvas; }
+ void SetPreviewCanvas(wxPreviewCanvas* canvas) { m_previewCanvas = canvas; }
void SetControlBar(wxPreviewControlBar* bar) { m_controlBar = bar; }
DEC_PYCALLBACK_VOID_(Initialize);
%pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyPreviewFrame)"
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
- void SetPreviewCanvas(wxWindow* canvas);
+ void SetPreviewCanvas(wxPreviewCanvas* canvas);
void SetControlBar(wxPreviewControlBar* bar);
void base_Initialize();