1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Helper functions/classes for the wxPython extenaion module
9 // Copyright: (c) 1998 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
13 #ifndef __wxp_helpers__
14 #define __wxp_helpers__
19 //----------------------------------------------------------------------
21 // if we want to handle threads and Python threads are available...
22 #if defined(WXP_USE_THREAD) && defined(WITH_THREAD)
24 #define WXP_WITH_THREAD
25 #define wxPy_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
26 #define wxPy_END_ALLOW_THREADS Py_END_ALLOW_THREADS
28 #else // no Python threads...
29 #undef WXP_WITH_THREAD
30 #define wxPy_BEGIN_ALLOW_THREADS
31 #define wxPy_END_ALLOW_THREADS
35 //----------------------------------------------------------------------
37 class wxPyApp
: public wxApp
44 void AfterMainLoop(void);
47 extern wxPyApp
*wxPythonApp
;
49 //----------------------------------------------------------------------
52 PyObject
* __wxStart(PyObject
*, PyObject
* args
);
54 extern PyObject
* wxPython_dict
;
55 PyObject
* __wxSetDictionary(PyObject
*, PyObject
* args
);
57 extern wxHashTable
* wxPyWindows
; // keep track of all windows so we
58 // don't accidentally delete them twice.
60 void wxPyEventThunker(wxObject
*, wxEvent
& event
);
62 //----------------------------------------------------------------------
66 extern "C" void SWIG_MakePtr(char *, void *, char *);
67 extern "C" char *SWIG_GetPtr(char *, void **, char *);
72 # pragma warning(disable:4800)
75 typedef unsigned char byte
;
78 // Non-const versions to keep SWIG happy.
79 extern wxPoint wxPyDefaultPosition
;
80 extern wxSize wxPyDefaultSize
;
81 extern wxString wxPyEmptyStr
;
83 //----------------------------------------------------------------------
85 class wxPyCallback
: public wxObject
{
87 wxPyCallback(PyObject
* func
);
90 void EventThunker(wxEvent
& event
);
95 //---------------------------------------------------------------------------
97 class wxPyMenu
: public wxMenu
{
99 wxPyMenu(const wxString
& title
= "", PyObject
* func
=NULL
);
103 static void MenuCallback(wxMenu
& menu
, wxCommandEvent
& evt
);
108 //---------------------------------------------------------------------------
110 class wxPyTimer
: public wxTimer
{
112 wxPyTimer(PyObject
* callback
);
121 //---------------------------------------------------------------------------
123 class wxPyEvent
: public wxCommandEvent
{
124 DECLARE_DYNAMIC_CLASS(wxPyEvent
)
126 wxPyEvent(wxEventType commandType
= wxEVT_NULL
, PyObject
* userData
= Py_None
);
129 void SetUserData(PyObject
* userData
);
130 PyObject
* GetUserData();
133 PyObject
* m_userData
;
136 //---------------------------------------------------------------------------
137 /////////////////////////////////////////////////////////////////////////////
140 // Revision 1.7 1999/04/30 03:29:18 RD
141 // wxPython 2.0b9, first phase (win32)
142 // Added gobs of stuff, see wxPython/README.txt for details
144 // Revision 1.6.4.1 1999/03/27 23:29:14 RD
147 // Python thread support
148 // various minor additions
149 // various minor fixes
151 // Revision 1.6 1998/11/25 08:45:26 RD
153 // Added wxPalette, wxRegion, wxRegionIterator, wxTaskbarIcon
154 // Added events for wxGrid
155 // Other various fixes and additions
157 // Revision 1.5 1998/10/02 06:40:40 RD
159 // Version 0.4 of wxPython for MSW.
161 // Revision 1.4 1998/08/27 21:59:09 RD
162 // Some chicken-and-egg problems solved for wxPython on wxGTK
164 // Revision 1.3 1998/08/16 04:31:09 RD
167 // Revision 1.2 1998/08/14 23:36:37 RD
168 // Beginings of wxGTK compatibility
170 // Revision 1.1 1998/08/09 08:25:51 RD