]>
Commit | Line | Data |
---|---|---|
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 | ||
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 | ||
0d6f9504 | 33 | void __wxPreStart(); |
7bf85405 RD |
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 | ||
58 | // Non-const versions to keep SWIG happy. | |
59 | extern wxPoint wxPyDefaultPosition; | |
60 | extern wxSize wxPyDefaultSize; | |
61 | extern char* wxPyPanelNameStr; | |
62 | extern wxString wxPyEmptyStr; | |
63 | ||
64 | //---------------------------------------------------------------------- | |
65 | ||
66 | class wxPyCallback : public wxObject { | |
67 | public: | |
68 | wxPyCallback(PyObject* func) { m_func = func; Py_INCREF(m_func); } | |
69 | ~wxPyCallback() { Py_DECREF(m_func); } | |
70 | ||
71 | void EventThunker(wxEvent& event); | |
72 | ||
73 | PyObject* m_func; | |
74 | }; | |
75 | ||
76 | //--------------------------------------------------------------------------- | |
77 | ||
78 | class wxPyMenu : public wxMenu { | |
79 | public: | |
80 | wxPyMenu(const wxString& title = "", PyObject* func=NULL); | |
81 | ~wxPyMenu(); | |
82 | ||
83 | private: | |
84 | static void MenuCallback(wxMenu& menu, wxCommandEvent& evt); | |
85 | PyObject* func; | |
86 | }; | |
714e6a9e | 87 | |
7bf85405 RD |
88 | |
89 | //--------------------------------------------------------------------------- | |
90 | ||
91 | class wxPyTimer : public wxTimer { | |
92 | public: | |
93 | wxPyTimer(PyObject* callback); | |
94 | ~wxPyTimer(); | |
95 | ||
96 | void Notify(); | |
97 | ||
98 | private: | |
99 | PyObject* func; | |
100 | }; | |
101 | ||
102 | //--------------------------------------------------------------------------- | |
103 | ///////////////////////////////////////////////////////////////////////////// | |
104 | // | |
105 | // $Log$ | |
0d6f9504 RD |
106 | // Revision 1.4 1998/08/27 21:59:09 RD |
107 | // Some chicken-and-egg problems solved for wxPython on wxGTK | |
108 | // | |
714e6a9e RD |
109 | // Revision 1.3 1998/08/16 04:31:09 RD |
110 | // More wxGTK work. | |
111 | // | |
853b255a RD |
112 | // Revision 1.2 1998/08/14 23:36:37 RD |
113 | // Beginings of wxGTK compatibility | |
114 | // | |
7bf85405 RD |
115 | // Revision 1.1 1998/08/09 08:25:51 RD |
116 | // Initial version | |
117 | // | |
118 | // | |
119 | ||
120 | #endif | |
121 |