X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0d6f9504aef08d44d8b20df4419f4db9150ef073..d9f39e09e82e99c422619f4e3df536d0a9e87987:/utils/wxPython/src/helpers.h diff --git a/utils/wxPython/src/helpers.h b/utils/wxPython/src/helpers.h index 3114aa5622..9e0945d42f 100644 --- a/utils/wxPython/src/helpers.h +++ b/utils/wxPython/src/helpers.h @@ -16,11 +16,29 @@ #include +//---------------------------------------------------------------------- + +// if we want to handle threads and Python threads are available... +#if defined(WXP_USE_THREAD) && defined(WITH_THREAD) + +#define WXP_WITH_THREAD +#define wxPy_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS +#define wxPy_END_ALLOW_THREADS Py_END_ALLOW_THREADS + +#else // no Python threads... +#undef WXP_WITH_THREAD +#define wxPy_BEGIN_ALLOW_THREADS +#define wxPy_END_ALLOW_THREADS +#endif + + //---------------------------------------------------------------------- class wxPyApp: public wxApp { public: + wxPyApp(); + ~wxPyApp(); int MainLoop(void); bool OnInit(void); void AfterMainLoop(void); @@ -54,19 +72,20 @@ extern "C" char *SWIG_GetPtr(char *, void **, char *); # pragma warning(disable:4800) #endif +typedef unsigned char byte; + // Non-const versions to keep SWIG happy. extern wxPoint wxPyDefaultPosition; extern wxSize wxPyDefaultSize; -extern char* wxPyPanelNameStr; extern wxString wxPyEmptyStr; //---------------------------------------------------------------------- class wxPyCallback : public wxObject { public: - wxPyCallback(PyObject* func) { m_func = func; Py_INCREF(m_func); } - ~wxPyCallback() { Py_DECREF(m_func); } + wxPyCallback(PyObject* func); + ~wxPyCallback(); void EventThunker(wxEvent& event); @@ -99,10 +118,46 @@ private: PyObject* func; }; +//--------------------------------------------------------------------------- + +class wxPyEvent : public wxCommandEvent { + DECLARE_DYNAMIC_CLASS(wxPyEvent) +public: + wxPyEvent(wxEventType commandType = wxEVT_NULL, PyObject* userData = Py_None); + ~wxPyEvent(); + + void SetUserData(PyObject* userData); + PyObject* GetUserData(); + +private: + PyObject* m_userData; +}; + //--------------------------------------------------------------------------- ///////////////////////////////////////////////////////////////////////////// // // $Log$ +// Revision 1.7 1999/04/30 03:29:18 RD +// wxPython 2.0b9, first phase (win32) +// Added gobs of stuff, see wxPython/README.txt for details +// +// Revision 1.6.4.1 1999/03/27 23:29:14 RD +// +// wxPython 2.0b8 +// Python thread support +// various minor additions +// various minor fixes +// +// Revision 1.6 1998/11/25 08:45:26 RD +// +// Added wxPalette, wxRegion, wxRegionIterator, wxTaskbarIcon +// Added events for wxGrid +// Other various fixes and additions +// +// Revision 1.5 1998/10/02 06:40:40 RD +// +// Version 0.4 of wxPython for MSW. +// // Revision 1.4 1998/08/27 21:59:09 RD // Some chicken-and-egg problems solved for wxPython on wxGTK //