]> git.saurik.com Git - wxWidgets.git/blob - wxPython/include/wx/wxPython/pyclasses.h
2859590f0980421619675b505639338d2a3104bf
[wxWidgets.git] / wxPython / include / wx / wxPython / pyclasses.h
1 ////////////////////////////////////////////////////////////////////////////
2 // Name: pyclasses.h
3 // Purpose: wxPython python-aware classes for redirecting virtual method
4 // calls for classes located in the core but that need to be
5 // visible to multiple modules
6 //
7 // Author: Robin Dunn
8 //
9 // Created: 11-Oct-2003
10 // RCS-ID: $Id$
11 // Copyright: (c) 2003 by Total Control Software
12 // Licence: wxWindows license
13 /////////////////////////////////////////////////////////////////////////////
14
15 #ifndef __pyclasses_h__
16 #define __pyclasses_h__
17
18
19
20 //---------------------------------------------------------------------------
21
22 class wxPySizer : public wxSizer {
23 DECLARE_DYNAMIC_CLASS(wxPySizer);
24 public:
25 wxPySizer() : wxSizer() {};
26
27 DEC_PYCALLBACK___pure(RecalcSizes);
28 DEC_PYCALLBACK_wxSize__pure(CalcMin);
29 PYPRIVATE;
30 };
31
32
33 //---------------------------------------------------------------------------
34
35 class wxPyValidator : public wxValidator {
36 DECLARE_DYNAMIC_CLASS(wxPyValidator);
37 public:
38 wxPyValidator() {
39 }
40
41 ~wxPyValidator() {
42 }
43
44 wxObject* Clone() const {
45 wxPyValidator* ptr = NULL;
46 wxPyValidator* self = (wxPyValidator*)this;
47
48 bool blocked = wxPyBeginBlockThreads();
49 if (wxPyCBH_findCallback(self->m_myInst, "Clone")) {
50 PyObject* ro;
51 ro = wxPyCBH_callCallbackObj(self->m_myInst, Py_BuildValue("()"));
52 if (ro) {
53 wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxPyValidator"));
54 Py_DECREF(ro);
55 }
56 }
57 wxPyEndBlockThreads(blocked);
58
59 // This is very dangerous!!! But is the only way I could find
60 // to squash a memory leak. Currently it is okay, but if the
61 // validator architecture in wxWindows ever changes, problems
62 // could arise.
63 delete self;
64 return ptr;
65 }
66
67
68 DEC_PYCALLBACK_BOOL_WXWIN(Validate);
69 DEC_PYCALLBACK_BOOL_(TransferToWindow);
70 DEC_PYCALLBACK_BOOL_(TransferFromWindow);
71
72 PYPRIVATE;
73 };
74
75
76 //---------------------------------------------------------------------------
77
78
79 class wxPyTimer : public wxTimer
80 {
81 public:
82 wxPyTimer(wxEvtHandler *owner=NULL, int id = -1)
83 : wxTimer(owner, id)
84 {
85 if (owner == NULL) SetOwner(this);
86 }
87
88 DEC_PYCALLBACK__(Notify);
89 PYPRIVATE;
90 DECLARE_ABSTRACT_CLASS(wxPyTimer)
91 };
92
93
94 //---------------------------------------------------------------------------
95
96
97 class wxPyProcess : public wxProcess {
98 public:
99 wxPyProcess(wxEvtHandler *parent = NULL, int id = -1)
100 : wxProcess(parent, id)
101 {}
102
103 DEC_PYCALLBACK_VOID_INTINT(OnTerminate);
104
105 PYPRIVATE;
106 };
107
108
109 //---------------------------------------------------------------------------
110
111 #ifndef __WXX11__
112 class wxPyDropSource : public wxDropSource {
113 public:
114 #ifndef __WXGTK__
115 wxPyDropSource(wxWindow *win = NULL,
116 const wxCursor &copy = wxNullCursor,
117 const wxCursor &move = wxNullCursor,
118 const wxCursor &none = wxNullCursor)
119 : wxDropSource(win, copy, move, none) {}
120 #else
121 wxPyDropSource(wxWindow *win = NULL,
122 const wxIcon& copy = wxNullIcon,
123 const wxIcon& move = wxNullIcon,
124 const wxIcon& none = wxNullIcon)
125 : wxDropSource(win, copy, move, none) {}
126 #endif
127 ~wxPyDropSource() { }
128
129 DEC_PYCALLBACK_BOOL_DR(GiveFeedback);
130 PYPRIVATE;
131 };
132
133
134 class wxPyDropTarget : public wxDropTarget {
135 public:
136 wxPyDropTarget(wxDataObject *dataObject = NULL)
137 : wxDropTarget(dataObject) {}
138
139 // called when mouse leaves the window: might be used to remove the
140 // feedback which was given in OnEnter()
141 DEC_PYCALLBACK__(OnLeave);
142
143 // called when the mouse enters the window (only once until OnLeave())
144 DEC_PYCALLBACK_DR_2WXCDR(OnEnter);
145
146 // called when the mouse moves in the window - shouldn't take long to
147 // execute or otherwise mouse movement would be too slow
148 DEC_PYCALLBACK_DR_2WXCDR(OnDragOver);
149
150 // called after OnDrop() returns True: you will usually just call
151 // GetData() from here and, probably, also refresh something to update the
152 // new data and, finally, return the code indicating how did the operation
153 // complete (returning default value in case of success and wxDragError on
154 // failure is usually ok)
155 DEC_PYCALLBACK_DR_2WXCDR_pure(OnData);
156
157 // this function is called when data is dropped at position (x, y) - if it
158 // returns True, OnData() will be called immediately afterwards which will
159 // allow to retrieve the data dropped.
160 DEC_PYCALLBACK_BOOL_INTINT(OnDrop);
161
162 PYPRIVATE;
163 };
164
165 #endif
166
167
168 //---------------------------------------------------------------------------
169
170 class wxPyVScrolledWindow;
171 class wxPyVListBox;
172 class wxPyHtmlListBox;
173 class wxPyPanel;
174 class wxPyScrolledWindow;
175 class wxPyPopupTransientWindow;
176 class wxPyPreviewFrame;
177 class wxPyWindow;
178 class wxPyPreviewControlBar;
179 class wxPyPrintPreview;
180 class wxPyListCtrl;
181 class wxPyControl;
182 class wxPyPrintout;
183 class wxGenericDragImage;
184 class wxPyTaskBarIcon;
185
186
187 #ifdef __WXMAC__
188 class wxPopupWindow;
189 class wxTaskBarIconEvent;
190 class wxTaskBarIcon;
191 class wxToggleButton;
192 #endif
193
194 //---------------------------------------------------------------------------
195
196 //---------------------------------------------------------------------------
197 //---------------------------------------------------------------------------
198 #endif