]> git.saurik.com Git - wxWidgets.git/blob - utils/wxPython/src/helpers.h
wxPython 0.5.2
[wxWidgets.git] / utils / wxPython / src / helpers.h
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
19 //----------------------------------------------------------------------
20
21 class wxPyApp: public wxApp
22 {
23 public:
24 int MainLoop(void);
25 bool OnInit(void);
26 void AfterMainLoop(void);
27 };
28
29 extern wxPyApp *wxPythonApp;
30
31 //----------------------------------------------------------------------
32
33 void __wxPreStart();
34 PyObject* __wxStart(PyObject*, PyObject* args);
35
36 extern PyObject* wxPython_dict;
37 PyObject* __wxSetDictionary(PyObject*, PyObject* args);
38
39 extern wxHashTable* wxPyWindows; // keep track of all windows so we
40 // don't accidentally delete them twice.
41
42 void wxPyEventThunker(wxObject*, wxEvent& event);
43
44 //----------------------------------------------------------------------
45
46
47 #ifndef SWIGCODE
48 extern "C" void SWIG_MakePtr(char *, void *, char *);
49 extern "C" char *SWIG_GetPtr(char *, void **, char *);
50 #endif
51
52
53 #ifdef _MSC_VER
54 # pragma warning(disable:4800)
55 #endif
56
57 typedef unsigned char byte;
58
59
60 // Non-const versions to keep SWIG happy.
61 extern wxPoint wxPyDefaultPosition;
62 extern wxSize wxPyDefaultSize;
63 extern wxString wxPyEmptyStr;
64
65 //----------------------------------------------------------------------
66
67 class wxPyCallback : public wxObject {
68 public:
69 wxPyCallback(PyObject* func) { m_func = func; Py_INCREF(m_func); }
70 ~wxPyCallback() { Py_DECREF(m_func); }
71
72 void EventThunker(wxEvent& event);
73
74 PyObject* m_func;
75 };
76
77 //---------------------------------------------------------------------------
78
79 class wxPyMenu : public wxMenu {
80 public:
81 wxPyMenu(const wxString& title = "", PyObject* func=NULL);
82 ~wxPyMenu();
83
84 private:
85 static void MenuCallback(wxMenu& menu, wxCommandEvent& evt);
86 PyObject* func;
87 };
88
89
90 //---------------------------------------------------------------------------
91
92 class wxPyTimer : public wxTimer {
93 public:
94 wxPyTimer(PyObject* callback);
95 ~wxPyTimer();
96
97 void Notify();
98
99 private:
100 PyObject* func;
101 };
102
103 //---------------------------------------------------------------------------
104 /////////////////////////////////////////////////////////////////////////////
105 //
106 // $Log$
107 // Revision 1.6 1998/11/25 08:45:26 RD
108 // Added wxPalette, wxRegion, wxRegionIterator, wxTaskbarIcon
109 // Added events for wxGrid
110 // Other various fixes and additions
111 //
112 // Revision 1.5 1998/10/02 06:40:40 RD
113 //
114 // Version 0.4 of wxPython for MSW.
115 //
116 // Revision 1.4 1998/08/27 21:59:09 RD
117 // Some chicken-and-egg problems solved for wxPython on wxGTK
118 //
119 // Revision 1.3 1998/08/16 04:31:09 RD
120 // More wxGTK work.
121 //
122 // Revision 1.2 1998/08/14 23:36:37 RD
123 // Beginings of wxGTK compatibility
124 //
125 // Revision 1.1 1998/08/09 08:25:51 RD
126 // Initial version
127 //
128 //
129
130 #endif
131