]> git.saurik.com Git - wxWidgets.git/blame - utils/wxPython/src/helpers.h
added a "lib" target for generating a wxPython library for static
[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
19//----------------------------------------------------------------------
20
21class wxPyApp: public wxApp
22{
23public:
24 int MainLoop(void);
25 bool OnInit(void);
26 void AfterMainLoop(void);
27};
28
29extern wxPyApp *wxPythonApp;
30
31//----------------------------------------------------------------------
32
0d6f9504 33void __wxPreStart();
7bf85405
RD
34PyObject* __wxStart(PyObject*, PyObject* args);
35
36extern PyObject* wxPython_dict;
37PyObject* __wxSetDictionary(PyObject*, PyObject* args);
38
39extern wxHashTable* wxPyWindows; // keep track of all windows so we
40 // don't accidentally delete them twice.
41
42void wxPyEventThunker(wxObject*, wxEvent& event);
43
44//----------------------------------------------------------------------
45
46
47#ifndef SWIGCODE
48extern "C" void SWIG_MakePtr(char *, void *, char *);
49extern "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.
59extern wxPoint wxPyDefaultPosition;
60extern wxSize wxPyDefaultSize;
7bf85405
RD
61extern wxString wxPyEmptyStr;
62
63//----------------------------------------------------------------------
64
65class wxPyCallback : public wxObject {
66public:
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
77class wxPyMenu : public wxMenu {
78public:
79 wxPyMenu(const wxString& title = "", PyObject* func=NULL);
80 ~wxPyMenu();
81
82private:
83 static void MenuCallback(wxMenu& menu, wxCommandEvent& evt);
84 PyObject* func;
85};
714e6a9e 86
7bf85405
RD
87
88//---------------------------------------------------------------------------
89
90class wxPyTimer : public wxTimer {
91public:
92 wxPyTimer(PyObject* callback);
93 ~wxPyTimer();
94
95 void Notify();
96
97private:
98 PyObject* func;
99};
100
101//---------------------------------------------------------------------------
102/////////////////////////////////////////////////////////////////////////////
103//
104// $Log$
9c039d08
RD
105// Revision 1.5 1998/10/02 06:40:40 RD
106// Version 0.4 of wxPython for MSW.
107//
0d6f9504
RD
108// Revision 1.4 1998/08/27 21:59:09 RD
109// Some chicken-and-egg problems solved for wxPython on wxGTK
110//
714e6a9e
RD
111// Revision 1.3 1998/08/16 04:31:09 RD
112// More wxGTK work.
113//
853b255a
RD
114// Revision 1.2 1998/08/14 23:36:37 RD
115// Beginings of wxGTK compatibility
116//
7bf85405
RD
117// Revision 1.1 1998/08/09 08:25:51 RD
118// Initial version
119//
120//
121
122#endif
123