]> git.saurik.com Git - wxWidgets.git/blame - utils/wxPython/src/helpers.h
jconfig.h uses configures results
[wxWidgets.git] / utils / wxPython / src / helpers.h
CommitLineData
7bf85405
RD
1/////////////////////////////////////////////////////////////////////////////
2// Name: helpers.h
3// Purpose: Helper functions/classes for the wxPython extenaion module
4//
5// Author: Robin Dunn
6//
7// Created: 7/1/97
8// RCS-ID: $Id$
9// Copyright: (c) 1998 by Total Control Software
10// Licence: wxWindows license
11/////////////////////////////////////////////////////////////////////////////
12
13#ifndef __wxp_helpers__
14#define __wxp_helpers__
15
16#include <wx/wx.h>
17
18
cf694132
RD
19//----------------------------------------------------------------------
20
21// if we want to handle threads and Python threads are available...
22#if defined(WXP_USE_THREAD) && defined(WITH_THREAD)
23
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
27
28#else // no Python threads...
29#undef WXP_WITH_THREAD
30#define wxPy_BEGIN_ALLOW_THREADS
31#define wxPy_END_ALLOW_THREADS
32#endif
33
34
7bf85405
RD
35//----------------------------------------------------------------------
36
37class wxPyApp: public wxApp
38{
39public:
cf694132
RD
40 wxPyApp();
41 ~wxPyApp();
7bf85405
RD
42 int MainLoop(void);
43 bool OnInit(void);
44 void AfterMainLoop(void);
45};
46
47extern wxPyApp *wxPythonApp;
48
49//----------------------------------------------------------------------
50
0d6f9504 51void __wxPreStart();
7bf85405
RD
52PyObject* __wxStart(PyObject*, PyObject* args);
53
54extern PyObject* wxPython_dict;
55PyObject* __wxSetDictionary(PyObject*, PyObject* args);
56
57extern wxHashTable* wxPyWindows; // keep track of all windows so we
58 // don't accidentally delete them twice.
59
60void wxPyEventThunker(wxObject*, wxEvent& event);
61
62//----------------------------------------------------------------------
63
64
65#ifndef SWIGCODE
66extern "C" void SWIG_MakePtr(char *, void *, char *);
67extern "C" char *SWIG_GetPtr(char *, void **, char *);
68#endif
69
70
71#ifdef _MSC_VER
72# pragma warning(disable:4800)
73#endif
74
b639c3c5
RD
75typedef unsigned char byte;
76
7bf85405
RD
77
78// Non-const versions to keep SWIG happy.
79extern wxPoint wxPyDefaultPosition;
80extern wxSize wxPyDefaultSize;
7bf85405
RD
81extern wxString wxPyEmptyStr;
82
83//----------------------------------------------------------------------
84
85class wxPyCallback : public wxObject {
86public:
cf694132
RD
87 wxPyCallback(PyObject* func);
88 ~wxPyCallback();
7bf85405
RD
89
90 void EventThunker(wxEvent& event);
91
92 PyObject* m_func;
93};
94
95//---------------------------------------------------------------------------
96
97class wxPyMenu : public wxMenu {
98public:
99 wxPyMenu(const wxString& title = "", PyObject* func=NULL);
100 ~wxPyMenu();
101
102private:
103 static void MenuCallback(wxMenu& menu, wxCommandEvent& evt);
104 PyObject* func;
105};
714e6a9e 106
7bf85405
RD
107
108//---------------------------------------------------------------------------
109
110class wxPyTimer : public wxTimer {
111public:
112 wxPyTimer(PyObject* callback);
113 ~wxPyTimer();
114
115 void Notify();
116
117private:
118 PyObject* func;
119};
120
cf694132
RD
121//---------------------------------------------------------------------------
122
123class wxPyEvent : public wxCommandEvent {
124 DECLARE_DYNAMIC_CLASS(wxPyEvent)
125public:
126 wxPyEvent(wxEventType commandType = wxEVT_NULL, PyObject* userData = Py_None);
127 ~wxPyEvent();
128
129 void SetUserData(PyObject* userData);
130 PyObject* GetUserData();
131
132private:
133 PyObject* m_userData;
134};
135
7bf85405
RD
136//---------------------------------------------------------------------------
137/////////////////////////////////////////////////////////////////////////////
138//
139// $Log$
cf694132
RD
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
143//
144// Revision 1.6.4.1 1999/03/27 23:29:14 RD
145//
146// wxPython 2.0b8
147// Python thread support
148// various minor additions
149// various minor fixes
150//
b639c3c5 151// Revision 1.6 1998/11/25 08:45:26 RD
cf694132 152//
b639c3c5
RD
153// Added wxPalette, wxRegion, wxRegionIterator, wxTaskbarIcon
154// Added events for wxGrid
155// Other various fixes and additions
156//
9c039d08 157// Revision 1.5 1998/10/02 06:40:40 RD
b639c3c5 158//
9c039d08
RD
159// Version 0.4 of wxPython for MSW.
160//
0d6f9504
RD
161// Revision 1.4 1998/08/27 21:59:09 RD
162// Some chicken-and-egg problems solved for wxPython on wxGTK
163//
714e6a9e
RD
164// Revision 1.3 1998/08/16 04:31:09 RD
165// More wxGTK work.
166//
853b255a
RD
167// Revision 1.2 1998/08/14 23:36:37 RD
168// Beginings of wxGTK compatibility
169//
7bf85405
RD
170// Revision 1.1 1998/08/09 08:25:51 RD
171// Initial version
172//
173//
174
175#endif
176