Merged wxPython 2.2.2 over to the main branch

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8658 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2000-10-30 21:08:42 +00:00
parent 7874bf5430
commit c368d904fc
193 changed files with 21992 additions and 4366 deletions

View File

@@ -67,7 +67,9 @@ PyObject* __wxSetDictionary(PyObject*, PyObject* args);
void wxPyEventThunker(wxObject*, wxEvent& event);
HELPEREXPORT PyObject* wxPyConstructObject(void* ptr, const char* className);
HELPEREXPORT PyObject* wxPyConstructObject(void* ptr,
const char* className,
int setThisOwn=0);
HELPEREXPORT bool wxPyRestoreThread();
HELPEREXPORT void wxPySaveThread(bool doSave);
HELPEREXPORT PyObject* wxPy_ConvertList(wxListBase* list, const char* className);
@@ -86,6 +88,44 @@ public:
PyObject* m_obj;
};
//----------------------------------------------------------------------
// Handle wxInputStreams by Joerg Baumann
// See stream.i for implementations
// list class for return list of strings, e.g. readlines()
WX_DECLARE_LIST(wxString, wxStringPtrList);
// C++ class wxPyInputStream to act as base for python class wxInputStream
// Use it in python like a python file object
class wxPyInputStream{
public:
// underlying wxInputStream
wxInputStream* wxi;
public:
wxPyInputStream(wxInputStream* wxi_) : wxi(wxi_) {}
~wxPyInputStream();
// python file object interface for input files (most of it)
void close();
void flush();
bool eof();
wxString* read(int size=-1);
wxString* readline(int size=-1);
wxStringPtrList* readlines(int sizehint=-1);
void seek(int offset, int whence=0);
int tell();
/*
bool isatty();
int fileno();
void truncate(int size=-1);
void write(wxString data);
void writelines(wxStringPtrList);
*/
};
//----------------------------------------------------------------------
// These are helpers used by the typemaps
@@ -239,7 +279,7 @@ public:
void _setSelf(PyObject* self, PyObject* _class, int incref=1) { \
m_myInst.setSelf(self, _class, incref); \
} \
private: wxPyCallbackHelper m_myInst;
private: wxPyCallbackHelper m_myInst
//---------------------------------------------------------------------------
@@ -285,6 +325,26 @@ public:
//---------------------------------------------------------------------------
#define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
void CBNAME(int a, int b); \
void base_##CBNAME(int a, int b);
#define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
void CLASS::CBNAME(int a, int b) { \
bool doSave = wxPyRestoreThread(); \
if (m_myInst.findCallback(#CBNAME)) \
m_myInst.callCallback(Py_BuildValue("(ii)",a,b)); \
else \
PCLASS::CBNAME(a,b); \
wxPySaveThread(doSave); \
} \
void CLASS::base_##CBNAME(int a, int b) { \
PCLASS::CBNAME(a,b); \
}
//---------------------------------------------------------------------------
#define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
bool CBNAME(int a); \
bool base_##CBNAME(int a);
@@ -672,6 +732,63 @@ public:
//---------------------------------------------------------------------------
#define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
bool CBNAME(const wxString& a);
\
#define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
bool CLASS::CBNAME(const wxString& a) { \
bool rval; \
bool doSave = wxPyRestoreThread(); \
if (m_myInst.findCallback(#CBNAME)) \
rval = m_myInst.callCallback(Py_BuildValue("(s)", a.c_str())); \
wxPySaveThread(doSave); \
return rval; \
} \
//---------------------------------------------------------------------------
#define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
wxString CBNAME(const wxString& a); \
#define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
wxString CLASS::CBNAME(const wxString& a) { \
wxString rval; \
bool doSave = wxPyRestoreThread(); \
if (m_myInst.findCallback(#CBNAME)) { \
PyObject* ro; \
ro = m_myInst.callCallbackObj(Py_BuildValue("(s)", a.c_str())); \
if (ro) { \
rval = PyString_AsString(PyObject_Str(ro)); \
Py_DECREF(ro); \
} \
} \
wxPySaveThread(doSave); \
return rval; \
} \
//---------------------------------------------------------------------------
#define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
wxString CBNAME(const wxString& a,int b); \
#define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
wxString CLASS::CBNAME(const wxString& a,int b) { \
wxString rval; \
bool doSave = wxPyRestoreThread(); \
if (m_myInst.findCallback(#CBNAME)) { \
PyObject* ro; \
ro = m_myInst.callCallbackObj(Py_BuildValue("(si)", a.c_str(),b)); \
if (ro) { \
rval = PyString_AsString(PyObject_Str(ro)); \
Py_DECREF(ro); \
} \
} \
wxPySaveThread(doSave); \
return rval; \
} \
//---------------------------------------------------------------------------
#define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \
bool CBNAME(const wxString& a, const wxString& b); \
bool base_##CBNAME(const wxString& a, const wxString& b);
@@ -867,6 +984,28 @@ public:
//---------------------------------------------------------------------------
#define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location); \
#define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
bool doSave = wxPyRestoreThread(); \
wxFSFile* rval=0; \
if (m_myInst.findCallback(#CBNAME)) { \
PyObject* ro; \
ro=m_myInst.callCallbackObj(Py_BuildValue("(Os)", \
wxPyConstructObject(&a, "(wxFileSystemC"),b.c_str())); \
if (ro) { \
SWIG_GetPtrObj(ro, (void **)&rval, "_wxFSFILE_p"); \
Py_DECREF(ro); \
} \
} \
wxPySaveThread(doSave); \
return rval; \
};
//---------------------------------------------------------------------------
#define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
bool CBNAME(wxDragResult a); \
bool base_##CBNAME(wxDragResult a);