]>
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> | |
7bf85405 RD |
22 | %} |
23 | ||
24 | //---------------------------------------------------------------------- | |
25 | ||
26 | %include typemaps.i | |
27 | %include my_typemaps.i | |
28 | ||
29 | // Import some definitions of other classes, etc. | |
30 | %import _defs.i | |
31 | %import misc.i | |
32 | %import windows.i | |
33 | %import gdi.i | |
34 | %import events.i | |
35 | %import controls.i | |
36 | ||
b8b8dda7 | 37 | %pragma(python) code = "import wx" |
9c039d08 | 38 | |
7bf85405 RD |
39 | //---------------------------------------------------------------------- |
40 | ||
41 | %{ | |
42 | extern wxValidator wxPyDefaultValidator; | |
43 | %} | |
44 | ||
45 | //---------------------------------------------------------------------- | |
46 | ||
af309447 RD |
47 | enum { |
48 | wxLIST_MASK_TEXT, | |
49 | wxLIST_MASK_IMAGE, | |
50 | wxLIST_MASK_DATA, | |
51 | wxLIST_MASK_WIDTH, | |
52 | wxLIST_MASK_FORMAT, | |
bb0054cd | 53 | wxLIST_MASK_STATE, |
af309447 RD |
54 | wxLIST_STATE_DONTCARE, |
55 | wxLIST_STATE_DROPHILITED, | |
56 | wxLIST_STATE_FOCUSED, | |
57 | wxLIST_STATE_SELECTED, | |
58 | wxLIST_STATE_CUT, | |
59 | wxLIST_HITTEST_ABOVE, | |
60 | wxLIST_HITTEST_BELOW, | |
61 | wxLIST_HITTEST_NOWHERE, | |
62 | wxLIST_HITTEST_ONITEMICON, | |
63 | wxLIST_HITTEST_ONITEMLABEL, | |
64 | wxLIST_HITTEST_ONITEMRIGHT, | |
65 | wxLIST_HITTEST_ONITEMSTATEICON, | |
66 | wxLIST_HITTEST_TOLEFT, | |
67 | wxLIST_HITTEST_TORIGHT, | |
68 | wxLIST_HITTEST_ONITEM, | |
69 | wxLIST_NEXT_ABOVE, | |
70 | wxLIST_NEXT_ALL, | |
71 | wxLIST_NEXT_BELOW, | |
72 | wxLIST_NEXT_LEFT, | |
73 | wxLIST_NEXT_RIGHT, | |
74 | wxLIST_ALIGN_DEFAULT, | |
75 | wxLIST_ALIGN_LEFT, | |
76 | wxLIST_ALIGN_TOP, | |
77 | wxLIST_ALIGN_SNAP_TO_GRID, | |
78 | wxLIST_FORMAT_LEFT, | |
79 | wxLIST_FORMAT_RIGHT, | |
80 | wxLIST_FORMAT_CENTRE, | |
81 | wxLIST_FORMAT_CENTER, | |
82 | wxLIST_AUTOSIZE, | |
83 | wxLIST_AUTOSIZE_USEHEADER, | |
84 | wxLIST_RECT_BOUNDS, | |
85 | wxLIST_RECT_ICON, | |
86 | wxLIST_RECT_LABEL, | |
87 | wxLIST_FIND_UP, | |
88 | wxLIST_FIND_DOWN, | |
89 | wxLIST_FIND_LEFT, | |
90 | wxLIST_FIND_RIGHT, | |
91 | }; | |
92 | ||
93 | ||
7bf85405 RD |
94 | class wxListItem { |
95 | public: | |
96 | long m_mask; // Indicates what fields are valid | |
97 | long m_itemId; // The zero-based item position | |
98 | int m_col; // Zero-based column, if in report mode | |
99 | long m_state; // The state of the item | |
100 | long m_stateMask; // Which flags of m_state are valid (uses same flags) | |
101 | wxString m_text; // The label/header text | |
102 | int m_image; // The zero-based index into an image list | |
103 | long m_data; // App-defined data | |
104 | // wxColour *m_colour; // only wxGLC, not supported by Windows ;-> | |
105 | ||
106 | // For columns only | |
107 | int m_format; // left, right, centre | |
108 | int m_width; // width of column | |
109 | ||
110 | wxListItem(); | |
111 | ~wxListItem(); | |
112 | }; | |
113 | ||
114 | class wxListEvent: public wxCommandEvent { | |
115 | public: | |
116 | int m_code; | |
117 | long m_itemIndex; | |
118 | long m_oldItemIndex; | |
119 | int m_col; | |
120 | bool m_cancelled; | |
121 | wxPoint m_pointDrag; | |
122 | wxListItem m_item; | |
123 | }; | |
124 | ||
125 | ||
126 | ||
127 | ||
128 | class wxListCtrl : public wxControl { | |
129 | public: | |
130 | wxListCtrl(wxWindow* parent, wxWindowID id, | |
131 | const wxPoint& pos = wxPyDefaultPosition, | |
132 | const wxSize& size = wxPyDefaultSize, | |
133 | long style = wxLC_ICON, | |
134 | const wxValidator& validator = wxPyDefaultValidator, | |
135 | char* name = "listCtrl"); | |
136 | ||
b8b8dda7 | 137 | %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" |
9c039d08 | 138 | |
7bf85405 RD |
139 | bool Arrange(int flag = wxLIST_ALIGN_DEFAULT); |
140 | bool DeleteItem(long item); | |
141 | bool DeleteAllItems(); | |
142 | bool DeleteColumn(int col); | |
143 | bool DeleteAllColumns(void); | |
144 | void ClearAll(void); | |
4f22cf8d | 145 | #ifdef __WXMSW__ |
7bf85405 RD |
146 | wxTextCtrl* EditLabel(long item); |
147 | bool EndEditLabel(bool cancel); | |
4f22cf8d | 148 | wxTextCtrl* GetEditControl(); |
8bf5d46e RD |
149 | #else |
150 | void EditLabel(long item); | |
fb5e0af0 | 151 | #endif |
7bf85405 RD |
152 | bool EnsureVisible(long item); |
153 | long FindItem(long start, const wxString& str, bool partial = FALSE); | |
154 | %name(FindItemData)long FindItem(long start, long data); | |
155 | %name(FindItemAtPos)long FindItem(long start, const wxPoint& pt, | |
156 | int direction); | |
157 | bool GetColumn(int col, wxListItem& item); | |
158 | int GetColumnWidth(int col); | |
159 | int GetCountPerPage(); | |
7bf85405 RD |
160 | wxImageList* GetImageList(int which); |
161 | long GetItemData(long item); | |
162 | ||
163 | %addmethods { | |
e166644c | 164 | %new wxListItem* GetItem(long itemId, int col=0) { |
7bf85405 | 165 | wxListItem* info = new wxListItem; |
0699c864 | 166 | info->m_itemId = itemId; |
e166644c | 167 | info->m_col = col; |
f17fee68 | 168 | info->m_mask = 0xFFFF; |
7bf85405 RD |
169 | self->GetItem(*info); |
170 | return info; | |
171 | } | |
172 | %new wxPoint* GetItemPosition(long item) { | |
173 | wxPoint* pos = new wxPoint; | |
174 | self->GetItemPosition(item, *pos); | |
175 | return pos; | |
176 | } | |
177 | %new wxRect* GetItemRect(long item, int code = wxLIST_RECT_BOUNDS) { | |
178 | wxRect* rect= new wxRect; | |
179 | self->GetItemRect(item, *rect, code); | |
180 | return rect; | |
181 | } | |
182 | } | |
183 | ||
184 | int GetItemState(long item, long stateMask); | |
185 | int GetItemCount(); | |
186 | int GetItemSpacing(bool isSmall); | |
187 | wxString GetItemText(long item); | |
188 | long GetNextItem(long item, | |
189 | int geometry = wxLIST_NEXT_ALL, | |
190 | int state = wxLIST_STATE_DONTCARE); | |
191 | int GetSelectedItemCount(); | |
fb5e0af0 | 192 | #ifdef __WXMSW__ |
7bf85405 | 193 | wxColour GetTextColour(); |
4f22cf8d | 194 | void SetTextColour(const wxColour& col); |
fb5e0af0 | 195 | #endif |
7bf85405 RD |
196 | long GetTopItem(); |
197 | long HitTest(const wxPoint& point, int& OUTPUT); | |
0699c864 | 198 | %name(InsertColumnWith)long InsertColumn(long col, wxListItem& info); |
7bf85405 RD |
199 | long InsertColumn(long col, const wxString& heading, |
200 | int format = wxLIST_FORMAT_LEFT, | |
201 | int width = -1); | |
202 | ||
203 | long InsertItem(wxListItem& info); | |
204 | %name(InsertStringItem) long InsertItem(long index, const wxString& label); | |
205 | %name(InsertImageItem) long InsertItem(long index, int imageIndex); | |
206 | %name(InsertImageStringItem)long InsertItem(long index, const wxString& label, | |
207 | int imageIndex); | |
208 | ||
209 | bool ScrollList(int dx, int dy); | |
210 | void SetBackgroundColour(const wxColour& col); | |
211 | bool SetColumn(int col, wxListItem& item); | |
212 | bool SetColumnWidth(int col, int width); | |
213 | void SetImageList(wxImageList* imageList, int which); | |
af309447 | 214 | |
7bf85405 | 215 | bool SetItem(wxListItem& info); |
af309447 | 216 | %name(SetStringItem)long SetItem(long index, int col, const wxString& label, |
7bf85405 | 217 | int imageId = -1); |
af309447 | 218 | |
7bf85405 RD |
219 | bool SetItemData(long item, long data); |
220 | bool SetItemImage(long item, int image, int selImage); | |
221 | bool SetItemPosition(long item, const wxPoint& pos); | |
222 | bool SetItemState(long item, long state, long stateMask); | |
223 | void SetItemText(long item, const wxString& text); | |
224 | void SetSingleStyle(long style, bool add = TRUE); | |
7bf85405 | 225 | void SetWindowStyleFlag(long style); |
dcd38683 RD |
226 | |
227 | // bool SortItems(wxListCtrlCompare fn, long data); | |
228 | %addmethods { | |
229 | bool SortItems(PyObject* func) { | |
230 | if (!PyCallable_Check(func)) | |
231 | return FALSE; | |
232 | ||
233 | return self->SortItems(wxPyTreeCtrl_SortItems, (long)func); | |
234 | } | |
235 | } | |
7bf85405 RD |
236 | }; |
237 | ||
dcd38683 RD |
238 | %{ |
239 | int wxCALLBACK wxPyTreeCtrl_SortItems(long item1, long item2, long funcPtr) { | |
240 | int retval = 0; | |
241 | PyObject* func = (PyObject*)funcPtr; | |
242 | bool doSave = wxPyRestoreThread(); | |
7bf85405 | 243 | |
dcd38683 RD |
244 | PyObject* args = Py_BuildValue("(ii)", item1, item2); |
245 | PyObject* result = PyEval_CallObject(func, args); | |
246 | Py_DECREF(args); | |
247 | if (result) { | |
248 | retval = PyInt_AsLong(result); | |
249 | Py_DECREF(result); | |
250 | } | |
251 | ||
252 | wxPySaveThread(doSave); | |
253 | return retval; | |
254 | } | |
255 | ||
256 | %} | |
7bf85405 RD |
257 | |
258 | //---------------------------------------------------------------------- | |
259 | ||
694759cf RD |
260 | enum wxTreeItemIcon |
261 | { | |
262 | wxTreeItemIcon_Normal, // not selected, not expanded | |
263 | wxTreeItemIcon_Selected, // selected, not expanded | |
264 | wxTreeItemIcon_Expanded, // not selected, expanded | |
265 | wxTreeItemIcon_SelectedExpanded, // selected, expanded | |
266 | wxTreeItemIcon_Max | |
267 | }; | |
268 | ||
7bf85405 | 269 | |
164b735b RD |
270 | // constants for HitTest |
271 | enum { | |
272 | wxTREE_HITTEST_ABOVE, | |
273 | wxTREE_HITTEST_BELOW, | |
274 | wxTREE_HITTEST_NOWHERE, | |
275 | wxTREE_HITTEST_ONITEMBUTTON, | |
276 | wxTREE_HITTEST_ONITEMICON, | |
277 | wxTREE_HITTEST_ONITEMINDENT, | |
278 | wxTREE_HITTEST_ONITEMLABEL, | |
279 | wxTREE_HITTEST_ONITEMRIGHT, | |
280 | wxTREE_HITTEST_ONITEMSTATEICON, | |
281 | wxTREE_HITTEST_TOLEFT, | |
282 | wxTREE_HITTEST_TORIGHT, | |
283 | wxTREE_HITTEST_ONITEMUPPERPART, | |
284 | wxTREE_HITTEST_ONITEMLOWERPART, | |
285 | wxTREE_HITTEST_ONITEM | |
286 | }; | |
287 | ||
288 | ||
d5c9047a RD |
289 | class wxTreeItemId { |
290 | public: | |
291 | wxTreeItemId(); | |
292 | ~wxTreeItemId(); | |
bb0054cd | 293 | bool IsOk(); |
d5c9047a | 294 | |
d5c9047a RD |
295 | }; |
296 | ||
297 | ||
298 | ||
cf694132 RD |
299 | %{ |
300 | class wxPyTreeItemData : public wxTreeItemData { | |
d5c9047a | 301 | public: |
cf694132 RD |
302 | wxPyTreeItemData(PyObject* obj = NULL) { |
303 | if (obj == NULL) | |
304 | obj = Py_None; | |
305 | Py_INCREF(obj); | |
306 | m_obj = obj; | |
307 | } | |
d5c9047a | 308 | |
cf694132 | 309 | ~wxPyTreeItemData() { |
1afc06c2 | 310 | bool doSave = wxPyRestoreThread(); |
cf694132 | 311 | Py_DECREF(m_obj); |
1afc06c2 | 312 | wxPySaveThread(doSave); |
cf694132 RD |
313 | } |
314 | ||
315 | PyObject* GetData() { | |
316 | Py_INCREF(m_obj); | |
317 | return m_obj; | |
318 | } | |
319 | ||
320 | void SetData(PyObject* obj) { | |
321 | Py_DECREF(m_obj); | |
322 | m_obj = obj; | |
323 | Py_INCREF(obj); | |
324 | } | |
325 | ||
326 | PyObject* m_obj; | |
d5c9047a | 327 | }; |
cf694132 | 328 | %} |
d5c9047a RD |
329 | |
330 | ||
331 | ||
cf694132 RD |
332 | %name(wxTreeItemData) class wxPyTreeItemData { |
333 | public: | |
334 | wxPyTreeItemData(PyObject* obj = NULL); | |
335 | ||
336 | PyObject* GetData(); | |
337 | void SetData(PyObject* obj); | |
338 | ||
339 | const wxTreeItemId& GetId(); | |
340 | void SetId(const wxTreeItemId& id); | |
341 | }; | |
342 | ||
343 | ||
d5c9047a | 344 | |
8bf5d46e | 345 | class wxTreeEvent : public wxNotifyEvent { |
d5c9047a RD |
346 | public: |
347 | wxTreeItemId GetItem(); | |
348 | wxTreeItemId GetOldItem(); | |
349 | wxPoint GetPoint(); | |
350 | int GetCode(); | |
8bf5d46e | 351 | const wxString& GetLabel(); |
d5c9047a RD |
352 | }; |
353 | ||
354 | ||
355 | // These are for the GetFirstChild/GetNextChild methods below | |
356 | %typemap(python, in) long& INOUT = long* INOUT; | |
357 | %typemap(python, argout) long& INOUT = long* INOUT; | |
358 | ||
359 | ||
360 | class wxTreeCtrl : public wxControl { | |
361 | public: | |
362 | wxTreeCtrl(wxWindow *parent, wxWindowID id = -1, | |
363 | const wxPoint& pos = wxPyDefaultPosition, | |
364 | const wxSize& size = wxPyDefaultSize, | |
365 | long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT, | |
366 | const wxValidator& validator = wxPyDefaultValidator, | |
367 | char* name = "wxTreeCtrl"); | |
368 | ||
b8b8dda7 | 369 | %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" |
d5c9047a RD |
370 | |
371 | size_t GetCount(); | |
372 | unsigned int GetIndent(); | |
373 | void SetIndent(unsigned int indent); | |
374 | wxImageList *GetImageList(); | |
375 | wxImageList *GetStateImageList(); | |
694759cf | 376 | void SetImageList(wxImageList *imageList/*, int which = wxIMAGE_LIST_NORMAL*/); |
d5c9047a RD |
377 | void SetStateImageList(wxImageList *imageList); |
378 | ||
b1462dfa RD |
379 | unsigned int GetSpacing(); |
380 | void SetSpacing(unsigned int spacing); | |
381 | ||
d5c9047a | 382 | wxString GetItemText(const wxTreeItemId& item); |
694759cf RD |
383 | int GetItemImage(const wxTreeItemId& item, |
384 | wxTreeItemIcon which = wxTreeItemIcon_Normal); | |
d5c9047a | 385 | int GetItemSelectedImage(const wxTreeItemId& item); |
d5c9047a RD |
386 | |
387 | void SetItemText(const wxTreeItemId& item, const wxString& text); | |
694759cf RD |
388 | void SetItemImage(const wxTreeItemId& item, int image, |
389 | wxTreeItemIcon which = wxTreeItemIcon_Normal); | |
d5c9047a | 390 | void SetItemSelectedImage(const wxTreeItemId& item, int image); |
08127323 | 391 | void SetItemHasChildren(const wxTreeItemId& item, bool hasChildren = TRUE); |
d5c9047a | 392 | |
cf694132 RD |
393 | %addmethods { |
394 | // [Get|Set]ItemData substitutes. Automatically create wxPyTreeItemData | |
395 | // if needed. | |
396 | wxPyTreeItemData* GetItemData(const wxTreeItemId& item) { | |
397 | wxPyTreeItemData* data = (wxPyTreeItemData*)self->GetItemData(item); | |
398 | if (data == NULL) { | |
399 | data = new wxPyTreeItemData(); | |
400 | self->SetItemData(item, data); | |
401 | } | |
402 | return data; | |
403 | } | |
404 | ||
405 | void SetItemData(const wxTreeItemId& item, wxPyTreeItemData* data) { | |
406 | self->SetItemData(item, data); | |
407 | } | |
408 | ||
409 | // [Get|Set]PyData are short-cuts. Also made somewhat crash-proof by | |
410 | // automatically creating data classes. | |
411 | PyObject* GetPyData(const wxTreeItemId& item) { | |
412 | wxPyTreeItemData* data = (wxPyTreeItemData*)self->GetItemData(item); | |
413 | if (data == NULL) { | |
414 | data = new wxPyTreeItemData(); | |
415 | self->SetItemData(item, data); | |
416 | } | |
417 | return data->GetData(); | |
418 | } | |
419 | ||
420 | void SetPyData(const wxTreeItemId& item, PyObject* obj) { | |
421 | wxPyTreeItemData* data = (wxPyTreeItemData*)self->GetItemData(item); | |
422 | if (data == NULL) { | |
423 | data = new wxPyTreeItemData(obj); | |
424 | self->SetItemData(item, data); | |
425 | } else | |
426 | data->SetData(obj); | |
427 | } | |
428 | } | |
429 | ||
430 | ||
d5c9047a RD |
431 | bool IsVisible(const wxTreeItemId& item); |
432 | bool ItemHasChildren(const wxTreeItemId& item); | |
433 | bool IsExpanded(const wxTreeItemId& item); | |
434 | bool IsSelected(const wxTreeItemId& item); | |
435 | ||
436 | wxTreeItemId GetRootItem(); | |
437 | wxTreeItemId GetSelection(); | |
eb715945 | 438 | %name(GetItemParent) wxTreeItemId GetParent(const wxTreeItemId& item); |
d426c97e RD |
439 | //size_t GetSelections(wxArrayTreeItemIds& selection); |
440 | %addmethods { | |
441 | PyObject* GetSelections() { | |
26b9cf27 | 442 | bool doSave = wxPyRestoreThread(); |
d426c97e RD |
443 | PyObject* rval = PyList_New(0); |
444 | wxArrayTreeItemIds array; | |
445 | size_t num, x; | |
446 | num = self->GetSelections(array); | |
447 | for (x=0; x < num; x++) { | |
448 | PyObject* item = wxPyConstructObject((void*)&array.Item(x), | |
449 | "wxTreeItemId"); | |
450 | PyList_Append(rval, item); | |
451 | } | |
26b9cf27 | 452 | wxPySaveThread(doSave); |
d426c97e RD |
453 | return rval; |
454 | } | |
455 | } | |
456 | ||
457 | ||
d5c9047a | 458 | |
bb0054cd RD |
459 | size_t GetChildrenCount(const wxTreeItemId& item, bool recursively = TRUE); |
460 | ||
d5c9047a RD |
461 | wxTreeItemId GetFirstChild(const wxTreeItemId& item, long& INOUT); |
462 | wxTreeItemId GetNextChild(const wxTreeItemId& item, long& INOUT); | |
463 | wxTreeItemId GetNextSibling(const wxTreeItemId& item); | |
464 | wxTreeItemId GetPrevSibling(const wxTreeItemId& item); | |
465 | wxTreeItemId GetFirstVisibleItem(); | |
466 | wxTreeItemId GetNextVisible(const wxTreeItemId& item); | |
467 | wxTreeItemId GetPrevVisible(const wxTreeItemId& item); | |
d426c97e RD |
468 | wxTreeItemId GetLastChild(const wxTreeItemId& item); |
469 | ||
d5c9047a RD |
470 | |
471 | ||
472 | wxTreeItemId AddRoot(const wxString& text, | |
473 | int image = -1, int selectedImage = -1, | |
cf694132 | 474 | wxPyTreeItemData *data = NULL); |
d5c9047a RD |
475 | wxTreeItemId PrependItem(const wxTreeItemId& parent, |
476 | const wxString& text, | |
477 | int image = -1, int selectedImage = -1, | |
cf694132 | 478 | wxPyTreeItemData *data = NULL); |
d5c9047a RD |
479 | wxTreeItemId InsertItem(const wxTreeItemId& parent, |
480 | const wxTreeItemId& idPrevious, | |
481 | const wxString& text, | |
482 | int image = -1, int selectedImage = -1, | |
cf694132 | 483 | wxPyTreeItemData *data = NULL); |
d5c9047a RD |
484 | wxTreeItemId AppendItem(const wxTreeItemId& parent, |
485 | const wxString& text, | |
486 | int image = -1, int selectedImage = -1, | |
cf694132 | 487 | wxPyTreeItemData *data = NULL); |
d5c9047a RD |
488 | |
489 | void Delete(const wxTreeItemId& item); | |
08127323 | 490 | void DeleteChildren(const wxTreeItemId& item); |
d5c9047a RD |
491 | void DeleteAllItems(); |
492 | ||
493 | void Expand(const wxTreeItemId& item); | |
494 | void Collapse(const wxTreeItemId& item); | |
495 | void CollapseAndReset(const wxTreeItemId& item); | |
496 | void Toggle(const wxTreeItemId& item); | |
497 | ||
498 | void Unselect(); | |
8bf5d46e | 499 | void UnselectAll(); |
d5c9047a RD |
500 | void SelectItem(const wxTreeItemId& item); |
501 | void EnsureVisible(const wxTreeItemId& item); | |
502 | void ScrollTo(const wxTreeItemId& item); | |
8bf5d46e | 503 | #ifdef __WXMSW__ |
d5c9047a | 504 | wxTextCtrl* EditLabel(const wxTreeItemId& item); |
d5c9047a | 505 | wxTextCtrl* GetEditControl(); |
b1462dfa | 506 | void EndEditLabel(const wxTreeItemId& item, int discardChanges = FALSE); |
8bf5d46e RD |
507 | #else |
508 | void EditLabel(const wxTreeItemId& item); | |
509 | #endif | |
d5c9047a | 510 | |
d426c97e | 511 | void SortChildren(const wxTreeItemId& item); |
d5c9047a | 512 | |
b1462dfa | 513 | void SetItemBold(const wxTreeItemId& item, int bold = TRUE); |
b8b8dda7 | 514 | bool IsBold(const wxTreeItemId& item) const; |
164b735b | 515 | wxTreeItemId HitTest(const wxPoint& point, int& OUTPUT); |
c127177f | 516 | |
b7e72427 RD |
517 | void SetItemTextColour(const wxTreeItemId& item, const wxColour& col); |
518 | void SetItemBackgroundColour(const wxTreeItemId& item, const wxColour& col); | |
519 | void SetItemFont(const wxTreeItemId& item, const wxFont& font); | |
520 | ||
4120ef2b | 521 | #ifdef __WXMSW__ |
b1462dfa RD |
522 | void SetItemDropHighlight(const wxTreeItemId& item, int highlight = TRUE); |
523 | ||
d426c97e RD |
524 | //bool GetBoundingRect(const wxTreeItemId& item, wxRect& rect, int textOnly = FALSE) |
525 | %addmethods { | |
526 | PyObject* GetBoundingRect(const wxTreeItemId& item, int textOnly = FALSE) { | |
527 | wxRect rect; | |
164b735b RD |
528 | if (self->GetBoundingRect(item, rect, textOnly)) { |
529 | bool doSave = wxPyRestoreThread(); | |
530 | wxRect* r = new wxRect(rect); | |
531 | PyObject* val = wxPyConstructObject((void*)r, "wxRect"); | |
532 | wxPySaveThread(doSave); | |
533 | return val; | |
534 | } | |
d426c97e RD |
535 | else { |
536 | Py_INCREF(Py_None); | |
537 | return Py_None; | |
538 | } | |
539 | } | |
540 | } | |
761a9d2b | 541 | #endif |
d426c97e | 542 | |
c127177f RD |
543 | %pragma(python) addtoclass = " |
544 | # Redefine a couple methods that SWIG gets a bit confused on... | |
545 | def GetFirstChild(self,arg0,arg1): | |
546 | val1, val2 = controls2c.wxTreeCtrl_GetFirstChild(self.this,arg0.this,arg1) | |
547 | val1 = wxTreeItemIdPtr(val1) | |
548 | val1.thisown = 1 | |
549 | return (val1,val2) | |
550 | def GetNextChild(self,arg0,arg1): | |
bb0054cd | 551 | val1, val2 = controls2c.wxTreeCtrl_GetNextChild(self.this,arg0.this,arg1) |
c127177f RD |
552 | val1 = wxTreeItemIdPtr(val1) |
553 | val1.thisown = 1 | |
554 | return (val1,val2) | |
555 | " | |
d5c9047a RD |
556 | }; |
557 | ||
d5c9047a | 558 | |
7bf85405 RD |
559 | //---------------------------------------------------------------------- |
560 | ||
9c039d08 | 561 | #ifdef SKIPTHIS |
fb5e0af0 | 562 | #ifdef __WXMSW__ |
7bf85405 RD |
563 | class wxTabEvent : public wxCommandEvent { |
564 | public: | |
565 | }; | |
566 | ||
567 | ||
568 | ||
569 | class wxTabCtrl : public wxControl { | |
570 | public: | |
571 | wxTabCtrl(wxWindow* parent, wxWindowID id, | |
572 | const wxPoint& pos = wxPyDefaultPosition, | |
573 | const wxSize& size = wxPyDefaultSize, | |
574 | long style = 0, | |
575 | char* name = "tabCtrl"); | |
576 | ||
b8b8dda7 | 577 | %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" |
9c039d08 | 578 | |
7bf85405 RD |
579 | bool DeleteAllItems(); |
580 | bool DeleteItem(int item); | |
581 | wxImageList* GetImageList(); | |
582 | int GetItemCount(); | |
583 | // TODO: void* GetItemData(); | |
584 | int GetItemImage(int item); | |
585 | ||
586 | %addmethods { | |
587 | %new wxRect* GetItemRect(int item) { | |
588 | wxRect* rect = new wxRect; | |
589 | self->GetItemRect(item, *rect); | |
590 | return rect; | |
591 | } | |
592 | } | |
593 | ||
594 | wxString GetItemText(int item); | |
595 | bool GetRowCount(); | |
596 | int GetSelection(); | |
597 | int HitTest(const wxPoint& pt, long& OUTPUT); | |
598 | void InsertItem(int item, const wxString& text, | |
599 | int imageId = -1, void* clientData = NULL); | |
600 | // TODO: bool SetItemData(int item, void* data); | |
601 | bool SetItemImage(int item, int image); | |
602 | void SetImageList(wxImageList* imageList); | |
603 | void SetItemSize(const wxSize& size); | |
604 | bool SetItemText(int item, const wxString& text); | |
605 | void SetPadding(const wxSize& padding); | |
606 | int SetSelection(int item); | |
607 | ||
608 | }; | |
609 | ||
9c039d08 | 610 | #endif |
fb5e0af0 RD |
611 | #endif |
612 | ||
7bf85405 RD |
613 | //---------------------------------------------------------------------- |
614 | ||
615 |