X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/48115f4a69bf87e13f838d98c4046c7245fb968d..85bc0351f76f6d3f00460a167fc108b900e0725c:/utils/wxPython/src/msw/printfw.cpp diff --git a/utils/wxPython/src/msw/printfw.cpp b/utils/wxPython/src/msw/printfw.cpp index bbfc4ce156..ddfbd057a7 100644 --- a/utils/wxPython/src/msw/printfw.cpp +++ b/utils/wxPython/src/msw/printfw.cpp @@ -57,6 +57,8 @@ extern PyObject *SWIG_newvarlink(void); #include #include +#include "printfw.h" + static PyObject* l_output_helper(PyObject* target, PyObject* o) { PyObject* o2; PyObject* o3; @@ -106,66 +108,53 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) { static char* wxStringErrorMsg = "string type is required for parameter"; -class wxPyPrintout : public wxPrintout { -public: - wxPyPrintout(const wxString& title) : wxPrintout(title) {} - - DEC_PYCALLBACK_BOOL_INTINT(OnBeginDocument); - DEC_PYCALLBACK__(OnEndDocument); - DEC_PYCALLBACK__(OnBeginPrinting); - DEC_PYCALLBACK__(OnEndPrinting); - DEC_PYCALLBACK__(OnPreparePrinting); - DEC_PYCALLBACK_BOOL_INT_pure(OnPrintPage); - DEC_PYCALLBACK_BOOL_INT(HasPage); - - - // Since this one would be tough and ugly to do with the Macros... - void GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo) { - bool hadErr = false; - - bool doSave = wxPyRestoreThread(); - if (m_myInst.findCallback("GetPageInfo")) { - PyObject* result = m_myInst.callCallbackObj(Py_BuildValue("()")); - if (result && PyTuple_Check(result) && PyTuple_Size(result) == 4) { - PyObject* val; - - val = PyTuple_GetItem(result, 0); - if (PyInt_Check(val)) *minPage = PyInt_AsLong(val); - else hadErr = true; - - val = PyTuple_GetItem(result, 1); - if (PyInt_Check(val)) *maxPage = PyInt_AsLong(val); - else hadErr = true; - - val = PyTuple_GetItem(result, 2); - if (PyInt_Check(val)) *pageFrom = PyInt_AsLong(val); - else hadErr = true; - - val = PyTuple_GetItem(result, 3); - if (PyInt_Check(val)) *pageTo = PyInt_AsLong(val); - else hadErr = true; - } - else - hadErr = true; - - if (hadErr) { - PyErr_SetString(PyExc_TypeError, "GetPageInfo should return a tuple of 4 integers."); - PyErr_Print(); - } - Py_DECREF(result); + + +// Since this one would be tough and ugly to do with the Macros... +void wxPyPrintout::GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo) { + bool hadErr = FALSE; + + bool doSave = wxPyRestoreThread(); + if (m_myInst.findCallback("GetPageInfo")) { + PyObject* result = m_myInst.callCallbackObj(Py_BuildValue("()")); + if (result && PyTuple_Check(result) && PyTuple_Size(result) == 4) { + PyObject* val; + + val = PyTuple_GetItem(result, 0); + if (PyInt_Check(val)) *minPage = PyInt_AsLong(val); + else hadErr = TRUE; + + val = PyTuple_GetItem(result, 1); + if (PyInt_Check(val)) *maxPage = PyInt_AsLong(val); + else hadErr = TRUE; + + val = PyTuple_GetItem(result, 2); + if (PyInt_Check(val)) *pageFrom = PyInt_AsLong(val); + else hadErr = TRUE; + + val = PyTuple_GetItem(result, 3); + if (PyInt_Check(val)) *pageTo = PyInt_AsLong(val); + else hadErr = TRUE; } else - wxPrintout::GetPageInfo(minPage, maxPage, pageFrom, pageTo); + hadErr = TRUE; - wxPySaveThread(doSave); + if (hadErr) { + PyErr_SetString(PyExc_TypeError, "GetPageInfo should return a tuple of 4 integers."); + PyErr_Print(); + } + Py_DECREF(result); } - - void base_GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo) { + else wxPrintout::GetPageInfo(minPage, maxPage, pageFrom, pageTo); - } - PYPRIVATE; -}; + wxPySaveThread(doSave); +} + +void wxPyPrintout::base_GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo) { + wxPrintout::GetPageInfo(minPage, maxPage, pageFrom, pageTo); +} + IMP_PYCALLBACK_BOOL_INTINT(wxPyPrintout, wxPrintout, OnBeginDocument); IMP_PYCALLBACK__(wxPyPrintout, wxPrintout, OnEndDocument); @@ -337,7 +326,7 @@ static PyObject *_wrap_wxPrintData_GetPrinterName(PyObject *self, PyObject *args wxPy_END_ALLOW_THREADS; }{ - _resultobj = PyString_FromString(WXSTRINGCAST (*_result)); + _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); } return _resultobj; } @@ -4360,7 +4349,10 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxActivateEvent","_wxActivateEvent",0}, { "_signed_long","_long",0}, { "_wxMenuEvent","_class_wxMenuEvent",0}, + { "_wxPyBitmapDataObject","_class_wxPyBitmapDataObject",0}, + { "_wxBitmapDataObject","_class_wxBitmapDataObject",0}, { "_class_wxPyCommandEvent","_wxPyCommandEvent",0}, + { "_wxPrintQuality","_wxCoord",0}, { "_wxPrintQuality","_int",0}, { "_wxPrintQuality","_signed_int",0}, { "_wxPrintQuality","_unsigned_int",0}, @@ -4368,8 +4360,10 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxPrintQuality","_uint",0}, { "_wxPrintQuality","_EBool",0}, { "_wxPrintQuality","_size_t",0}, + { "_class_wxCustomDataObject","_wxCustomDataObject",0}, { "_wxFontData","_class_wxFontData",0}, { "_class_wxRegionIterator","_wxRegionIterator",0}, + { "_class_wxPyTextDropTarget","_wxPyTextDropTarget",0}, { "_class_wxMenuBar","_wxMenuBar",0}, { "_class_wxEvtHandler","_class_wxPreviewFrame",SwigwxPreviewFrameTowxEvtHandler}, { "_class_wxEvtHandler","_wxPreviewFrame",SwigwxPreviewFrameTowxEvtHandler}, @@ -4382,6 +4376,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxIndividualLayoutConstraint","_class_wxIndividualLayoutConstraint",0}, { "_wxCursor","_class_wxCursor",0}, { "_wxNotifyEvent","_class_wxNotifyEvent",0}, + { "_class_wxToolBarBase","_wxToolBarBase",0}, { "_wxMask","_class_wxMask",0}, { "_class_wxColourData","_wxColourData",0}, { "_class_wxPageSetupDialogData","_wxPageSetupDialogData",0}, @@ -4389,7 +4384,10 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxPen","_class_wxPen",0}, { "_wxUpdateUIEvent","_class_wxUpdateUIEvent",0}, { "_byte","_unsigned_char",0}, + { "_wxDataObject","_class_wxDataObject",0}, { "_wxStaticBox","_class_wxStaticBox",0}, + { "_wxPyDataObjectSimple","_class_wxPyDataObjectSimple",0}, + { "_wxPyDropSource","_class_wxPyDropSource",0}, { "_wxChoice","_class_wxChoice",0}, { "_wxSlider","_class_wxSlider",0}, { "_wxPyPrintout","_class_wxPyPrintout",0}, @@ -4397,16 +4395,20 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_long","_unsigned_long",0}, { "_long","_signed_long",0}, { "_wxImageList","_class_wxImageList",0}, + { "_wxDataObjectSimple","_class_wxDataObjectSimple",0}, { "_wxDropFilesEvent","_class_wxDropFilesEvent",0}, { "_wxBitmapButton","_class_wxBitmapButton",0}, { "_class_wxPrintDialogData","_wxPrintDialogData",0}, { "_class_wxAcceleratorTable","_wxAcceleratorTable",0}, + { "_class_wxClipboard","_wxClipboard",0}, { "_class_wxGauge","_wxGauge",0}, { "_wxDC","_class_wxDC",0}, + { "_class_wxBitmapDataObject","_wxBitmapDataObject",0}, { "_class_wxSingleChoiceDialog","_wxSingleChoiceDialog",0}, { "_wxProgressDialog","_class_wxProgressDialog",0}, { "_wxPrintPreview","_class_wxPrintPreview",0}, { "_wxSpinEvent","_class_wxSpinEvent",0}, + { "_size_t","_wxCoord",0}, { "_size_t","_wxPrintQuality",0}, { "_size_t","_unsigned_int",0}, { "_size_t","_int",0}, @@ -4430,6 +4432,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxPyEvent","_class_wxPyEvent",0}, { "_wxTextCtrl","_class_wxTextCtrl",0}, { "_class_wxMask","_wxMask",0}, + { "_wxTextDataObject","_class_wxTextDataObject",0}, { "_class_wxKeyEvent","_wxKeyEvent",0}, { "_wxColour","_class_wxColour",0}, { "_class_wxDialog","_class_wxPrintDialog",SwigwxPrintDialogTowxDialog}, @@ -4439,14 +4442,19 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxDialog","_wxDialog",0}, { "_wxPageSetupDialog","_class_wxPageSetupDialog",0}, { "_class_wxPrinter","_wxPrinter",0}, + { "_class_wxFileDataObject","_wxFileDataObject",0}, { "_wxIdleEvent","_class_wxIdleEvent",0}, { "_class_wxUpdateUIEvent","_wxUpdateUIEvent",0}, { "_wxToolBar","_class_wxToolBar",0}, + { "_class_wxDataObject","_wxDataObject",0}, { "_wxStaticLine","_class_wxStaticLine",0}, { "_wxBrush","_class_wxBrush",0}, { "_wxMiniFrame","_class_wxMiniFrame",0}, { "_class_wxPyPrintout","_wxPyPrintout",0}, + { "_wxDataFormat","_class_wxDataFormat",0}, + { "_class_wxDataObjectSimple","_wxDataObjectSimple",0}, { "_wxShowEvent","_class_wxShowEvent",0}, + { "_uint","_wxCoord",0}, { "_uint","_wxPrintQuality",0}, { "_uint","_size_t",0}, { "_uint","_unsigned_int",0}, @@ -4468,7 +4476,6 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxWindowDC","_class_wxWindowDC",0}, { "_wxScrollBar","_class_wxScrollBar",0}, { "_wxSpinButton","_class_wxSpinButton",0}, - { "_wxToolBarTool","_class_wxToolBarTool",0}, { "_wxColourDialog","_class_wxColourDialog",0}, { "_wxPrintData","_class_wxPrintData",0}, { "_class_wxIndividualLayoutConstraint","_wxIndividualLayoutConstraint",0}, @@ -4479,19 +4486,25 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxTextEntryDialog","_class_wxTextEntryDialog",0}, { "_class_wxIconizeEvent","_wxIconizeEvent",0}, { "_class_wxStaticBitmap","_wxStaticBitmap",0}, + { "_wxToolBarSimple","_class_wxToolBarSimple",0}, { "_class_wxToolBar","_wxToolBar",0}, + { "_wxDropTarget","_class_wxDropTarget",0}, { "_class_wxStaticLine","_wxStaticLine",0}, { "_wxScrollEvent","_class_wxScrollEvent",0}, + { "_wxToolBarToolBase","_class_wxToolBarToolBase",0}, + { "_EBool","_wxCoord",0}, { "_EBool","_wxPrintQuality",0}, { "_EBool","_signed_int",0}, { "_EBool","_int",0}, { "_EBool","_wxWindowID",0}, { "_class_wxRegion","_wxRegion",0}, + { "_class_wxDataFormat","_wxDataFormat",0}, { "_class_wxDropFilesEvent","_wxDropFilesEvent",0}, { "_wxWindowDestroyEvent","_class_wxWindowDestroyEvent",0}, { "_class_wxPreviewFrame","_wxPreviewFrame",0}, { "_wxStaticText","_class_wxStaticText",0}, { "_wxFont","_class_wxFont",0}, + { "_class_wxPyDropTarget","_wxPyDropTarget",0}, { "_wxCloseEvent","_class_wxCloseEvent",0}, { "_unsigned_long","_wxDash",0}, { "_unsigned_long","_long",0}, @@ -4516,6 +4529,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxComboBox","_class_wxComboBox",0}, { "_wxRadioButton","_class_wxRadioButton",0}, { "_class_wxMessageDialog","_wxMessageDialog",0}, + { "_signed_int","_wxCoord",0}, { "_signed_int","_wxPrintQuality",0}, { "_signed_int","_EBool",0}, { "_signed_int","_wxWindowID",0}, @@ -4523,14 +4537,17 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxTextCtrl","_wxTextCtrl",0}, { "_wxLayoutConstraints","_class_wxLayoutConstraints",0}, { "_wxMetaFileDC","_class_wxMetaFileDC",0}, + { "_class_wxTextDataObject","_wxTextDataObject",0}, { "_wxMenu","_class_wxMenu",0}, { "_class_wxMoveEvent","_wxMoveEvent",0}, { "_wxListBox","_class_wxListBox",0}, { "_wxScreenDC","_class_wxScreenDC",0}, + { "_class_wxToolBarSimple","_wxToolBarSimple",0}, { "_WXTYPE","_short",0}, { "_WXTYPE","_signed_short",0}, { "_WXTYPE","_unsigned_short",0}, { "_wxFileDialog","_class_wxFileDialog",0}, + { "_class_wxDropTarget","_wxDropTarget",0}, { "_class_wxBrush","_wxBrush",0}, { "_unsigned_short","_WXTYPE",0}, { "_unsigned_short","_short",0}, @@ -4544,10 +4561,13 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxStaticText","_wxStaticText",0}, { "_wxPrintDialogData","_class_wxPrintDialogData",0}, { "_class_wxFont","_wxFont",0}, + { "_wxClipboard","_class_wxClipboard",0}, { "_class_wxPyValidator","_wxPyValidator",0}, { "_class_wxCloseEvent","_wxCloseEvent",0}, + { "_wxBusyInfo","_class_wxBusyInfo",0}, { "_class_wxMenuEvent","_wxMenuEvent",0}, { "_wxPaletteChangedEvent","_class_wxPaletteChangedEvent",0}, + { "_class_wxPyBitmapDataObject","_wxPyBitmapDataObject",0}, { "_wxClientDC","_class_wxClientDC",0}, { "_wxMouseEvent","_class_wxMouseEvent",0}, { "_wxSingleChoiceDialog","_class_wxSingleChoiceDialog",0}, @@ -4557,21 +4577,23 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_signed_short","_WXTYPE",0}, { "_signed_short","_short",0}, { "_wxMemoryDC","_class_wxMemoryDC",0}, + { "_wxPyTextDataObject","_class_wxPyTextDataObject",0}, { "_class_wxPrintDialog","_wxPrintDialog",0}, { "_wxPaintDC","_class_wxPaintDC",0}, { "_class_wxWindowDC","_wxWindowDC",0}, { "_class_wxFocusEvent","_wxFocusEvent",0}, { "_class_wxMaximizeEvent","_wxMaximizeEvent",0}, { "_wxStatusBar","_class_wxStatusBar",0}, - { "_class_wxToolBarTool","_wxToolBarTool",0}, { "_class_wxAcceleratorEntry","_wxAcceleratorEntry",0}, { "_class_wxCursor","_wxCursor",0}, + { "_wxPyFileDropTarget","_class_wxPyFileDropTarget",0}, { "_wxScrolledWindow","_class_wxScrolledWindow",0}, { "_unsigned_char","_byte",0}, { "_class_wxMetaFileDC","_wxMetaFileDC",0}, { "_class_wxMenu","_wxMenu",0}, { "_wxControl","_class_wxControl",0}, { "_class_wxListBox","_wxListBox",0}, + { "_unsigned_int","_wxCoord",0}, { "_unsigned_int","_wxPrintQuality",0}, { "_unsigned_int","_size_t",0}, { "_unsigned_int","_uint",0}, @@ -4589,6 +4611,8 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_short","_unsigned_short",0}, { "_short","_signed_short",0}, { "_class_wxStaticBox","_wxStaticBox",0}, + { "_class_wxPyDataObjectSimple","_wxPyDataObjectSimple",0}, + { "_class_wxPyDropSource","_wxPyDropSource",0}, { "_class_wxScrollEvent","_wxScrollEvent",0}, { "_wxJoystickEvent","_class_wxJoystickEvent",0}, { "_class_wxChoice","_wxChoice",0}, @@ -4599,6 +4623,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxFrame","_wxPreviewFrame",SwigwxPreviewFrameTowxFrame}, { "_wxFrame","_class_wxFrame",0}, { "_class_wxPaletteChangedEvent","_wxPaletteChangedEvent",0}, + { "_wxWindowID","_wxCoord",0}, { "_wxWindowID","_wxPrintQuality",0}, { "_wxWindowID","_size_t",0}, { "_wxWindowID","_EBool",0}, @@ -4607,6 +4632,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxWindowID","_signed_int",0}, { "_wxWindowID","_unsigned_int",0}, { "_class_wxScrollWinEvent","_wxScrollWinEvent",0}, + { "_int","_wxCoord",0}, { "_int","_wxPrintQuality",0}, { "_int","_size_t",0}, { "_int","_EBool",0}, @@ -4624,12 +4650,15 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxSize","_class_wxSize",0}, { "_wxRegionIterator","_class_wxRegionIterator",0}, { "_class_wxPrinterDC","_wxPrinterDC",0}, + { "_class_wxPyTextDataObject","_wxPyTextDataObject",0}, { "_class_wxPaintDC","_wxPaintDC",0}, { "_class_wxSysColourChangedEvent","_wxSysColourChangedEvent",0}, + { "_class_wxPyFileDropTarget","_wxPyFileDropTarget",0}, { "_class_wxInitDialogEvent","_wxInitDialogEvent",0}, { "_class_wxComboBox","_wxComboBox",0}, { "_class_wxRadioButton","_wxRadioButton",0}, { "_wxValidator","_class_wxValidator",0}, + { "_wxToolBarBase","_class_wxToolBarBase",0}, { "_class_wxLayoutConstraints","_wxLayoutConstraints",0}, { "_wxIconizeEvent","_class_wxIconizeEvent",0}, { "_class_wxControl","_wxControl",0}, @@ -4640,22 +4669,35 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxPageSetupDialog","_wxPageSetupDialog",0}, { "_wxPalette","_class_wxPalette",0}, { "_class_wxIdleEvent","_wxIdleEvent",0}, + { "_wxCoord","_int",0}, + { "_wxCoord","_signed_int",0}, + { "_wxCoord","_unsigned_int",0}, + { "_wxCoord","_wxWindowID",0}, + { "_wxCoord","_uint",0}, + { "_wxCoord","_EBool",0}, + { "_wxCoord","_size_t",0}, + { "_wxCoord","_wxPrintQuality",0}, { "_wxEraseEvent","_class_wxEraseEvent",0}, + { "_wxDataObjectComposite","_class_wxDataObjectComposite",0}, { "_class_wxJoystickEvent","_wxJoystickEvent",0}, { "_class_wxMiniFrame","_wxMiniFrame",0}, { "_wxFontDialog","_class_wxFontDialog",0}, { "_wxRegion","_class_wxRegion",0}, { "_wxPreviewFrame","_class_wxPreviewFrame",0}, { "_class_wxShowEvent","_wxShowEvent",0}, + { "_wxPyDropTarget","_class_wxPyDropTarget",0}, { "_wxActivateEvent","_class_wxActivateEvent",0}, { "_wxGauge","_class_wxGauge",0}, { "_class_wxCheckListBox","_wxCheckListBox",0}, + { "_class_wxBusyInfo","_wxBusyInfo",0}, { "_class_wxCommandEvent","_wxCommandEvent",0}, { "_class_wxClientDC","_wxClientDC",0}, { "_class_wxSizeEvent","_wxSizeEvent",0}, + { "_wxCustomDataObject","_class_wxCustomDataObject",0}, { "_class_wxSize","_wxSize",0}, { "_class_wxBitmap","_wxBitmap",0}, { "_class_wxMemoryDC","_wxMemoryDC",0}, + { "_wxPyTextDropTarget","_class_wxPyTextDropTarget",0}, { "_wxMenuBar","_class_wxMenuBar",0}, { "_wxDirDialog","_class_wxDirDialog",0}, { "_wxEvtHandler","_class_wxPreviewFrame",SwigwxPreviewFrameTowxEvtHandler}, @@ -4678,7 +4720,10 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxColourData","_class_wxColourData",0}, { "_wxPageSetupDialogData","_class_wxPageSetupDialogData",0}, { "_class_wxPalette","_wxPalette",0}, + { "_wxFileDataObject","_class_wxFileDataObject",0}, { "_class_wxEraseEvent","_wxEraseEvent",0}, + { "_class_wxDataObjectComposite","_wxDataObjectComposite",0}, + { "_class_wxToolBarToolBase","_wxToolBarToolBase",0}, { "_class_wxFontDialog","_wxFontDialog",0}, { "_wxWindow","_class_wxPreviewFrame",SwigwxPreviewFrameTowxWindow}, { "_wxWindow","_wxPreviewFrame",SwigwxPreviewFrameTowxWindow},