]> git.saurik.com Git - wxWidgets.git/blob - utils/wxPython/src/helpers.h
Beginings of wxGTK compatibility
[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 PyObject* __wxStart(PyObject*, PyObject* args);
34
35 extern PyObject* wxPython_dict;
36 PyObject* __wxSetDictionary(PyObject*, PyObject* args);
37
38 extern wxHashTable* wxPyWindows; // keep track of all windows so we
39 // don't accidentally delete them twice.
40
41 void wxPyEventThunker(wxObject*, wxEvent& event);
42
43 //----------------------------------------------------------------------
44
45
46 #ifndef SWIGCODE
47 extern "C" void SWIG_MakePtr(char *, void *, char *);
48 extern "C" char *SWIG_GetPtr(char *, void **, char *);
49 #endif
50
51
52 #ifdef _MSC_VER
53 # pragma warning(disable:4800)
54 #endif
55
56
57 // Non-const versions to keep SWIG happy.
58 extern wxPoint wxPyDefaultPosition;
59 extern wxSize wxPyDefaultSize;
60 extern char* wxPyPanelNameStr;
61 extern wxString wxPyEmptyStr;
62
63 //----------------------------------------------------------------------
64
65 class wxPyCallback : public wxObject {
66 public:
67 wxPyCallback(PyObject* func) { m_func = func; Py_INCREF(m_func); }
68 ~wxPyCallback() { Py_DECREF(m_func); }
69
70 void EventThunker(wxEvent& event);
71
72 PyObject* m_func;
73 };
74
75 //---------------------------------------------------------------------------
76
77 #ifdef __WXMSW__
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 };
87 #endif
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$
106 // Revision 1.2 1998/08/14 23:36:37 RD
107 // Beginings of wxGTK compatibility
108 //
109 // Revision 1.1 1998/08/09 08:25:51 RD
110 // Initial version
111 //
112 //
113
114 #endif
115