X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e5bc90ee89e037bdfa8ad69a20d0802cf13f233b..62705a278a57b8d3dd67222f20b161584a86982d:/wxPython/src/_printfw.i diff --git a/wxPython/src/_printfw.i b/wxPython/src/_printfw.i index 64ff548e78..1faf7eebc0 100644 --- a/wxPython/src/_printfw.i +++ b/wxPython/src/_printfw.i @@ -100,6 +100,33 @@ public: %pythoncode { def __nonzero__(self): return self.Ok() } + //char* GetPrivData() const; + //int GetPrivDataLen() const; + //void SetPrivData( char *privData, int len ); + + %extend { + PyObject* GetPrivData() { + PyObject* data; + wxPyBlock_t blocked = wxPyBeginBlockThreads(); + data = PyString_FromStringAndSize(self->GetPrivData(), + self->GetPrivDataLen()); + wxPyEndBlockThreads(blocked); + return data; + } + + void SetPrivData(PyObject* data) { + if (! PyString_Check(data)) { + wxPyBLOCK_THREADS(PyErr_SetString(PyExc_TypeError, + "Expected string object")); + return /* NULL */ ; + } + + wxPyBlock_t blocked = wxPyBeginBlockThreads(); + self->SetPrivData(PyString_AS_STRING(data), PyString_GET_SIZE(data)); + wxPyEndBlockThreads(blocked); + } + } + // NOTE: These are now inside of #if WXWIN_COMPATIBILITY_2_4, so be // prepared to remove them... @@ -326,7 +353,7 @@ void wxPyPrintout::GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *p bool hadErr = false; bool found; - bool blocked = wxPyBeginBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); if ((found = wxPyCBH_findCallback(m_myInst, "GetPageInfo"))) { PyObject* result = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); if (result && PyTuple_Check(result) && PyTuple_Size(result) == 4) { @@ -594,7 +621,7 @@ public: bool CLASS::CBNAME(wxPreviewCanvas* a, wxDC& b) { \ bool rval=false; \ bool found; \ - bool blocked = wxPyBeginBlockThreads(); \ + wxPyBlock_t blocked = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* win = wxPyMake_wxObject(a,false); \ PyObject* dc = wxPyMake_wxObject(&b,false); \