Lots of changes for wxPython to start using many of the new featues in

wxWindows 2.5


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22265 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2003-07-24 00:28:34 +00:00
parent e4a7bbfc1e
commit 3ef86e32dd
61 changed files with 5696 additions and 1666 deletions

View File

@@ -423,20 +423,23 @@ public:
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);
@@ -468,6 +471,8 @@ public:
void Initialize();
void CreateControlBar();
void CreateCanvas();
wxPreviewControlBar* GetControlBar() const;
};
@@ -513,7 +518,7 @@ public:
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)"
@@ -533,6 +538,36 @@ public:
// 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)
@@ -544,8 +579,8 @@ public:
{}
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);
@@ -563,13 +598,13 @@ IMPLEMENT_CLASS( wxPyPrintPreview, wxMacPrintPreview );
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);
%}
@@ -584,8 +619,8 @@ public:
%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);
@@ -609,7 +644,7 @@ public:
: 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);
@@ -640,7 +675,7 @@ public:
%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();