]>
Commit | Line | Data |
---|---|---|
7bf85405 RD |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: controls2.i | |
3 | // Purpose: More control (widget) classes for wxPython | |
4 | // | |
5 | // Author: Robin Dunn | |
6 | // | |
7 | // Created: 6/10/98 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 1998 by Total Control Software | |
10 | // Licence: wxWindows license | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
03e9bead | 13 | %module controls2 |
7bf85405 | 14 | |
03e9bead | 15 | %{ |
7bf85405 | 16 | #include "helpers.h" |
2f90df85 RD |
17 | #ifdef __WXMSW__ |
18 | #include <windows.h> | |
19 | #endif | |
7bf85405 RD |
20 | #include <wx/listctrl.h> |
21 | #include <wx/treectrl.h> | |
9416aa89 | 22 | #include <wx/imaglist.h> |
68320e40 | 23 | #include <wx/dirctrl.h> |
7bf85405 RD |
24 | %} |
25 | ||
26 | //---------------------------------------------------------------------- | |
27 | ||
28 | %include typemaps.i | |
29 | %include my_typemaps.i | |
30 | ||
31 | // Import some definitions of other classes, etc. | |
32 | %import _defs.i | |
33 | %import misc.i | |
34 | %import windows.i | |
35 | %import gdi.i | |
36 | %import events.i | |
37 | %import controls.i | |
38 | ||
b8b8dda7 | 39 | %pragma(python) code = "import wx" |
9c039d08 | 40 | |
c7e7022c RD |
41 | |
42 | //---------------------------------------------------------------------- | |
137b5242 RD |
43 | %{ |
44 | // Put some wx default wxChar* values into wxStrings. | |
45 | const wxChar* wxListCtrlNameStr = _T("wxListCtrl"); | |
46 | DECLARE_DEF_STRING(ListCtrlNameStr); | |
47 | ||
9a74fcaf | 48 | const wxChar* wx_TreeCtrlNameStr = _T("wxTreeCtrl"); |
137b5242 RD |
49 | DECLARE_DEF_STRING(_TreeCtrlNameStr); |
50 | DECLARE_DEF_STRING(DirDialogDefaultFolderStr); | |
51 | ||
52 | static const wxString wxPyEmptyString(wxT("")); | |
53 | %} | |
54 | ||
7bf85405 RD |
55 | //---------------------------------------------------------------------- |
56 | ||
c7e7022c RD |
57 | enum { |
58 | /* List control event types */ | |
59 | wxEVT_COMMAND_LIST_BEGIN_DRAG, | |
60 | wxEVT_COMMAND_LIST_BEGIN_RDRAG, | |
61 | wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT, | |
62 | wxEVT_COMMAND_LIST_END_LABEL_EDIT, | |
63 | wxEVT_COMMAND_LIST_DELETE_ITEM, | |
64 | wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS, | |
65 | wxEVT_COMMAND_LIST_GET_INFO, | |
66 | wxEVT_COMMAND_LIST_SET_INFO, | |
67 | wxEVT_COMMAND_LIST_ITEM_SELECTED, | |
68 | wxEVT_COMMAND_LIST_ITEM_DESELECTED, | |
69 | wxEVT_COMMAND_LIST_KEY_DOWN, | |
70 | wxEVT_COMMAND_LIST_INSERT_ITEM, | |
71 | wxEVT_COMMAND_LIST_COL_CLICK, | |
72 | wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, | |
73 | wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK, | |
74 | wxEVT_COMMAND_LIST_ITEM_ACTIVATED, | |
75 | wxEVT_COMMAND_LIST_CACHE_HINT, | |
6d19860f RD |
76 | wxEVT_COMMAND_LIST_COL_RIGHT_CLICK, |
77 | wxEVT_COMMAND_LIST_COL_BEGIN_DRAG, | |
78 | wxEVT_COMMAND_LIST_COL_DRAGGING, | |
79 | wxEVT_COMMAND_LIST_COL_END_DRAG, | |
d8200036 | 80 | wxEVT_COMMAND_LIST_ITEM_FOCUSED, |
c7e7022c RD |
81 | }; |
82 | ||
83 | ||
84 | %pragma(python) code = " | |
85 | def EVT_LIST_BEGIN_DRAG(win, id, func): | |
86 | win.Connect(id, -1, wxEVT_COMMAND_LIST_BEGIN_DRAG, func) | |
87 | ||
88 | def EVT_LIST_BEGIN_RDRAG(win, id, func): | |
89 | win.Connect(id, -1, wxEVT_COMMAND_LIST_BEGIN_RDRAG, func) | |
90 | ||
91 | def EVT_LIST_BEGIN_LABEL_EDIT(win, id, func): | |
92 | win.Connect(id, -1, wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT, func) | |
93 | ||
94 | def EVT_LIST_END_LABEL_EDIT(win, id, func): | |
95 | win.Connect(id, -1, wxEVT_COMMAND_LIST_END_LABEL_EDIT, func) | |
96 | ||
97 | def EVT_LIST_DELETE_ITEM(win, id, func): | |
98 | win.Connect(id, -1, wxEVT_COMMAND_LIST_DELETE_ITEM, func) | |
99 | ||
100 | def EVT_LIST_DELETE_ALL_ITEMS(win, id, func): | |
101 | win.Connect(id, -1, wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS, func) | |
102 | ||
103 | def EVT_LIST_GET_INFO(win, id, func): | |
104 | win.Connect(id, -1, wxEVT_COMMAND_LIST_GET_INFO, func) | |
105 | ||
106 | def EVT_LIST_SET_INFO(win, id, func): | |
107 | win.Connect(id, -1, wxEVT_COMMAND_LIST_SET_INFO, func) | |
108 | ||
109 | def EVT_LIST_ITEM_SELECTED(win, id, func): | |
110 | win.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_SELECTED, func) | |
111 | ||
112 | def EVT_LIST_ITEM_DESELECTED(win, id, func): | |
113 | win.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_DESELECTED, func) | |
114 | ||
115 | def EVT_LIST_KEY_DOWN(win, id, func): | |
116 | win.Connect(id, -1, wxEVT_COMMAND_LIST_KEY_DOWN, func) | |
117 | ||
118 | def EVT_LIST_INSERT_ITEM(win, id, func): | |
119 | win.Connect(id, -1, wxEVT_COMMAND_LIST_INSERT_ITEM, func) | |
120 | ||
121 | def EVT_LIST_COL_CLICK(win, id, func): | |
122 | win.Connect(id, -1, wxEVT_COMMAND_LIST_COL_CLICK, func) | |
123 | ||
6d19860f RD |
124 | def EVT_LIST_COL_RIGHT_CLICK(win, id, func): |
125 | win.Connect(id, -1, wxEVT_COMMAND_LIST_COL_RIGHT_CLICK, func) | |
126 | ||
127 | def EVT_LIST_COL_BEGIN_DRAG(win, id, func): | |
128 | win.Connect(id, -1, wxEVT_COMMAND_LIST_COL_BEGIN_DRAG, func) | |
129 | ||
130 | def EVT_LIST_COL_DRAGGING(win, id, func): | |
131 | win.Connect(id, -1, wxEVT_COMMAND_LIST_COL_DRAGGING, func) | |
132 | ||
133 | def EVT_LIST_COL_END_DRAG(win, id, func): | |
134 | win.Connect(id, -1, wxEVT_COMMAND_LIST_COL_END_DRAG, func) | |
135 | ||
c7e7022c RD |
136 | def EVT_LIST_ITEM_RIGHT_CLICK(win, id, func): |
137 | win.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, func) | |
138 | ||
139 | def EVT_LIST_ITEM_MIDDLE_CLICK(win, id, func): | |
140 | win.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK, func) | |
141 | ||
142 | def EVT_LIST_ITEM_ACTIVATED(win, id, func): | |
143 | win.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_ACTIVATED, func) | |
144 | ||
145 | def EVT_LIST_CACHE_HINT(win, id, func): | |
146 | win.Connect(id, -1, wxEVT_COMMAND_LIST_CACHE_HINT, func) | |
d8200036 RD |
147 | |
148 | def EVT_LIST_ITEM_FOCUSED(win, id, func): | |
149 | win.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_FOCUSED, func) | |
c7e7022c RD |
150 | " |
151 | ||
7bf85405 | 152 | |
af309447 | 153 | enum { |
c7e7022c RD |
154 | /* Style flags */ |
155 | wxLC_VRULES, | |
156 | wxLC_HRULES, | |
157 | ||
158 | wxLC_ICON, | |
159 | wxLC_SMALL_ICON, | |
160 | wxLC_LIST, | |
161 | wxLC_REPORT, | |
162 | ||
163 | wxLC_ALIGN_TOP, | |
164 | wxLC_ALIGN_LEFT, | |
165 | wxLC_AUTOARRANGE, | |
166 | wxLC_VIRTUAL, | |
167 | wxLC_EDIT_LABELS, | |
168 | wxLC_NO_HEADER, | |
169 | wxLC_NO_SORT_HEADER, | |
170 | wxLC_SINGLE_SEL, | |
171 | wxLC_SORT_ASCENDING, | |
172 | wxLC_SORT_DESCENDING, | |
173 | ||
174 | wxLC_MASK_TYPE, | |
175 | wxLC_MASK_ALIGN, | |
176 | wxLC_MASK_SORT, | |
177 | ||
6d19860f | 178 | wxLC_USER_TEXT, |
c7e7022c RD |
179 | }; |
180 | ||
181 | ||
182 | enum { | |
183 | // Mask flags | |
184 | wxLIST_MASK_STATE, | |
af309447 RD |
185 | wxLIST_MASK_TEXT, |
186 | wxLIST_MASK_IMAGE, | |
187 | wxLIST_MASK_DATA, | |
c7e7022c | 188 | wxLIST_SET_ITEM, |
af309447 RD |
189 | wxLIST_MASK_WIDTH, |
190 | wxLIST_MASK_FORMAT, | |
c7e7022c RD |
191 | |
192 | // State flags | |
af309447 RD |
193 | wxLIST_STATE_DONTCARE, |
194 | wxLIST_STATE_DROPHILITED, | |
195 | wxLIST_STATE_FOCUSED, | |
196 | wxLIST_STATE_SELECTED, | |
197 | wxLIST_STATE_CUT, | |
c7e7022c RD |
198 | |
199 | // Hit test flags | |
af309447 RD |
200 | wxLIST_HITTEST_ABOVE, |
201 | wxLIST_HITTEST_BELOW, | |
202 | wxLIST_HITTEST_NOWHERE, | |
203 | wxLIST_HITTEST_ONITEMICON, | |
204 | wxLIST_HITTEST_ONITEMLABEL, | |
205 | wxLIST_HITTEST_ONITEMRIGHT, | |
206 | wxLIST_HITTEST_ONITEMSTATEICON, | |
207 | wxLIST_HITTEST_TOLEFT, | |
208 | wxLIST_HITTEST_TORIGHT, | |
209 | wxLIST_HITTEST_ONITEM, | |
c7e7022c RD |
210 | |
211 | // Flags for GetNextItem | |
af309447 RD |
212 | wxLIST_NEXT_ABOVE, |
213 | wxLIST_NEXT_ALL, | |
214 | wxLIST_NEXT_BELOW, | |
215 | wxLIST_NEXT_LEFT, | |
216 | wxLIST_NEXT_RIGHT, | |
c7e7022c RD |
217 | |
218 | // Alignment flags | |
af309447 RD |
219 | wxLIST_ALIGN_DEFAULT, |
220 | wxLIST_ALIGN_LEFT, | |
221 | wxLIST_ALIGN_TOP, | |
222 | wxLIST_ALIGN_SNAP_TO_GRID, | |
c7e7022c RD |
223 | |
224 | // Autosize values for SetColumnWidth | |
225 | wxLIST_AUTOSIZE = -1, | |
226 | wxLIST_AUTOSIZE_USEHEADER = -2, | |
227 | ||
228 | // Flag values for GetItemRect | |
af309447 RD |
229 | wxLIST_RECT_BOUNDS, |
230 | wxLIST_RECT_ICON, | |
231 | wxLIST_RECT_LABEL, | |
c7e7022c RD |
232 | |
233 | // Flag values for FindItem (MSW only) | |
af309447 RD |
234 | wxLIST_FIND_UP, |
235 | wxLIST_FIND_DOWN, | |
236 | wxLIST_FIND_LEFT, | |
237 | wxLIST_FIND_RIGHT, | |
c7e7022c RD |
238 | |
239 | ||
af309447 RD |
240 | }; |
241 | ||
242 | ||
c7e7022c | 243 | |
f6bcfd97 BP |
244 | enum wxListColumnFormat |
245 | { | |
246 | wxLIST_FORMAT_LEFT, | |
247 | wxLIST_FORMAT_RIGHT, | |
248 | wxLIST_FORMAT_CENTRE, | |
249 | wxLIST_FORMAT_CENTER = wxLIST_FORMAT_CENTRE | |
250 | }; | |
251 | ||
252 | ||
1b62f00d RD |
253 | |
254 | ||
f6bcfd97 BP |
255 | class wxListItemAttr |
256 | { | |
257 | public: | |
258 | // ctors | |
c7e7022c RD |
259 | //wxListItemAttr(); |
260 | wxListItemAttr(const wxColour& colText = wxNullColour, | |
261 | const wxColour& colBack = wxNullColour, | |
262 | const wxFont& font = wxNullFont); | |
263 | ||
f6bcfd97 BP |
264 | |
265 | // setters | |
266 | void SetTextColour(const wxColour& colText); | |
267 | void SetBackgroundColour(const wxColour& colBack); | |
268 | void SetFont(const wxFont& font); | |
269 | ||
270 | // accessors | |
271 | bool HasTextColour(); | |
272 | bool HasBackgroundColour(); | |
273 | bool HasFont(); | |
274 | ||
c5943253 RD |
275 | wxColour GetTextColour(); |
276 | wxColour GetBackgroundColour(); | |
277 | wxFont GetFont(); | |
f6bcfd97 BP |
278 | }; |
279 | ||
280 | ||
9416aa89 | 281 | class wxListItem : public wxObject { |
7bf85405 | 282 | public: |
f6bcfd97 BP |
283 | wxListItem(); |
284 | ~wxListItem(); | |
285 | ||
286 | // resetting | |
287 | void Clear(); | |
288 | void ClearAttributes(); | |
289 | ||
290 | // setters | |
291 | void SetMask(long mask); | |
292 | void SetId(long id); | |
293 | void SetColumn(int col); | |
294 | void SetState(long state); | |
295 | void SetStateMask(long stateMask); | |
296 | void SetText(const wxString& text); | |
297 | void SetImage(int image); | |
298 | void SetData(long data); | |
299 | ||
300 | void SetWidth(int width); | |
301 | void SetAlign(wxListColumnFormat align); | |
302 | ||
303 | void SetTextColour(const wxColour& colText); | |
304 | void SetBackgroundColour(const wxColour& colBack); | |
305 | void SetFont(const wxFont& font); | |
306 | ||
307 | // accessors | |
308 | long GetMask(); | |
309 | long GetId(); | |
310 | int GetColumn(); | |
311 | long GetState(); | |
312 | const wxString& GetText(); | |
313 | int GetImage(); | |
314 | long GetData(); | |
315 | ||
316 | int GetWidth(); | |
317 | wxListColumnFormat GetAlign(); | |
318 | ||
319 | wxListItemAttr *GetAttributes(); | |
320 | bool HasAttributes(); | |
321 | ||
322 | wxColour GetTextColour() const; | |
323 | wxColour GetBackgroundColour() const; | |
324 | wxFont GetFont() const; | |
325 | ||
326 | // these members are public for compatibility | |
7bf85405 RD |
327 | long m_mask; // Indicates what fields are valid |
328 | long m_itemId; // The zero-based item position | |
329 | int m_col; // Zero-based column, if in report mode | |
330 | long m_state; // The state of the item | |
f6bcfd97 | 331 | long m_stateMask;// Which flags of m_state are valid (uses same flags) |
7bf85405 RD |
332 | wxString m_text; // The label/header text |
333 | int m_image; // The zero-based index into an image list | |
334 | long m_data; // App-defined data | |
7bf85405 RD |
335 | |
336 | // For columns only | |
337 | int m_format; // left, right, centre | |
338 | int m_width; // width of column | |
339 | ||
7bf85405 RD |
340 | }; |
341 | ||
f6bcfd97 | 342 | |
c368d904 | 343 | class wxListEvent: public wxNotifyEvent { |
7bf85405 | 344 | public: |
6d19860f RD |
345 | wxListEvent(wxEventType commandType = wxEVT_NULL, int id = 0); |
346 | ||
7bf85405 | 347 | int m_code; |
ebf4302c | 348 | long m_oldItemIndex; |
7bf85405 | 349 | long m_itemIndex; |
7bf85405 | 350 | int m_col; |
7bf85405 RD |
351 | wxPoint m_pointDrag; |
352 | wxListItem m_item; | |
7bf85405 | 353 | |
f6bcfd97 BP |
354 | int GetCode(); |
355 | long GetIndex(); | |
f6bcfd97 | 356 | int GetColumn(); |
f6bcfd97 BP |
357 | wxPoint GetPoint(); |
358 | const wxString& GetLabel(); | |
359 | const wxString& GetText(); | |
360 | int GetImage(); | |
361 | long GetData(); | |
362 | long GetMask(); | |
363 | const wxListItem& GetItem(); | |
6d19860f RD |
364 | |
365 | long GetCacheFrom(); | |
366 | long GetCacheTo(); | |
f6bcfd97 | 367 | }; |
7bf85405 RD |
368 | |
369 | ||
09f3d4e6 | 370 | %{ // C++ Version of a Python aware class |
c7e7022c RD |
371 | class wxPyListCtrl : public wxListCtrl { |
372 | DECLARE_ABSTRACT_CLASS(wxPyListCtrl); | |
7bf85405 | 373 | public: |
09f3d4e6 | 374 | wxPyListCtrl() : wxListCtrl() {} |
c7e7022c RD |
375 | wxPyListCtrl(wxWindow* parent, wxWindowID id, |
376 | const wxPoint& pos, | |
377 | const wxSize& size, | |
378 | long style, | |
379 | const wxValidator& validator, | |
137b5242 | 380 | const wxString& name) : |
c7e7022c RD |
381 | wxListCtrl(parent, id, pos, size, style, validator, name) {} |
382 | ||
09f3d4e6 RD |
383 | bool Create(wxWindow* parent, wxWindowID id, |
384 | const wxPoint& pos, | |
385 | const wxSize& size, | |
386 | long style, | |
387 | const wxValidator& validator, | |
137b5242 | 388 | const wxString& name) { |
09f3d4e6 RD |
389 | return wxListCtrl::Create(parent, id, pos, size, style, validator, name); |
390 | } | |
391 | ||
c7e7022c RD |
392 | DEC_PYCALLBACK_STRING_LONGLONG(OnGetItemText); |
393 | DEC_PYCALLBACK_INT_LONG(OnGetItemImage); | |
394 | DEC_PYCALLBACK_LISTATTR_LONG(OnGetItemAttr); | |
395 | ||
396 | PYPRIVATE; | |
397 | }; | |
398 | ||
399 | IMPLEMENT_ABSTRACT_CLASS(wxPyListCtrl, wxListCtrl); | |
7bf85405 | 400 | |
c7e7022c RD |
401 | IMP_PYCALLBACK_STRING_LONGLONG(wxPyListCtrl, wxListCtrl, OnGetItemText); |
402 | IMP_PYCALLBACK_INT_LONG(wxPyListCtrl, wxListCtrl, OnGetItemImage); | |
403 | IMP_PYCALLBACK_LISTATTR_LONG(wxPyListCtrl, wxListCtrl, OnGetItemAttr); | |
404 | %} | |
405 | ||
406 | ||
cdf14688 | 407 | |
c7e7022c RD |
408 | %name(wxListCtrl)class wxPyListCtrl : public wxControl { |
409 | public: | |
410 | wxPyListCtrl(wxWindow* parent, wxWindowID id = -1, | |
411 | const wxPoint& pos = wxDefaultPosition, | |
412 | const wxSize& size = wxDefaultSize, | |
413 | long style = wxLC_ICON, | |
414 | const wxValidator& validator = wxDefaultValidator, | |
137b5242 | 415 | const wxString& name = wxPyListCtrlNameStr); |
09f3d4e6 RD |
416 | %name(wxPreListCtrl)wxPyListCtrl(); |
417 | ||
418 | bool Create(wxWindow* parent, wxWindowID id = -1, | |
419 | const wxPoint& pos = wxDefaultPosition, | |
420 | const wxSize& size = wxDefaultSize, | |
421 | long style = wxLC_ICON, | |
422 | const wxValidator& validator = wxDefaultValidator, | |
137b5242 | 423 | const wxString& name = wxPyListCtrlNameStr); |
c7e7022c | 424 | |
0122b7e3 RD |
425 | void _setCallbackInfo(PyObject* self, PyObject* _class); |
426 | %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxListCtrl)" | |
9c039d08 | 427 | |
0122b7e3 | 428 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 429 | %pragma(python) addtomethod = "wxPreListCtrl:val._setOORInfo(val)" |
7bf85405 | 430 | |
c7e7022c RD |
431 | // Set the control colours |
432 | bool SetForegroundColour(const wxColour& col); | |
433 | bool SetBackgroundColour(const wxColour& col); | |
434 | ||
435 | // Gets information about this column | |
14afa2cb RD |
436 | // bool GetColumn(int col, wxListItem& item) const; |
437 | %addmethods { | |
438 | %new wxListItem* GetColumn(int col) { | |
439 | wxListItem item; | |
440 | if (self->GetColumn(col, item)) | |
441 | return new wxListItem(item); | |
442 | else | |
443 | return NULL; | |
444 | } | |
445 | } // The OOR typemaps don't know what to do with the %new, so fix it up. | |
446 | %pragma(python) addtoclass = " | |
447 | def GetItem(self, *_args, **_kwargs): | |
448 | val = apply(controls2c.wxListCtrl_GetColumn,(self,) + _args, _kwargs) | |
449 | if val is not None: val.thisown = 1 | |
450 | return val | |
451 | " | |
c7e7022c RD |
452 | |
453 | // Sets information about this column | |
454 | bool SetColumn(int col, wxListItem& item) ; | |
455 | ||
456 | // Gets the column width | |
457 | int GetColumnWidth(int col) const; | |
458 | ||
459 | // Sets the column width | |
460 | bool SetColumnWidth(int col, int width) ; | |
461 | ||
462 | // Gets the number of items that can fit vertically in the | |
463 | // visible area of the list control (list or report view) | |
464 | // or the total number of items in the list control (icon | |
465 | // or small icon view) | |
466 | int GetCountPerPage() const; | |
467 | ||
cd096152 | 468 | #ifdef __WXMSW__ |
c7e7022c RD |
469 | // Gets the edit control for editing labels. |
470 | wxTextCtrl* GetEditControl() const; | |
cd096152 | 471 | #endif |
c7e7022c RD |
472 | |
473 | //bool GetItem(wxListItem& info) const ; | |
7bf85405 | 474 | %addmethods { |
c7e7022c | 475 | // Gets information about the item |
e166644c | 476 | %new wxListItem* GetItem(long itemId, int col=0) { |
7bf85405 | 477 | wxListItem* info = new wxListItem; |
0699c864 | 478 | info->m_itemId = itemId; |
e166644c | 479 | info->m_col = col; |
f17fee68 | 480 | info->m_mask = 0xFFFF; |
7bf85405 RD |
481 | self->GetItem(*info); |
482 | return info; | |
483 | } | |
5597b61e RD |
484 | } // The OOR typemaps don't know what to do with the %new, so fix it up. |
485 | %pragma(python) addtoclass = " | |
486 | def GetItem(self, *_args, **_kwargs): | |
487 | val = apply(controls2c.wxListCtrl_GetItem,(self,) + _args, _kwargs) | |
488 | val.thisown = 1 | |
489 | return val | |
490 | " | |
491 | ||
c7e7022c RD |
492 | |
493 | // Sets information about the item | |
494 | bool SetItem(wxListItem& info) ; | |
495 | ||
496 | // Sets a string field at a particular column | |
497 | %name(SetStringItem)long SetItem(long index, int col, const wxString& label, int imageId = -1); | |
498 | ||
499 | // Gets the item state | |
500 | int GetItemState(long item, long stateMask) const ; | |
501 | ||
502 | // Sets the item state | |
503 | bool SetItemState(long item, long state, long stateMask) ; | |
504 | ||
505 | // Sets the item image | |
506 | bool SetItemImage(long item, int image, int selImage) ; | |
507 | ||
508 | // Gets the item text | |
509 | wxString GetItemText(long item) const ; | |
510 | ||
511 | // Sets the item text | |
512 | void SetItemText(long item, const wxString& str) ; | |
513 | ||
514 | // Gets the item data | |
515 | long GetItemData(long item) const ; | |
516 | ||
517 | // Sets the item data | |
518 | bool SetItemData(long item, long data) ; | |
519 | ||
520 | ||
521 | //bool GetItemRect(long item, wxRect& rect, int code = wxLIST_RECT_BOUNDS) const ; | |
522 | //bool GetItemPosition(long item, wxPoint& pos) const ; | |
00b6c4e3 RD |
523 | |
524 | // Gets the item position | |
5597b61e | 525 | %addmethods { |
7bf85405 RD |
526 | %new wxPoint* GetItemPosition(long item) { |
527 | wxPoint* pos = new wxPoint; | |
528 | self->GetItemPosition(item, *pos); | |
529 | return pos; | |
530 | } | |
c7e7022c | 531 | // Gets the item rectangle |
7bf85405 RD |
532 | %new wxRect* GetItemRect(long item, int code = wxLIST_RECT_BOUNDS) { |
533 | wxRect* rect= new wxRect; | |
534 | self->GetItemRect(item, *rect, code); | |
535 | return rect; | |
536 | } | |
537 | } | |
538 | ||
c7e7022c RD |
539 | |
540 | // Sets the item position | |
541 | bool SetItemPosition(long item, const wxPoint& pos) ; | |
542 | ||
543 | // Gets the number of items in the list control | |
544 | int GetItemCount() const; | |
545 | ||
546 | // Gets the number of columns in the list control | |
9d37f964 | 547 | int GetColumnCount() const; |
c7e7022c RD |
548 | |
549 | // Retrieves the spacing between icons in pixels. | |
550 | // If small is TRUE, gets the spacing for the small icon | |
551 | // view, otherwise the large icon view. | |
552 | int GetItemSpacing(bool isSmall) const; | |
553 | ||
554 | // Gets the number of selected items in the list control | |
555 | int GetSelectedItemCount() const; | |
556 | ||
557 | // Gets the text colour of the listview | |
558 | wxColour GetTextColour() const; | |
559 | ||
560 | // Sets the text colour of the listview | |
4f22cf8d | 561 | void SetTextColour(const wxColour& col); |
c7e7022c RD |
562 | |
563 | // Gets the index of the topmost visible item when in | |
564 | // list or report view | |
565 | long GetTopItem() const ; | |
566 | ||
567 | // Add or remove a single window style | |
568 | void SetSingleStyle(long style, bool add = TRUE) ; | |
569 | ||
570 | // Set the whole window style | |
571 | void SetWindowStyleFlag(long style) ; | |
572 | ||
573 | // Searches for an item, starting from 'item'. | |
574 | // item can be -1 to find the first item that matches the | |
575 | // specified flags. | |
576 | // Returns the item or -1 if unsuccessful. | |
577 | long GetNextItem(long item, int geometry = wxLIST_NEXT_ALL, int state = wxLIST_STATE_DONTCARE) const ; | |
578 | ||
579 | // Gets one of the three image lists | |
580 | wxImageList *GetImageList(int which) const ; | |
581 | ||
582 | // Sets the image list | |
583 | void SetImageList(wxImageList *imageList, int which) ; | |
584 | void AssignImageList(wxImageList *imageList, int which) ; | |
585 | %pragma(python) addtomethod = "AssignImageList:_args[0].thisown = 0" | |
586 | ||
587 | // returns true if it is a virtual list control | |
588 | bool IsVirtual() const; | |
589 | ||
590 | // refresh items selectively (only useful for virtual list controls) | |
591 | void RefreshItem(long item); | |
592 | void RefreshItems(long itemFrom, long itemTo); | |
593 | ||
c7e7022c RD |
594 | // Arranges the items |
595 | bool Arrange(int flag = wxLIST_ALIGN_DEFAULT); | |
596 | ||
597 | // Deletes an item | |
598 | bool DeleteItem(long item); | |
599 | ||
600 | // Deletes all items | |
601 | bool DeleteAllItems() ; | |
602 | ||
603 | // Deletes a column | |
604 | bool DeleteColumn(int col); | |
605 | ||
606 | // Deletes all columns | |
607 | bool DeleteAllColumns(); | |
608 | ||
609 | // Clears items, and columns if there are any. | |
610 | void ClearAll(); | |
611 | ||
cd096152 | 612 | #ifdef __WXMSW__ |
c7e7022c RD |
613 | // Edit the label |
614 | wxTextCtrl* EditLabel(long item /*, wxClassInfo* textControlClass = CLASSINFO(wxTextCtrl)*/); | |
615 | ||
616 | // End label editing, optionally cancelling the edit | |
617 | bool EndEditLabel(bool cancel); | |
cd096152 | 618 | #endif |
c7e7022c RD |
619 | |
620 | // Ensures this item is visible | |
621 | bool EnsureVisible(long item) ; | |
622 | ||
623 | // Find an item whose label matches this string, starting from the item after 'start' | |
624 | // or the beginning if 'start' is -1. | |
625 | long FindItem(long start, const wxString& str, bool partial = FALSE); | |
626 | ||
627 | // Find an item whose data matches this data, starting from the item after 'start' | |
628 | // or the beginning if 'start' is -1. | |
629 | %name(FindItemData)long FindItem(long start, long data); | |
630 | ||
631 | // Find an item nearest this position in the specified direction, starting from | |
632 | // the item after 'start' or the beginning if 'start' is -1. | |
633 | %name(FindItemAtPos)long FindItem(long start, const wxPoint& pt, int direction); | |
634 | ||
635 | // Determines which item (if any) is at the specified point, | |
636 | // giving details in the second return value (see wxLIST_HITTEST_... flags above) | |
7bf85405 | 637 | long HitTest(const wxPoint& point, int& OUTPUT); |
c7e7022c RD |
638 | |
639 | // Inserts an item, returning the index of the new item if successful, | |
640 | // -1 otherwise. | |
641 | long InsertItem(wxListItem& info); | |
642 | ||
643 | // Insert a string item | |
644 | %name(InsertStringItem)long InsertItem(long index, const wxString& label); | |
645 | ||
646 | // Insert an image item | |
647 | %name(InsertImageItem)long InsertItem(long index, int imageIndex); | |
648 | ||
649 | // Insert an image/string item | |
650 | %name(InsertImageStringItem)long InsertItem(long index, const wxString& label, int imageIndex); | |
651 | ||
652 | // For list view mode (only), inserts a column. | |
c368d904 | 653 | %name(InsertColumnInfo)long InsertColumn(long col, wxListItem& info); |
c7e7022c RD |
654 | |
655 | long InsertColumn(long col, | |
656 | const wxString& heading, | |
7bf85405 RD |
657 | int format = wxLIST_FORMAT_LEFT, |
658 | int width = -1); | |
659 | ||
c7e7022c RD |
660 | // set the number of items in a virtual list control |
661 | void SetItemCount(long count); | |
7bf85405 | 662 | |
c7e7022c RD |
663 | // Scrolls the list control. If in icon, small icon or report view mode, |
664 | // x specifies the number of pixels to scroll. If in list view mode, x | |
665 | // specifies the number of columns to scroll. | |
666 | // If in icon, small icon or list view mode, y specifies the number of pixels | |
667 | // to scroll. If in report view mode, y specifies the number of lines to scroll. | |
7bf85405 | 668 | bool ScrollList(int dx, int dy); |
dcd38683 RD |
669 | |
670 | // bool SortItems(wxListCtrlCompare fn, long data); | |
671 | %addmethods { | |
c7e7022c RD |
672 | // Sort items. |
673 | // func is a function which takes 2 long arguments: item1, item2. | |
674 | // item1 is the long data associated with a first item (NOT the index). | |
675 | // item2 is the long data associated with a second item (NOT the index). | |
676 | // The return value is a negative number if the first item should precede the second | |
677 | // item, a positive number of the second item should precede the first, | |
678 | // or zero if the two items are equivalent. | |
dcd38683 RD |
679 | bool SortItems(PyObject* func) { |
680 | if (!PyCallable_Check(func)) | |
681 | return FALSE; | |
f6bcfd97 | 682 | return self->SortItems(wxPyListCtrl_SortItems, (long)func); |
dcd38683 RD |
683 | } |
684 | } | |
c7e7022c | 685 | |
6d19860f RD |
686 | %pragma(python) addtoclass = " |
687 | # Some helpers... | |
688 | ||
43097598 | 689 | def Select(self, idx, on=1): |
6d19860f RD |
690 | '''[de]select an item''' |
691 | if on: state = wxLIST_STATE_SELECTED | |
692 | else: state = 0 | |
693 | self.SetItemState(idx, state, wxLIST_STATE_SELECTED) | |
694 | ||
695 | def Focus(self, idx): | |
696 | '''Focus and show the given item''' | |
697 | self.SetItemState(idx, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED) | |
698 | self.EnsureVisible(idx) | |
699 | ||
700 | def GetFocusedItem(self): | |
701 | '''get the currently focused item or -1 if none''' | |
702 | return self.GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_FOCUSED) | |
703 | ||
704 | def IsSelected(self, idx): | |
705 | '''return TRUE if the item is selected''' | |
706 | return self.GetItemState(idx, wxLIST_STATE_SELECTED) != 0 | |
707 | ||
708 | def SetColumnImage(self, col, image): | |
709 | item = wxListItem() | |
710 | item.SetMask(wxLIST_MASK_IMAGE) | |
711 | item.SetImage(image) | |
712 | self.SetColumn(col, item) | |
713 | ||
714 | def ClearColumnImage(self, col): | |
715 | self.SetColumnImage(col, -1) | |
44536514 RD |
716 | |
717 | def Append(self, entry): | |
718 | '''Append an item to the list control. The entry parameter should be a | |
719 | sequence with an item for each column''' | |
720 | if len(entry): | |
721 | pos = self.GetItemCount() | |
722 | self.InsertStringItem(pos, str(entry[0])) | |
723 | for i in range(1, len(entry)): | |
724 | self.SetStringItem(pos, i, str(entry[i])) | |
725 | return pos | |
6d19860f | 726 | " |
7bf85405 RD |
727 | }; |
728 | ||
c7e7022c RD |
729 | |
730 | ||
6d19860f | 731 | %{ // Python aware sorting function for wxPyListCtrl |
f6bcfd97 | 732 | int wxCALLBACK wxPyListCtrl_SortItems(long item1, long item2, long funcPtr) { |
dcd38683 RD |
733 | int retval = 0; |
734 | PyObject* func = (PyObject*)funcPtr; | |
4268f798 | 735 | wxPyBeginBlockThreads(); |
7bf85405 | 736 | |
dcd38683 RD |
737 | PyObject* args = Py_BuildValue("(ii)", item1, item2); |
738 | PyObject* result = PyEval_CallObject(func, args); | |
739 | Py_DECREF(args); | |
740 | if (result) { | |
741 | retval = PyInt_AsLong(result); | |
742 | Py_DECREF(result); | |
743 | } | |
744 | ||
4268f798 | 745 | wxPyEndBlockThreads(); |
dcd38683 RD |
746 | return retval; |
747 | } | |
748 | ||
749 | %} | |
7bf85405 | 750 | |
6d19860f RD |
751 | //---------------------------------------------------------------------- |
752 | ||
753 | class wxListView : public wxPyListCtrl | |
754 | { | |
755 | public: | |
756 | wxListView( wxWindow *parent, | |
757 | wxWindowID id = -1, | |
758 | const wxPoint& pos = wxDefaultPosition, | |
759 | const wxSize& size = wxDefaultSize, | |
760 | long style = wxLC_REPORT, | |
761 | const wxValidator& validator = wxDefaultValidator, | |
137b5242 | 762 | const wxString& name = wxPyListCtrlNameStr); |
6d19860f RD |
763 | %name(wxPreListView)wxListView(); |
764 | ||
765 | bool Create( wxWindow *parent, | |
766 | wxWindowID id = -1, | |
767 | const wxPoint& pos = wxDefaultPosition, | |
768 | const wxSize& size = wxDefaultSize, | |
769 | long style = wxLC_REPORT, | |
770 | const wxValidator& validator = wxDefaultValidator, | |
137b5242 | 771 | const wxString& name = wxPyListCtrlNameStr); |
6d19860f | 772 | |
0122b7e3 | 773 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 774 | %pragma(python) addtomethod = "wxPreListView:val._setOORInfo(val)" |
6d19860f RD |
775 | |
776 | // [de]select an item | |
777 | void Select(long n, bool on = TRUE); | |
778 | ||
779 | // focus and show the given item | |
780 | void Focus(long index); | |
781 | ||
782 | // get the currently focused item or -1 if none | |
783 | long GetFocusedItem() const; | |
784 | ||
785 | // get first and subsequent selected items, return -1 when no more | |
786 | long GetNextSelected(long item) const; | |
787 | long GetFirstSelected() const; | |
788 | ||
789 | // return TRUE if the item is selected | |
790 | bool IsSelected(long index); | |
791 | ||
792 | void SetColumnImage(int col, int image); | |
793 | void ClearColumnImage(int col); | |
794 | }; | |
795 | ||
796 | ||
7bf85405 RD |
797 | //---------------------------------------------------------------------- |
798 | ||
00b6c4e3 RD |
799 | // wxTreeCtrl flags |
800 | enum { | |
801 | wxTR_NO_BUTTONS, | |
802 | wxTR_HAS_BUTTONS, | |
803 | wxTR_TWIST_BUTTONS, | |
804 | wxTR_NO_LINES, | |
805 | wxTR_MAC_BUTTONS, | |
b5a5d647 | 806 | wxTR_AQUA_BUTTONS, |
00b6c4e3 RD |
807 | |
808 | wxTR_SINGLE, | |
809 | wxTR_MULTIPLE, | |
810 | wxTR_EXTENDED, | |
b5a5d647 | 811 | wxTR_FULL_ROW_HIGHLIGHT, |
00b6c4e3 RD |
812 | |
813 | wxTR_EDIT_LABELS, | |
814 | wxTR_LINES_AT_ROOT, | |
815 | wxTR_HIDE_ROOT, | |
816 | wxTR_ROW_LINES, | |
817 | wxTR_HAS_VARIABLE_ROW_HEIGHT, | |
818 | ||
819 | wxTR_DEFAULT_STYLE, | |
820 | }; | |
821 | ||
694759cf RD |
822 | enum wxTreeItemIcon |
823 | { | |
824 | wxTreeItemIcon_Normal, // not selected, not expanded | |
825 | wxTreeItemIcon_Selected, // selected, not expanded | |
826 | wxTreeItemIcon_Expanded, // not selected, expanded | |
827 | wxTreeItemIcon_SelectedExpanded, // selected, expanded | |
828 | wxTreeItemIcon_Max | |
829 | }; | |
830 | ||
7bf85405 | 831 | |
164b735b RD |
832 | // constants for HitTest |
833 | enum { | |
834 | wxTREE_HITTEST_ABOVE, | |
835 | wxTREE_HITTEST_BELOW, | |
836 | wxTREE_HITTEST_NOWHERE, | |
837 | wxTREE_HITTEST_ONITEMBUTTON, | |
838 | wxTREE_HITTEST_ONITEMICON, | |
839 | wxTREE_HITTEST_ONITEMINDENT, | |
840 | wxTREE_HITTEST_ONITEMLABEL, | |
841 | wxTREE_HITTEST_ONITEMRIGHT, | |
842 | wxTREE_HITTEST_ONITEMSTATEICON, | |
843 | wxTREE_HITTEST_TOLEFT, | |
844 | wxTREE_HITTEST_TORIGHT, | |
845 | wxTREE_HITTEST_ONITEMUPPERPART, | |
846 | wxTREE_HITTEST_ONITEMLOWERPART, | |
847 | wxTREE_HITTEST_ONITEM | |
848 | }; | |
849 | ||
850 | ||
1b62f00d RD |
851 | enum { |
852 | /* Tree control event types */ | |
853 | wxEVT_COMMAND_TREE_BEGIN_DRAG, | |
854 | wxEVT_COMMAND_TREE_BEGIN_RDRAG, | |
855 | wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, | |
856 | wxEVT_COMMAND_TREE_END_LABEL_EDIT, | |
857 | wxEVT_COMMAND_TREE_DELETE_ITEM, | |
858 | wxEVT_COMMAND_TREE_GET_INFO, | |
859 | wxEVT_COMMAND_TREE_SET_INFO, | |
860 | wxEVT_COMMAND_TREE_ITEM_EXPANDED, | |
861 | wxEVT_COMMAND_TREE_ITEM_EXPANDING, | |
862 | wxEVT_COMMAND_TREE_ITEM_COLLAPSED, | |
863 | wxEVT_COMMAND_TREE_ITEM_COLLAPSING, | |
864 | wxEVT_COMMAND_TREE_SEL_CHANGED, | |
865 | wxEVT_COMMAND_TREE_SEL_CHANGING, | |
866 | wxEVT_COMMAND_TREE_KEY_DOWN, | |
867 | wxEVT_COMMAND_TREE_ITEM_ACTIVATED, | |
868 | wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, | |
869 | wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK, | |
d1679124 | 870 | wxEVT_COMMAND_TREE_END_DRAG, |
1b62f00d RD |
871 | }; |
872 | ||
873 | ||
00b6c4e3 RD |
874 | %pragma(python) code = " |
875 | # wxTreeCtrl events | |
876 | def EVT_TREE_BEGIN_DRAG(win, id, func): | |
877 | win.Connect(id, -1, wxEVT_COMMAND_TREE_BEGIN_DRAG, func) | |
878 | ||
879 | def EVT_TREE_BEGIN_RDRAG(win, id, func): | |
880 | win.Connect(id, -1, wxEVT_COMMAND_TREE_BEGIN_RDRAG, func) | |
881 | ||
882 | def EVT_TREE_END_DRAG(win, id, func): | |
883 | win.Connect(id, -1, wxEVT_COMMAND_TREE_END_DRAG, func) | |
884 | ||
885 | def EVT_TREE_BEGIN_LABEL_EDIT(win, id, func): | |
886 | win.Connect(id, -1, wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, func) | |
887 | ||
888 | def EVT_TREE_END_LABEL_EDIT(win, id, func): | |
889 | win.Connect(id, -1, wxEVT_COMMAND_TREE_END_LABEL_EDIT, func) | |
890 | ||
891 | def EVT_TREE_GET_INFO(win, id, func): | |
892 | win.Connect(id, -1, wxEVT_COMMAND_TREE_GET_INFO, func) | |
893 | ||
894 | def EVT_TREE_SET_INFO(win, id, func): | |
895 | win.Connect(id, -1, wxEVT_COMMAND_TREE_SET_INFO, func) | |
896 | ||
897 | def EVT_TREE_ITEM_EXPANDED(win, id, func): | |
898 | win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_EXPANDED, func) | |
899 | ||
900 | def EVT_TREE_ITEM_EXPANDING(win, id, func): | |
901 | win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_EXPANDING, func) | |
902 | ||
903 | def EVT_TREE_ITEM_COLLAPSED(win, id, func): | |
904 | win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_COLLAPSED, func) | |
905 | ||
906 | def EVT_TREE_ITEM_COLLAPSING(win, id, func): | |
907 | win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_COLLAPSING, func) | |
908 | ||
909 | def EVT_TREE_SEL_CHANGED(win, id, func): | |
910 | win.Connect(id, -1, wxEVT_COMMAND_TREE_SEL_CHANGED, func) | |
911 | ||
912 | def EVT_TREE_SEL_CHANGING(win, id, func): | |
913 | win.Connect(id, -1, wxEVT_COMMAND_TREE_SEL_CHANGING, func) | |
914 | ||
915 | def EVT_TREE_KEY_DOWN(win, id, func): | |
916 | win.Connect(id, -1, wxEVT_COMMAND_TREE_KEY_DOWN, func) | |
917 | ||
918 | def EVT_TREE_DELETE_ITEM(win, id, func): | |
919 | win.Connect(id, -1, wxEVT_COMMAND_TREE_DELETE_ITEM, func) | |
920 | ||
921 | def EVT_TREE_ITEM_ACTIVATED(win, id, func): | |
922 | win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_ACTIVATED, func) | |
923 | ||
924 | def EVT_TREE_ITEM_RIGHT_CLICK(win, id, func): | |
925 | win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, func) | |
926 | ||
927 | def EVT_TREE_ITEM_MIDDLE_CLICK(win, id, func): | |
928 | win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK, func) | |
929 | " | |
930 | ||
931 | ||
932 | class wxTreeItemAttr | |
933 | { | |
934 | public: | |
935 | // ctors | |
936 | //wxTreeItemAttr() { } | |
937 | wxTreeItemAttr(const wxColour& colText = wxNullColour, | |
938 | const wxColour& colBack = wxNullColour, | |
939 | const wxFont& font = wxNullFont); | |
940 | ||
941 | // setters | |
942 | void SetTextColour(const wxColour& colText); | |
943 | void SetBackgroundColour(const wxColour& colBack); | |
944 | void SetFont(const wxFont& font); | |
945 | ||
946 | // accessors | |
947 | bool HasTextColour(); | |
948 | bool HasBackgroundColour(); | |
949 | bool HasFont(); | |
950 | ||
c5943253 RD |
951 | wxColour GetTextColour(); |
952 | wxColour GetBackgroundColour(); | |
953 | wxFont GetFont(); | |
00b6c4e3 RD |
954 | }; |
955 | ||
956 | ||
d5c9047a RD |
957 | class wxTreeItemId { |
958 | public: | |
959 | wxTreeItemId(); | |
960 | ~wxTreeItemId(); | |
bb0054cd | 961 | bool IsOk(); |
78e8819c | 962 | %pragma(python) addtoclass = "Ok = IsOk" |
d5c9047a | 963 | |
f6bcfd97 BP |
964 | %addmethods { |
965 | int __cmp__(wxTreeItemId* other) { | |
c368d904 | 966 | if (! other) return -1; |
f6bcfd97 BP |
967 | return *self != *other; |
968 | } | |
969 | } | |
d5c9047a RD |
970 | }; |
971 | ||
972 | ||
973 | ||
cf694132 RD |
974 | %{ |
975 | class wxPyTreeItemData : public wxTreeItemData { | |
d5c9047a | 976 | public: |
cf694132 | 977 | wxPyTreeItemData(PyObject* obj = NULL) { |
c368d904 | 978 | if (obj == NULL) |
cf694132 | 979 | obj = Py_None; |
c368d904 RD |
980 | Py_INCREF(obj); |
981 | m_obj = obj; | |
cf694132 | 982 | } |
d5c9047a | 983 | |
cf694132 | 984 | ~wxPyTreeItemData() { |
4268f798 | 985 | wxPyBeginBlockThreads(); |
c368d904 | 986 | Py_DECREF(m_obj); |
4268f798 | 987 | wxPyEndBlockThreads(); |
cf694132 RD |
988 | } |
989 | ||
990 | PyObject* GetData() { | |
991 | Py_INCREF(m_obj); | |
992 | return m_obj; | |
993 | } | |
994 | ||
995 | void SetData(PyObject* obj) { | |
4268f798 | 996 | wxPyBeginBlockThreads(); |
cf694132 | 997 | Py_DECREF(m_obj); |
4268f798 | 998 | wxPyEndBlockThreads(); |
cf694132 RD |
999 | m_obj = obj; |
1000 | Py_INCREF(obj); | |
1001 | } | |
1002 | ||
1003 | PyObject* m_obj; | |
d5c9047a | 1004 | }; |
cf694132 | 1005 | %} |
d5c9047a RD |
1006 | |
1007 | ||
1008 | ||
9416aa89 | 1009 | %name(wxTreeItemData) class wxPyTreeItemData : public wxObject { |
cf694132 RD |
1010 | public: |
1011 | wxPyTreeItemData(PyObject* obj = NULL); | |
1012 | ||
1013 | PyObject* GetData(); | |
1014 | void SetData(PyObject* obj); | |
1015 | ||
1016 | const wxTreeItemId& GetId(); | |
1017 | void SetId(const wxTreeItemId& id); | |
1018 | }; | |
1019 | ||
1020 | ||
d5c9047a | 1021 | |
8bf5d46e | 1022 | class wxTreeEvent : public wxNotifyEvent { |
d5c9047a | 1023 | public: |
00b6c4e3 RD |
1024 | wxTreeEvent(wxEventType commandType = wxEVT_NULL, int id = 0); |
1025 | ||
d5c9047a RD |
1026 | wxTreeItemId GetItem(); |
1027 | wxTreeItemId GetOldItem(); | |
1028 | wxPoint GetPoint(); | |
ecc08ead | 1029 | const wxKeyEvent& GetKeyEvent(); |
d5c9047a | 1030 | int GetCode(); |
8bf5d46e | 1031 | const wxString& GetLabel(); |
d5c9047a RD |
1032 | }; |
1033 | ||
1034 | ||
f6bcfd97 | 1035 | |
09f3d4e6 | 1036 | %{ // C++ version of Python aware wxTreeCtrl |
f6bcfd97 | 1037 | class wxPyTreeCtrl : public wxTreeCtrl { |
3b36695d | 1038 | DECLARE_ABSTRACT_CLASS(wxPyTreeCtrl); |
f6bcfd97 | 1039 | public: |
09f3d4e6 | 1040 | wxPyTreeCtrl() : wxTreeCtrl() {} |
f6bcfd97 BP |
1041 | wxPyTreeCtrl(wxWindow *parent, wxWindowID id, |
1042 | const wxPoint& pos, | |
1043 | const wxSize& size, | |
1044 | long style, | |
1045 | const wxValidator& validator, | |
137b5242 | 1046 | const wxString& name) : |
f6bcfd97 BP |
1047 | wxTreeCtrl(parent, id, pos, size, style, validator, name) {} |
1048 | ||
09f3d4e6 RD |
1049 | bool Create(wxWindow *parent, wxWindowID id, |
1050 | const wxPoint& pos, | |
1051 | const wxSize& size, | |
1052 | long style, | |
1053 | const wxValidator& validator, | |
137b5242 | 1054 | const wxString& name) { |
09f3d4e6 RD |
1055 | return wxTreeCtrl::Create(parent, id, pos, size, style, validator, name); |
1056 | } | |
1057 | ||
1058 | ||
f6bcfd97 BP |
1059 | int OnCompareItems(const wxTreeItemId& item1, |
1060 | const wxTreeItemId& item2) { | |
1061 | int rval = 0; | |
19a97bd6 | 1062 | bool found; |
4268f798 | 1063 | wxPyBeginBlockThreads(); |
19a97bd6 | 1064 | if ((found = m_myInst.findCallback("OnCompareItems"))) |
f6bcfd97 BP |
1065 | rval = m_myInst.callCallback(Py_BuildValue( |
1066 | "(OO)", | |
1067 | wxPyConstructObject((void*)&item1, "wxTreeItemId"), | |
1068 | wxPyConstructObject((void*)&item2, "wxTreeItemId"))); | |
4268f798 | 1069 | wxPyEndBlockThreads(); |
19a97bd6 | 1070 | if (! found) |
f6bcfd97 | 1071 | rval = wxTreeCtrl::OnCompareItems(item1, item2); |
f6bcfd97 BP |
1072 | return rval; |
1073 | } | |
1074 | PYPRIVATE; | |
1075 | }; | |
1076 | ||
3b36695d RD |
1077 | IMPLEMENT_ABSTRACT_CLASS(wxPyTreeCtrl, wxTreeCtrl); |
1078 | ||
f6bcfd97 BP |
1079 | %} |
1080 | ||
d5c9047a RD |
1081 | // These are for the GetFirstChild/GetNextChild methods below |
1082 | %typemap(python, in) long& INOUT = long* INOUT; | |
1083 | %typemap(python, argout) long& INOUT = long* INOUT; | |
1084 | ||
1085 | ||
f6bcfd97 | 1086 | %name(wxTreeCtrl)class wxPyTreeCtrl : public wxControl { |
d5c9047a | 1087 | public: |
f6bcfd97 | 1088 | wxPyTreeCtrl(wxWindow *parent, wxWindowID id = -1, |
b68dc582 RD |
1089 | const wxPoint& pos = wxDefaultPosition, |
1090 | const wxSize& size = wxDefaultSize, | |
d5c9047a | 1091 | long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT, |
b68dc582 | 1092 | const wxValidator& validator = wxDefaultValidator, |
137b5242 | 1093 | const wxString& name = wxPy_TreeCtrlNameStr); |
09f3d4e6 RD |
1094 | %name(wxPreTreeCtrl)wxPyTreeCtrl(); |
1095 | ||
1096 | bool Create(wxWindow *parent, wxWindowID id = -1, | |
1097 | const wxPoint& pos = wxDefaultPosition, | |
1098 | const wxSize& size = wxDefaultSize, | |
1099 | long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT, | |
1100 | const wxValidator& validator = wxDefaultValidator, | |
137b5242 | 1101 | const wxString& name = wxPy_TreeCtrlNameStr); |
d5c9047a | 1102 | |
0122b7e3 RD |
1103 | void _setCallbackInfo(PyObject* self, PyObject* _class); |
1104 | %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxTreeCtrl)" | |
1105 | ||
1106 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
17c0e08c | 1107 | %pragma(python) addtomethod = "wxPreTreeCtrl:val._setOORInfo(val)" |
d5c9047a RD |
1108 | |
1109 | size_t GetCount(); | |
1110 | unsigned int GetIndent(); | |
1111 | void SetIndent(unsigned int indent); | |
1112 | wxImageList *GetImageList(); | |
1113 | wxImageList *GetStateImageList(); | |
1b62f00d | 1114 | void SetImageList(wxImageList *imageList); |
d5c9047a | 1115 | void SetStateImageList(wxImageList *imageList); |
00b6c4e3 RD |
1116 | void AssignImageList(wxImageList* imageList); |
1117 | %pragma(python) addtomethod = "AssignImageList:_args[0].thisown = 0" | |
1118 | void AssignStateImageList(wxImageList* imageList); | |
1119 | %pragma(python) addtomethod = "AssignStateImageList:_args[0].thisown = 0" | |
d5c9047a | 1120 | |
b1462dfa RD |
1121 | unsigned int GetSpacing(); |
1122 | void SetSpacing(unsigned int spacing); | |
1123 | ||
d5c9047a | 1124 | wxString GetItemText(const wxTreeItemId& item); |
694759cf RD |
1125 | int GetItemImage(const wxTreeItemId& item, |
1126 | wxTreeItemIcon which = wxTreeItemIcon_Normal); | |
d5c9047a | 1127 | int GetItemSelectedImage(const wxTreeItemId& item); |
d5c9047a RD |
1128 | |
1129 | void SetItemText(const wxTreeItemId& item, const wxString& text); | |
694759cf RD |
1130 | void SetItemImage(const wxTreeItemId& item, int image, |
1131 | wxTreeItemIcon which = wxTreeItemIcon_Normal); | |
d5c9047a | 1132 | void SetItemSelectedImage(const wxTreeItemId& item, int image); |
08127323 | 1133 | void SetItemHasChildren(const wxTreeItemId& item, bool hasChildren = TRUE); |
d5c9047a | 1134 | |
cf694132 | 1135 | %addmethods { |
c368d904 RD |
1136 | // [Get|Set]ItemData substitutes. Automatically create wxPyTreeItemData |
1137 | // if needed. | |
cf694132 RD |
1138 | wxPyTreeItemData* GetItemData(const wxTreeItemId& item) { |
1139 | wxPyTreeItemData* data = (wxPyTreeItemData*)self->GetItemData(item); | |
1140 | if (data == NULL) { | |
1141 | data = new wxPyTreeItemData(); | |
f6bcfd97 | 1142 | data->SetId(item); // set the id |
cf694132 RD |
1143 | self->SetItemData(item, data); |
1144 | } | |
1145 | return data; | |
1146 | } | |
1147 | ||
1148 | void SetItemData(const wxTreeItemId& item, wxPyTreeItemData* data) { | |
f6bcfd97 BP |
1149 | data->SetId(item); // set the id |
1150 | self->SetItemData(item, data); | |
c368d904 | 1151 | } |
cf694132 | 1152 | |
c368d904 RD |
1153 | // [Get|Set]PyData are short-cuts. Also made somewhat crash-proof by |
1154 | // automatically creating data classes. | |
1155 | PyObject* GetPyData(const wxTreeItemId& item) { | |
cf694132 RD |
1156 | wxPyTreeItemData* data = (wxPyTreeItemData*)self->GetItemData(item); |
1157 | if (data == NULL) { | |
1158 | data = new wxPyTreeItemData(); | |
f6bcfd97 | 1159 | data->SetId(item); // set the id |
cf694132 RD |
1160 | self->SetItemData(item, data); |
1161 | } | |
1162 | return data->GetData(); | |
c368d904 | 1163 | } |
cf694132 RD |
1164 | |
1165 | void SetPyData(const wxTreeItemId& item, PyObject* obj) { | |
1166 | wxPyTreeItemData* data = (wxPyTreeItemData*)self->GetItemData(item); | |
1167 | if (data == NULL) { | |
1168 | data = new wxPyTreeItemData(obj); | |
f6bcfd97 | 1169 | data->SetId(item); // set the id |
cf694132 RD |
1170 | self->SetItemData(item, data); |
1171 | } else | |
1172 | data->SetData(obj); | |
c368d904 | 1173 | } |
cf694132 RD |
1174 | } |
1175 | ||
1176 | ||
d5c9047a RD |
1177 | bool IsVisible(const wxTreeItemId& item); |
1178 | bool ItemHasChildren(const wxTreeItemId& item); | |
1179 | bool IsExpanded(const wxTreeItemId& item); | |
1180 | bool IsSelected(const wxTreeItemId& item); | |
1181 | ||
1182 | wxTreeItemId GetRootItem(); | |
1183 | wxTreeItemId GetSelection(); | |
eb715945 | 1184 | %name(GetItemParent) wxTreeItemId GetParent(const wxTreeItemId& item); |
d426c97e RD |
1185 | //size_t GetSelections(wxArrayTreeItemIds& selection); |
1186 | %addmethods { | |
1187 | PyObject* GetSelections() { | |
4268f798 | 1188 | wxPyBeginBlockThreads(); |
d426c97e RD |
1189 | PyObject* rval = PyList_New(0); |
1190 | wxArrayTreeItemIds array; | |
1191 | size_t num, x; | |
1192 | num = self->GetSelections(array); | |
1193 | for (x=0; x < num; x++) { | |
c368d904 RD |
1194 | wxTreeItemId *tii = new wxTreeItemId(array.Item(x)); |
1195 | PyObject* item = wxPyConstructObject((void*)tii, "wxTreeItemId", TRUE); | |
d426c97e RD |
1196 | PyList_Append(rval, item); |
1197 | } | |
4268f798 | 1198 | wxPyEndBlockThreads(); |
d426c97e RD |
1199 | return rval; |
1200 | } | |
1201 | } | |
1202 | ||
1203 | ||
d5c9047a | 1204 | |
bb0054cd RD |
1205 | size_t GetChildrenCount(const wxTreeItemId& item, bool recursively = TRUE); |
1206 | ||
d5c9047a RD |
1207 | wxTreeItemId GetFirstChild(const wxTreeItemId& item, long& INOUT); |
1208 | wxTreeItemId GetNextChild(const wxTreeItemId& item, long& INOUT); | |
1209 | wxTreeItemId GetNextSibling(const wxTreeItemId& item); | |
1210 | wxTreeItemId GetPrevSibling(const wxTreeItemId& item); | |
1211 | wxTreeItemId GetFirstVisibleItem(); | |
1212 | wxTreeItemId GetNextVisible(const wxTreeItemId& item); | |
1213 | wxTreeItemId GetPrevVisible(const wxTreeItemId& item); | |
d426c97e RD |
1214 | wxTreeItemId GetLastChild(const wxTreeItemId& item); |
1215 | ||
d5c9047a RD |
1216 | |
1217 | ||
1218 | wxTreeItemId AddRoot(const wxString& text, | |
1219 | int image = -1, int selectedImage = -1, | |
cf694132 | 1220 | wxPyTreeItemData *data = NULL); |
d5c9047a RD |
1221 | wxTreeItemId PrependItem(const wxTreeItemId& parent, |
1222 | const wxString& text, | |
1223 | int image = -1, int selectedImage = -1, | |
cf694132 | 1224 | wxPyTreeItemData *data = NULL); |
d5c9047a RD |
1225 | wxTreeItemId InsertItem(const wxTreeItemId& parent, |
1226 | const wxTreeItemId& idPrevious, | |
1227 | const wxString& text, | |
1228 | int image = -1, int selectedImage = -1, | |
cf694132 | 1229 | wxPyTreeItemData *data = NULL); |
f6bcfd97 BP |
1230 | %name(InsertItemBefore) |
1231 | wxTreeItemId InsertItem(const wxTreeItemId& parent, | |
1232 | size_t before, | |
1233 | const wxString& text, | |
1234 | int image = -1, int selectedImage = -1, | |
3999941a | 1235 | wxPyTreeItemData *data = NULL); |
d5c9047a RD |
1236 | wxTreeItemId AppendItem(const wxTreeItemId& parent, |
1237 | const wxString& text, | |
1238 | int image = -1, int selectedImage = -1, | |
cf694132 | 1239 | wxPyTreeItemData *data = NULL); |
d5c9047a RD |
1240 | |
1241 | void Delete(const wxTreeItemId& item); | |
08127323 | 1242 | void DeleteChildren(const wxTreeItemId& item); |
d5c9047a RD |
1243 | void DeleteAllItems(); |
1244 | ||
1245 | void Expand(const wxTreeItemId& item); | |
1246 | void Collapse(const wxTreeItemId& item); | |
1247 | void CollapseAndReset(const wxTreeItemId& item); | |
1248 | void Toggle(const wxTreeItemId& item); | |
1249 | ||
1250 | void Unselect(); | |
8bf5d46e | 1251 | void UnselectAll(); |
d5c9047a RD |
1252 | void SelectItem(const wxTreeItemId& item); |
1253 | void EnsureVisible(const wxTreeItemId& item); | |
1254 | void ScrollTo(const wxTreeItemId& item); | |
8bf5d46e | 1255 | #ifdef __WXMSW__ |
d5c9047a | 1256 | wxTextCtrl* EditLabel(const wxTreeItemId& item); |
d5c9047a | 1257 | wxTextCtrl* GetEditControl(); |
b1462dfa | 1258 | void EndEditLabel(const wxTreeItemId& item, int discardChanges = FALSE); |
8bf5d46e RD |
1259 | #else |
1260 | void EditLabel(const wxTreeItemId& item); | |
1261 | #endif | |
d5c9047a | 1262 | |
d426c97e | 1263 | void SortChildren(const wxTreeItemId& item); |
d5c9047a | 1264 | |
b1462dfa | 1265 | void SetItemBold(const wxTreeItemId& item, int bold = TRUE); |
b8b8dda7 | 1266 | bool IsBold(const wxTreeItemId& item) const; |
164b735b | 1267 | wxTreeItemId HitTest(const wxPoint& point, int& OUTPUT); |
c127177f | 1268 | |
f6bcfd97 BP |
1269 | |
1270 | ||
b7e72427 RD |
1271 | void SetItemTextColour(const wxTreeItemId& item, const wxColour& col); |
1272 | void SetItemBackgroundColour(const wxTreeItemId& item, const wxColour& col); | |
1273 | void SetItemFont(const wxTreeItemId& item, const wxFont& font); | |
1274 | ||
4120ef2b | 1275 | #ifdef __WXMSW__ |
b1462dfa | 1276 | void SetItemDropHighlight(const wxTreeItemId& item, int highlight = TRUE); |
74bcba0e | 1277 | #endif |
b1462dfa | 1278 | |
d426c97e RD |
1279 | //bool GetBoundingRect(const wxTreeItemId& item, wxRect& rect, int textOnly = FALSE) |
1280 | %addmethods { | |
1281 | PyObject* GetBoundingRect(const wxTreeItemId& item, int textOnly = FALSE) { | |
1282 | wxRect rect; | |
164b735b | 1283 | if (self->GetBoundingRect(item, rect, textOnly)) { |
4268f798 | 1284 | wxPyBeginBlockThreads(); |
164b735b RD |
1285 | wxRect* r = new wxRect(rect); |
1286 | PyObject* val = wxPyConstructObject((void*)r, "wxRect"); | |
4268f798 | 1287 | wxPyEndBlockThreads(); |
164b735b RD |
1288 | return val; |
1289 | } | |
d426c97e RD |
1290 | else { |
1291 | Py_INCREF(Py_None); | |
1292 | return Py_None; | |
1293 | } | |
1294 | } | |
1295 | } | |
74bcba0e | 1296 | |
d426c97e | 1297 | |
c127177f | 1298 | %pragma(python) addtoclass = " |
f6bcfd97 BP |
1299 | # Redefine some methods that SWIG gets a bit confused on... |
1300 | def GetFirstChild(self, *_args, **_kwargs): | |
1301 | val1,val2 = apply(controls2c.wxTreeCtrl_GetFirstChild,(self,) + _args, _kwargs) | |
1302 | val1 = wxTreeItemIdPtr(val1) | |
1303 | val1.thisown = 1 | |
1304 | return (val1,val2) | |
1305 | def GetNextChild(self, *_args, **_kwargs): | |
1306 | val1,val2 = apply(controls2c.wxTreeCtrl_GetNextChild,(self,) + _args, _kwargs) | |
c127177f RD |
1307 | val1 = wxTreeItemIdPtr(val1) |
1308 | val1.thisown = 1 | |
1309 | return (val1,val2) | |
f6bcfd97 BP |
1310 | def HitTest(self, *_args, **_kwargs): |
1311 | val1, val2 = apply(controls2c.wxTreeCtrl_HitTest,(self,) + _args, _kwargs) | |
c127177f RD |
1312 | val1 = wxTreeItemIdPtr(val1) |
1313 | val1.thisown = 1 | |
1314 | return (val1,val2) | |
1315 | " | |
74bcba0e | 1316 | |
d5c9047a RD |
1317 | }; |
1318 | ||
d5c9047a | 1319 | |
7bf85405 RD |
1320 | //---------------------------------------------------------------------- |
1321 | ||
68320e40 RD |
1322 | |
1323 | enum { | |
1324 | wxDIRCTRL_DIR_ONLY, | |
1325 | wxDIRCTRL_SELECT_FIRST, | |
1326 | wxDIRCTRL_SHOW_FILTERS, | |
1327 | wxDIRCTRL_3D_INTERNAL, | |
1328 | }; | |
1329 | ||
1330 | ||
1331 | class wxDirItemData : public wxObject // wxTreeItemData | |
1332 | { | |
1333 | public: | |
1334 | wxDirItemData(const wxString& path, const wxString& name, bool isDir); | |
1335 | // ~wxDirItemDataEx(); | |
1336 | void SetNewDirName( wxString path ); | |
1337 | wxString m_path, m_name; | |
1338 | bool m_isHidden; | |
1339 | bool m_isExpanded; | |
1340 | bool m_isDir; | |
1341 | }; | |
1342 | ||
1343 | ||
1344 | class wxGenericDirCtrl: public wxControl | |
1345 | { | |
1346 | public: | |
1347 | wxGenericDirCtrl(wxWindow *parent, const wxWindowID id = -1, | |
137b5242 | 1348 | const wxString& dir = wxPyDirDialogDefaultFolderStr, |
68320e40 RD |
1349 | const wxPoint& pos = wxDefaultPosition, |
1350 | const wxSize& size = wxDefaultSize, | |
1351 | long style = wxDIRCTRL_3D_INTERNAL|wxSUNKEN_BORDER, | |
137b5242 | 1352 | const wxString& filter = wxPyEmptyString, |
68320e40 | 1353 | int defaultFilter = 0, |
137b5242 | 1354 | const wxString& name = wxPy_TreeCtrlNameStr); |
68320e40 RD |
1355 | %name(wxPreGenericDirCtrl)wxGenericDirCtrl(); |
1356 | ||
1357 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
1358 | %pragma(python) addtomethod = "wxPreGenericDirCtrl:val._setOORInfo(val)" | |
1359 | ||
1360 | bool Create(wxWindow *parent, const wxWindowID id = -1, | |
137b5242 | 1361 | const wxString& dir = wxPyDirDialogDefaultFolderStr, |
68320e40 RD |
1362 | const wxPoint& pos = wxDefaultPosition, |
1363 | const wxSize& size = wxDefaultSize, | |
1364 | long style = wxDIRCTRL_3D_INTERNAL|wxSUNKEN_BORDER, | |
137b5242 | 1365 | const wxString& filter = wxPyEmptyString, |
68320e40 | 1366 | int defaultFilter = 0, |
137b5242 | 1367 | const wxString& name = wxPy_TreeCtrlNameStr); |
68320e40 RD |
1368 | |
1369 | ||
1370 | // Try to expand as much of the given path as possible. | |
1371 | bool ExpandPath(const wxString& path); | |
1372 | ||
1373 | // Accessors | |
1374 | ||
1375 | inline wxString GetDefaultPath() const; | |
1376 | void SetDefaultPath(const wxString& path); | |
1377 | ||
1378 | // Get dir or filename | |
1379 | wxString GetPath() const ; | |
1380 | ||
1381 | // Get selected filename path only (else empty string). | |
1382 | // I.e. don't count a directory as a selection | |
1383 | wxString GetFilePath() const ; | |
1384 | void SetPath(const wxString& path) ; | |
1385 | ||
1386 | void ShowHidden( bool show ); | |
1387 | bool GetShowHidden(); | |
1388 | ||
1389 | wxString GetFilter() const; | |
1390 | void SetFilter(const wxString& filter); | |
1391 | ||
1392 | int GetFilterIndex() const; | |
1393 | void SetFilterIndex(int n) ; | |
1394 | ||
1395 | wxTreeItemId GetRootId(); | |
1396 | ||
1397 | wxTreeCtrl* GetTreeCtrl() const; | |
1398 | wxDirFilterListCtrl* GetFilterListCtrl() const; | |
1399 | ||
1400 | // //// Helpers | |
1401 | // void SetupSections(); | |
1402 | // // Parse the filter into an array of filters and an array of descriptions | |
1403 | // int ParseFilter(const wxString& filterStr, wxArrayString& filters, wxArrayString& descriptions); | |
1404 | // // Find the child that matches the first part of 'path'. | |
1405 | // // E.g. if a child path is "/usr" and 'path' is "/usr/include" | |
1406 | // // then the child for /usr is returned. | |
1407 | // // If the path string has been used (we're at the leaf), done is set to TRUE | |
1408 | // wxTreeItemId FindChild(wxTreeItemId parentId, const wxString& path, bool& done); | |
1409 | }; | |
1410 | ||
1411 | ||
1412 | class wxDirFilterListCtrl: public wxChoice | |
1413 | { | |
1414 | public: | |
1415 | wxDirFilterListCtrl(wxGenericDirCtrl* parent, const wxWindowID id = -1, | |
1416 | const wxPoint& pos = wxDefaultPosition, | |
1417 | const wxSize& size = wxDefaultSize, | |
1418 | long style = 0); | |
1419 | %name(wxPreDirFilterListCtrl)wxDirFilterListCtrl(); | |
1420 | ||
1421 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
1422 | %pragma(python) addtomethod = "wxPreDirFilterListCtrl:val._setOORInfo(val)" | |
1423 | ||
1424 | bool Create(wxGenericDirCtrl* parent, const wxWindowID id = -1, | |
1425 | const wxPoint& pos = wxDefaultPosition, | |
1426 | const wxSize& size = wxDefaultSize, | |
1427 | long style = 0); | |
1428 | ||
1429 | //// Operations | |
1430 | void FillFilterList(const wxString& filter, int defaultFilter); | |
1431 | }; | |
1432 | ||
1433 | ||
1434 | //---------------------------------------------------------------------- | |
1435 | //---------------------------------------------------------------------- | |
1436 | ||
9416aa89 | 1437 | %init %{ |
a3fbed81 | 1438 | // Map renamed classes back to their common name for OOR |
9416aa89 RD |
1439 | wxPyPtrTypeMap_Add("wxTreeItemData", "wxPyTreeItemData"); |
1440 | wxPyPtrTypeMap_Add("wxTreeCtrl", "wxPyTreeCtrl"); | |
a3fbed81 | 1441 | wxPyPtrTypeMap_Add("wxListCtrl", "wxPyListCtrl"); |
9416aa89 RD |
1442 | %} |
1443 | ||
1444 | //---------------------------------------------------------------------- | |
1445 | ||
7bf85405 | 1446 |