]> git.saurik.com Git - wxWidgets.git/blob - wxPython/include/wx/wxPython/pyclasses.h
518aab0184a4883668511c6a99f56aed174ace82
[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 wxPyPen : public wxPen {
80 public:
81 wxPyPen(wxColour& colour, int width=1, int style=wxSOLID)
82 : wxPen(colour, width, style)
83 { m_dash = NULL; }
84 ~wxPyPen();
85
86 void SetDashes(int nb_dashes, const wxDash *dash);
87
88 private:
89 wxDash* m_dash;
90 };
91
92
93 //---------------------------------------------------------------------------
94
95 class wxPyTimer : public wxTimer
96 {
97 public:
98 wxPyTimer(wxEvtHandler *owner=NULL, int id = -1)
99 : wxTimer(owner, id)
100 {
101 if (owner == NULL) SetOwner(this);
102 }
103
104 DEC_PYCALLBACK__(Notify);
105 PYPRIVATE;
106 };
107
108
109 //---------------------------------------------------------------------------
110
111
112 class wxPyProcess : public wxProcess {
113 public:
114 wxPyProcess(wxEvtHandler *parent = NULL, int id = -1)
115 : wxProcess(parent, id)
116 {}
117
118 DEC_PYCALLBACK_VOID_INTINT(OnTerminate);
119
120 PYPRIVATE;
121 };
122
123
124 //---------------------------------------------------------------------------
125
126 #ifndef __WXX11__
127 class wxPyDropSource : public wxDropSource {
128 public:
129 #ifndef __WXGTK__
130 wxPyDropSource(wxWindow *win = NULL,
131 const wxCursor &copy = wxNullCursor,
132 const wxCursor &move = wxNullCursor,
133 const wxCursor &none = wxNullCursor)
134 : wxDropSource(win, copy, move, none) {}
135 #else
136 wxPyDropSource(wxWindow *win = NULL,
137 const wxIcon& copy = wxNullIcon,
138 const wxIcon& move = wxNullIcon,
139 const wxIcon& none = wxNullIcon)
140 : wxDropSource(win, copy, move, none) {}
141 #endif
142 ~wxPyDropSource() { }
143
144 DEC_PYCALLBACK_BOOL_DR(GiveFeedback);
145 PYPRIVATE;
146 };
147
148
149 class wxPyDropTarget : public wxDropTarget {
150 public:
151 wxPyDropTarget(wxDataObject *dataObject = NULL)
152 : wxDropTarget(dataObject) {}
153
154 // called when mouse leaves the window: might be used to remove the
155 // feedback which was given in OnEnter()
156 DEC_PYCALLBACK__(OnLeave);
157
158 // called when the mouse enters the window (only once until OnLeave())
159 DEC_PYCALLBACK_DR_2WXCDR(OnEnter);
160
161 // called when the mouse moves in the window - shouldn't take long to
162 // execute or otherwise mouse movement would be too slow
163 DEC_PYCALLBACK_DR_2WXCDR(OnDragOver);
164
165 // called after OnDrop() returns True: you will usually just call
166 // GetData() from here and, probably, also refresh something to update the
167 // new data and, finally, return the code indicating how did the operation
168 // complete (returning default value in case of success and wxDragError on
169 // failure is usually ok)
170 DEC_PYCALLBACK_DR_2WXCDR_pure(OnData);
171
172 // this function is called when data is dropped at position (x, y) - if it
173 // returns True, OnData() will be called immediately afterwards which will
174 // allow to retrieve the data dropped.
175 DEC_PYCALLBACK_BOOL_INTINT(OnDrop);
176
177 PYPRIVATE;
178 };
179
180 #endif
181
182
183 //---------------------------------------------------------------------------
184
185 class wxPyVScrolledWindow;
186 class wxPyVListBox;
187 class wxPyHtmlListBox;
188 class wxPyPanel;
189 class wxPyPopupTransientWindow;
190 class wxPyPreviewFrame;
191 class wxPyWindow;
192 class wxPyPreviewControlBar;
193 class wxPyPrintPreview;
194 class wxPyListCtrl;
195 class wxPyControl;
196 class wxPyPrintout;
197 class wxGenericDragImage;
198
199
200 #ifdef __WXMAC__
201 class wxPopupWindow;
202 class wxTaskBarIconEvent;
203 class wxTaskBarIcon;
204 class wxToggleButton;
205 #endif
206
207 //---------------------------------------------------------------------------
208
209 //---------------------------------------------------------------------------
210 //---------------------------------------------------------------------------
211 #endif