]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/controls2.i
test commit, no real change
[wxWidgets.git] / wxPython / src / controls2.i
CommitLineData
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%{
42extern wxValidator wxPyDefaultValidator;
43%}
44
45//----------------------------------------------------------------------
46
af309447
RD
47enum {
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,
af309447
RD
78 wxLIST_AUTOSIZE,
79 wxLIST_AUTOSIZE_USEHEADER,
80 wxLIST_RECT_BOUNDS,
81 wxLIST_RECT_ICON,
82 wxLIST_RECT_LABEL,
83 wxLIST_FIND_UP,
84 wxLIST_FIND_DOWN,
85 wxLIST_FIND_LEFT,
86 wxLIST_FIND_RIGHT,
87};
88
89
f6bcfd97
BP
90enum wxListColumnFormat
91{
92 wxLIST_FORMAT_LEFT,
93 wxLIST_FORMAT_RIGHT,
94 wxLIST_FORMAT_CENTRE,
95 wxLIST_FORMAT_CENTER = wxLIST_FORMAT_CENTRE
96};
97
98
99class wxListItemAttr
100{
101public:
102 // ctors
103 wxListItemAttr();
104 //wxListItemAttr(const wxColour& colText,
105 // const wxColour& colBack,
106 // const wxFont& font)
107 // : m_colText(colText), m_colBack(colBack), m_font(font) { }
108
109 // setters
110 void SetTextColour(const wxColour& colText);
111 void SetBackgroundColour(const wxColour& colBack);
112 void SetFont(const wxFont& font);
113
114 // accessors
115 bool HasTextColour();
116 bool HasBackgroundColour();
117 bool HasFont();
118
119 const wxColour& GetTextColour();
120 const wxColour& GetBackgroundColour();
121 const wxFont& GetFont();
122};
123
124
7bf85405
RD
125class wxListItem {
126public:
f6bcfd97
BP
127 wxListItem();
128 ~wxListItem();
129
130 // resetting
131 void Clear();
132 void ClearAttributes();
133
134 // setters
135 void SetMask(long mask);
136 void SetId(long id);
137 void SetColumn(int col);
138 void SetState(long state);
139 void SetStateMask(long stateMask);
140 void SetText(const wxString& text);
141 void SetImage(int image);
142 void SetData(long data);
143
144 void SetWidth(int width);
145 void SetAlign(wxListColumnFormat align);
146
147 void SetTextColour(const wxColour& colText);
148 void SetBackgroundColour(const wxColour& colBack);
149 void SetFont(const wxFont& font);
150
151 // accessors
152 long GetMask();
153 long GetId();
154 int GetColumn();
155 long GetState();
156 const wxString& GetText();
157 int GetImage();
158 long GetData();
159
160 int GetWidth();
161 wxListColumnFormat GetAlign();
162
163 wxListItemAttr *GetAttributes();
164 bool HasAttributes();
165
166 wxColour GetTextColour() const;
167 wxColour GetBackgroundColour() const;
168 wxFont GetFont() const;
169
170 // these members are public for compatibility
7bf85405
RD
171 long m_mask; // Indicates what fields are valid
172 long m_itemId; // The zero-based item position
173 int m_col; // Zero-based column, if in report mode
174 long m_state; // The state of the item
f6bcfd97 175 long m_stateMask;// Which flags of m_state are valid (uses same flags)
7bf85405
RD
176 wxString m_text; // The label/header text
177 int m_image; // The zero-based index into an image list
178 long m_data; // App-defined data
7bf85405
RD
179
180 // For columns only
181 int m_format; // left, right, centre
182 int m_width; // width of column
183
7bf85405
RD
184};
185
f6bcfd97 186
c368d904 187class wxListEvent: public wxNotifyEvent {
7bf85405
RD
188public:
189 int m_code;
190 long m_itemIndex;
191 long m_oldItemIndex;
192 int m_col;
193 bool m_cancelled;
194 wxPoint m_pointDrag;
195 wxListItem m_item;
7bf85405 196
f6bcfd97
BP
197 int GetCode();
198 long GetIndex();
199 long GetOldIndex();
200 long GetOldItem();
201 int GetColumn();
202 bool Cancelled();
203 wxPoint GetPoint();
204 const wxString& GetLabel();
205 const wxString& GetText();
206 int GetImage();
207 long GetData();
208 long GetMask();
209 const wxListItem& GetItem();
210};
7bf85405
RD
211
212
213
214class wxListCtrl : public wxControl {
215public:
216 wxListCtrl(wxWindow* parent, wxWindowID id,
217 const wxPoint& pos = wxPyDefaultPosition,
218 const wxSize& size = wxPyDefaultSize,
219 long style = wxLC_ICON,
220 const wxValidator& validator = wxPyDefaultValidator,
221 char* name = "listCtrl");
222
f6bcfd97 223 %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)"
9c039d08 224
7bf85405
RD
225 bool Arrange(int flag = wxLIST_ALIGN_DEFAULT);
226 bool DeleteItem(long item);
227 bool DeleteAllItems();
228 bool DeleteColumn(int col);
229 bool DeleteAllColumns(void);
230 void ClearAll(void);
4f22cf8d 231#ifdef __WXMSW__
7bf85405
RD
232 wxTextCtrl* EditLabel(long item);
233 bool EndEditLabel(bool cancel);
4f22cf8d 234 wxTextCtrl* GetEditControl();
8bf5d46e
RD
235#else
236 void EditLabel(long item);
fb5e0af0 237#endif
7bf85405
RD
238 bool EnsureVisible(long item);
239 long FindItem(long start, const wxString& str, bool partial = FALSE);
240 %name(FindItemData)long FindItem(long start, long data);
241 %name(FindItemAtPos)long FindItem(long start, const wxPoint& pt,
242 int direction);
243 bool GetColumn(int col, wxListItem& item);
244 int GetColumnWidth(int col);
245 int GetCountPerPage();
7bf85405
RD
246 wxImageList* GetImageList(int which);
247 long GetItemData(long item);
248
249 %addmethods {
e166644c 250 %new wxListItem* GetItem(long itemId, int col=0) {
7bf85405 251 wxListItem* info = new wxListItem;
0699c864 252 info->m_itemId = itemId;
e166644c 253 info->m_col = col;
f17fee68 254 info->m_mask = 0xFFFF;
7bf85405
RD
255 self->GetItem(*info);
256 return info;
257 }
258 %new wxPoint* GetItemPosition(long item) {
259 wxPoint* pos = new wxPoint;
260 self->GetItemPosition(item, *pos);
261 return pos;
262 }
263 %new wxRect* GetItemRect(long item, int code = wxLIST_RECT_BOUNDS) {
264 wxRect* rect= new wxRect;
265 self->GetItemRect(item, *rect, code);
266 return rect;
267 }
268 }
269
270 int GetItemState(long item, long stateMask);
271 int GetItemCount();
272 int GetItemSpacing(bool isSmall);
273 wxString GetItemText(long item);
274 long GetNextItem(long item,
275 int geometry = wxLIST_NEXT_ALL,
276 int state = wxLIST_STATE_DONTCARE);
277 int GetSelectedItemCount();
fb5e0af0 278#ifdef __WXMSW__
7bf85405 279 wxColour GetTextColour();
4f22cf8d 280 void SetTextColour(const wxColour& col);
fb5e0af0 281#endif
7bf85405
RD
282 long GetTopItem();
283 long HitTest(const wxPoint& point, int& OUTPUT);
c368d904 284 %name(InsertColumnInfo)long InsertColumn(long col, wxListItem& info);
7bf85405
RD
285 long InsertColumn(long col, const wxString& heading,
286 int format = wxLIST_FORMAT_LEFT,
287 int width = -1);
288
289 long InsertItem(wxListItem& info);
290 %name(InsertStringItem) long InsertItem(long index, const wxString& label);
291 %name(InsertImageItem) long InsertItem(long index, int imageIndex);
292 %name(InsertImageStringItem)long InsertItem(long index, const wxString& label,
293 int imageIndex);
294
295 bool ScrollList(int dx, int dy);
296 void SetBackgroundColour(const wxColour& col);
297 bool SetColumn(int col, wxListItem& item);
298 bool SetColumnWidth(int col, int width);
299 void SetImageList(wxImageList* imageList, int which);
af309447 300
7bf85405 301 bool SetItem(wxListItem& info);
af309447 302 %name(SetStringItem)long SetItem(long index, int col, const wxString& label,
7bf85405 303 int imageId = -1);
af309447 304
7bf85405
RD
305 bool SetItemData(long item, long data);
306 bool SetItemImage(long item, int image, int selImage);
307 bool SetItemPosition(long item, const wxPoint& pos);
308 bool SetItemState(long item, long state, long stateMask);
309 void SetItemText(long item, const wxString& text);
310 void SetSingleStyle(long style, bool add = TRUE);
7bf85405 311 void SetWindowStyleFlag(long style);
dcd38683
RD
312
313 // bool SortItems(wxListCtrlCompare fn, long data);
314 %addmethods {
315 bool SortItems(PyObject* func) {
316 if (!PyCallable_Check(func))
317 return FALSE;
318
f6bcfd97 319 return self->SortItems(wxPyListCtrl_SortItems, (long)func);
dcd38683
RD
320 }
321 }
7bf85405
RD
322};
323
dcd38683 324%{
f6bcfd97 325 int wxCALLBACK wxPyListCtrl_SortItems(long item1, long item2, long funcPtr) {
dcd38683
RD
326 int retval = 0;
327 PyObject* func = (PyObject*)funcPtr;
328 bool doSave = wxPyRestoreThread();
7bf85405 329
dcd38683
RD
330 PyObject* args = Py_BuildValue("(ii)", item1, item2);
331 PyObject* result = PyEval_CallObject(func, args);
332 Py_DECREF(args);
333 if (result) {
334 retval = PyInt_AsLong(result);
335 Py_DECREF(result);
336 }
337
338 wxPySaveThread(doSave);
339 return retval;
340 }
341
342%}
7bf85405
RD
343
344//----------------------------------------------------------------------
345
694759cf
RD
346enum wxTreeItemIcon
347{
348 wxTreeItemIcon_Normal, // not selected, not expanded
349 wxTreeItemIcon_Selected, // selected, not expanded
350 wxTreeItemIcon_Expanded, // not selected, expanded
351 wxTreeItemIcon_SelectedExpanded, // selected, expanded
352 wxTreeItemIcon_Max
353};
354
7bf85405 355
164b735b
RD
356// constants for HitTest
357enum {
358 wxTREE_HITTEST_ABOVE,
359 wxTREE_HITTEST_BELOW,
360 wxTREE_HITTEST_NOWHERE,
361 wxTREE_HITTEST_ONITEMBUTTON,
362 wxTREE_HITTEST_ONITEMICON,
363 wxTREE_HITTEST_ONITEMINDENT,
364 wxTREE_HITTEST_ONITEMLABEL,
365 wxTREE_HITTEST_ONITEMRIGHT,
366 wxTREE_HITTEST_ONITEMSTATEICON,
367 wxTREE_HITTEST_TOLEFT,
368 wxTREE_HITTEST_TORIGHT,
369 wxTREE_HITTEST_ONITEMUPPERPART,
370 wxTREE_HITTEST_ONITEMLOWERPART,
371 wxTREE_HITTEST_ONITEM
372};
373
374
d5c9047a
RD
375class wxTreeItemId {
376public:
377 wxTreeItemId();
378 ~wxTreeItemId();
bb0054cd 379 bool IsOk();
d5c9047a 380
f6bcfd97
BP
381 %addmethods {
382 int __cmp__(wxTreeItemId* other) {
c368d904 383 if (! other) return -1;
f6bcfd97
BP
384 return *self != *other;
385 }
386 }
d5c9047a
RD
387};
388
389
390
cf694132
RD
391%{
392class wxPyTreeItemData : public wxTreeItemData {
d5c9047a 393public:
cf694132 394 wxPyTreeItemData(PyObject* obj = NULL) {
c368d904 395 if (obj == NULL)
cf694132 396 obj = Py_None;
c368d904
RD
397 Py_INCREF(obj);
398 m_obj = obj;
cf694132 399 }
d5c9047a 400
cf694132 401 ~wxPyTreeItemData() {
1afc06c2 402 bool doSave = wxPyRestoreThread();
c368d904 403 Py_DECREF(m_obj);
1afc06c2 404 wxPySaveThread(doSave);
cf694132
RD
405 }
406
407 PyObject* GetData() {
408 Py_INCREF(m_obj);
409 return m_obj;
410 }
411
412 void SetData(PyObject* obj) {
c368d904 413 bool doSave = wxPyRestoreThread();
cf694132 414 Py_DECREF(m_obj);
c368d904 415 wxPySaveThread(doSave);
cf694132
RD
416 m_obj = obj;
417 Py_INCREF(obj);
418 }
419
420 PyObject* m_obj;
d5c9047a 421};
cf694132 422%}
d5c9047a
RD
423
424
425
cf694132
RD
426%name(wxTreeItemData) class wxPyTreeItemData {
427public:
428 wxPyTreeItemData(PyObject* obj = NULL);
429
430 PyObject* GetData();
431 void SetData(PyObject* obj);
432
433 const wxTreeItemId& GetId();
434 void SetId(const wxTreeItemId& id);
435};
436
437
d5c9047a 438
8bf5d46e 439class wxTreeEvent : public wxNotifyEvent {
d5c9047a
RD
440public:
441 wxTreeItemId GetItem();
442 wxTreeItemId GetOldItem();
443 wxPoint GetPoint();
444 int GetCode();
8bf5d46e 445 const wxString& GetLabel();
d5c9047a
RD
446};
447
448
f6bcfd97
BP
449
450%{
451class wxPyTreeCtrl : public wxTreeCtrl {
452public:
453 wxPyTreeCtrl(wxWindow *parent, wxWindowID id,
454 const wxPoint& pos,
455 const wxSize& size,
456 long style,
457 const wxValidator& validator,
458 char* name) :
459 wxTreeCtrl(parent, id, pos, size, style, validator, name) {}
460
461
462 int OnCompareItems(const wxTreeItemId& item1,
463 const wxTreeItemId& item2) {
464 int rval = 0;
465 bool doSave = wxPyRestoreThread();
466 if (m_myInst.findCallback("OnCompareItems"))
467 rval = m_myInst.callCallback(Py_BuildValue(
468 "(OO)",
469 wxPyConstructObject((void*)&item1, "wxTreeItemId"),
470 wxPyConstructObject((void*)&item2, "wxTreeItemId")));
471 else
472 rval = wxTreeCtrl::OnCompareItems(item1, item2);
473 wxPySaveThread(doSave);
474 return rval;
475 }
476 PYPRIVATE;
477};
478
479%}
480
d5c9047a
RD
481// These are for the GetFirstChild/GetNextChild methods below
482%typemap(python, in) long& INOUT = long* INOUT;
483%typemap(python, argout) long& INOUT = long* INOUT;
484
485
f6bcfd97 486%name(wxTreeCtrl)class wxPyTreeCtrl : public wxControl {
d5c9047a 487public:
f6bcfd97 488 wxPyTreeCtrl(wxWindow *parent, wxWindowID id = -1,
d5c9047a
RD
489 const wxPoint& pos = wxPyDefaultPosition,
490 const wxSize& size = wxPyDefaultSize,
491 long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT,
492 const wxValidator& validator = wxPyDefaultValidator,
493 char* name = "wxTreeCtrl");
494
f6bcfd97
BP
495 void _setSelf(PyObject* self, PyObject* _class);
496 %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)"
497 %pragma(python) addtomethod = "__init__:self._setSelf(self, wxTreeCtrl)"
d5c9047a
RD
498
499 size_t GetCount();
500 unsigned int GetIndent();
501 void SetIndent(unsigned int indent);
502 wxImageList *GetImageList();
503 wxImageList *GetStateImageList();
694759cf 504 void SetImageList(wxImageList *imageList/*, int which = wxIMAGE_LIST_NORMAL*/);
d5c9047a
RD
505 void SetStateImageList(wxImageList *imageList);
506
b1462dfa
RD
507 unsigned int GetSpacing();
508 void SetSpacing(unsigned int spacing);
509
d5c9047a 510 wxString GetItemText(const wxTreeItemId& item);
694759cf
RD
511 int GetItemImage(const wxTreeItemId& item,
512 wxTreeItemIcon which = wxTreeItemIcon_Normal);
d5c9047a 513 int GetItemSelectedImage(const wxTreeItemId& item);
d5c9047a
RD
514
515 void SetItemText(const wxTreeItemId& item, const wxString& text);
694759cf
RD
516 void SetItemImage(const wxTreeItemId& item, int image,
517 wxTreeItemIcon which = wxTreeItemIcon_Normal);
d5c9047a 518 void SetItemSelectedImage(const wxTreeItemId& item, int image);
08127323 519 void SetItemHasChildren(const wxTreeItemId& item, bool hasChildren = TRUE);
d5c9047a 520
cf694132 521 %addmethods {
c368d904
RD
522 // [Get|Set]ItemData substitutes. Automatically create wxPyTreeItemData
523 // if needed.
cf694132
RD
524 wxPyTreeItemData* GetItemData(const wxTreeItemId& item) {
525 wxPyTreeItemData* data = (wxPyTreeItemData*)self->GetItemData(item);
526 if (data == NULL) {
527 data = new wxPyTreeItemData();
f6bcfd97 528 data->SetId(item); // set the id
cf694132
RD
529 self->SetItemData(item, data);
530 }
531 return data;
532 }
533
534 void SetItemData(const wxTreeItemId& item, wxPyTreeItemData* data) {
f6bcfd97
BP
535 data->SetId(item); // set the id
536 self->SetItemData(item, data);
c368d904 537 }
cf694132 538
c368d904
RD
539 // [Get|Set]PyData are short-cuts. Also made somewhat crash-proof by
540 // automatically creating data classes.
541 PyObject* GetPyData(const wxTreeItemId& item) {
cf694132
RD
542 wxPyTreeItemData* data = (wxPyTreeItemData*)self->GetItemData(item);
543 if (data == NULL) {
544 data = new wxPyTreeItemData();
f6bcfd97 545 data->SetId(item); // set the id
cf694132
RD
546 self->SetItemData(item, data);
547 }
548 return data->GetData();
c368d904 549 }
cf694132
RD
550
551 void SetPyData(const wxTreeItemId& item, PyObject* obj) {
552 wxPyTreeItemData* data = (wxPyTreeItemData*)self->GetItemData(item);
553 if (data == NULL) {
554 data = new wxPyTreeItemData(obj);
f6bcfd97 555 data->SetId(item); // set the id
cf694132
RD
556 self->SetItemData(item, data);
557 } else
558 data->SetData(obj);
c368d904 559 }
cf694132
RD
560 }
561
562
d5c9047a
RD
563 bool IsVisible(const wxTreeItemId& item);
564 bool ItemHasChildren(const wxTreeItemId& item);
565 bool IsExpanded(const wxTreeItemId& item);
566 bool IsSelected(const wxTreeItemId& item);
567
568 wxTreeItemId GetRootItem();
569 wxTreeItemId GetSelection();
eb715945 570 %name(GetItemParent) wxTreeItemId GetParent(const wxTreeItemId& item);
d426c97e
RD
571 //size_t GetSelections(wxArrayTreeItemIds& selection);
572 %addmethods {
573 PyObject* GetSelections() {
26b9cf27 574 bool doSave = wxPyRestoreThread();
d426c97e
RD
575 PyObject* rval = PyList_New(0);
576 wxArrayTreeItemIds array;
577 size_t num, x;
578 num = self->GetSelections(array);
579 for (x=0; x < num; x++) {
c368d904
RD
580 wxTreeItemId *tii = new wxTreeItemId(array.Item(x));
581 PyObject* item = wxPyConstructObject((void*)tii, "wxTreeItemId", TRUE);
d426c97e
RD
582 PyList_Append(rval, item);
583 }
26b9cf27 584 wxPySaveThread(doSave);
d426c97e
RD
585 return rval;
586 }
587 }
588
589
d5c9047a 590
bb0054cd
RD
591 size_t GetChildrenCount(const wxTreeItemId& item, bool recursively = TRUE);
592
d5c9047a
RD
593 wxTreeItemId GetFirstChild(const wxTreeItemId& item, long& INOUT);
594 wxTreeItemId GetNextChild(const wxTreeItemId& item, long& INOUT);
595 wxTreeItemId GetNextSibling(const wxTreeItemId& item);
596 wxTreeItemId GetPrevSibling(const wxTreeItemId& item);
597 wxTreeItemId GetFirstVisibleItem();
598 wxTreeItemId GetNextVisible(const wxTreeItemId& item);
599 wxTreeItemId GetPrevVisible(const wxTreeItemId& item);
d426c97e
RD
600 wxTreeItemId GetLastChild(const wxTreeItemId& item);
601
d5c9047a
RD
602
603
604 wxTreeItemId AddRoot(const wxString& text,
605 int image = -1, int selectedImage = -1,
cf694132 606 wxPyTreeItemData *data = NULL);
d5c9047a
RD
607 wxTreeItemId PrependItem(const wxTreeItemId& parent,
608 const wxString& text,
609 int image = -1, int selectedImage = -1,
cf694132 610 wxPyTreeItemData *data = NULL);
d5c9047a
RD
611 wxTreeItemId InsertItem(const wxTreeItemId& parent,
612 const wxTreeItemId& idPrevious,
613 const wxString& text,
614 int image = -1, int selectedImage = -1,
cf694132 615 wxPyTreeItemData *data = NULL);
f6bcfd97
BP
616 %name(InsertItemBefore)
617 wxTreeItemId InsertItem(const wxTreeItemId& parent,
618 size_t before,
619 const wxString& text,
620 int image = -1, int selectedImage = -1,
621 wxTreeItemData *data = NULL);
d5c9047a
RD
622 wxTreeItemId AppendItem(const wxTreeItemId& parent,
623 const wxString& text,
624 int image = -1, int selectedImage = -1,
cf694132 625 wxPyTreeItemData *data = NULL);
d5c9047a
RD
626
627 void Delete(const wxTreeItemId& item);
08127323 628 void DeleteChildren(const wxTreeItemId& item);
d5c9047a
RD
629 void DeleteAllItems();
630
631 void Expand(const wxTreeItemId& item);
632 void Collapse(const wxTreeItemId& item);
633 void CollapseAndReset(const wxTreeItemId& item);
634 void Toggle(const wxTreeItemId& item);
635
636 void Unselect();
8bf5d46e 637 void UnselectAll();
d5c9047a
RD
638 void SelectItem(const wxTreeItemId& item);
639 void EnsureVisible(const wxTreeItemId& item);
640 void ScrollTo(const wxTreeItemId& item);
8bf5d46e 641#ifdef __WXMSW__
d5c9047a 642 wxTextCtrl* EditLabel(const wxTreeItemId& item);
d5c9047a 643 wxTextCtrl* GetEditControl();
b1462dfa 644 void EndEditLabel(const wxTreeItemId& item, int discardChanges = FALSE);
8bf5d46e
RD
645#else
646 void EditLabel(const wxTreeItemId& item);
647#endif
d5c9047a 648
d426c97e 649 void SortChildren(const wxTreeItemId& item);
d5c9047a 650
b1462dfa 651 void SetItemBold(const wxTreeItemId& item, int bold = TRUE);
b8b8dda7 652 bool IsBold(const wxTreeItemId& item) const;
164b735b 653 wxTreeItemId HitTest(const wxPoint& point, int& OUTPUT);
c127177f 654
f6bcfd97
BP
655
656
b7e72427
RD
657 void SetItemTextColour(const wxTreeItemId& item, const wxColour& col);
658 void SetItemBackgroundColour(const wxTreeItemId& item, const wxColour& col);
659 void SetItemFont(const wxTreeItemId& item, const wxFont& font);
660
4120ef2b 661#ifdef __WXMSW__
b1462dfa
RD
662 void SetItemDropHighlight(const wxTreeItemId& item, int highlight = TRUE);
663
d426c97e
RD
664 //bool GetBoundingRect(const wxTreeItemId& item, wxRect& rect, int textOnly = FALSE)
665 %addmethods {
666 PyObject* GetBoundingRect(const wxTreeItemId& item, int textOnly = FALSE) {
667 wxRect rect;
164b735b
RD
668 if (self->GetBoundingRect(item, rect, textOnly)) {
669 bool doSave = wxPyRestoreThread();
670 wxRect* r = new wxRect(rect);
671 PyObject* val = wxPyConstructObject((void*)r, "wxRect");
672 wxPySaveThread(doSave);
673 return val;
674 }
d426c97e
RD
675 else {
676 Py_INCREF(Py_None);
677 return Py_None;
678 }
679 }
680 }
761a9d2b 681#endif
d426c97e 682
c127177f 683%pragma(python) addtoclass = "
f6bcfd97
BP
684 # Redefine some methods that SWIG gets a bit confused on...
685 def GetFirstChild(self, *_args, **_kwargs):
686 val1,val2 = apply(controls2c.wxTreeCtrl_GetFirstChild,(self,) + _args, _kwargs)
687 val1 = wxTreeItemIdPtr(val1)
688 val1.thisown = 1
689 return (val1,val2)
690 def GetNextChild(self, *_args, **_kwargs):
691 val1,val2 = apply(controls2c.wxTreeCtrl_GetNextChild,(self,) + _args, _kwargs)
c127177f
RD
692 val1 = wxTreeItemIdPtr(val1)
693 val1.thisown = 1
694 return (val1,val2)
f6bcfd97
BP
695 def HitTest(self, *_args, **_kwargs):
696 val1, val2 = apply(controls2c.wxTreeCtrl_HitTest,(self,) + _args, _kwargs)
c127177f
RD
697 val1 = wxTreeItemIdPtr(val1)
698 val1.thisown = 1
699 return (val1,val2)
700"
d5c9047a
RD
701};
702
d5c9047a 703
7bf85405
RD
704//----------------------------------------------------------------------
705
9c039d08 706#ifdef SKIPTHIS
fb5e0af0 707#ifdef __WXMSW__
7bf85405
RD
708class wxTabEvent : public wxCommandEvent {
709public:
710};
711
712
713
714class wxTabCtrl : public wxControl {
715public:
716 wxTabCtrl(wxWindow* parent, wxWindowID id,
717 const wxPoint& pos = wxPyDefaultPosition,
718 const wxSize& size = wxPyDefaultSize,
719 long style = 0,
720 char* name = "tabCtrl");
721
f6bcfd97 722 %pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)"
9c039d08 723
7bf85405
RD
724 bool DeleteAllItems();
725 bool DeleteItem(int item);
726 wxImageList* GetImageList();
727 int GetItemCount();
728 // TODO: void* GetItemData();
729 int GetItemImage(int item);
730
731 %addmethods {
732 %new wxRect* GetItemRect(int item) {
733 wxRect* rect = new wxRect;
734 self->GetItemRect(item, *rect);
735 return rect;
736 }
737 }
738
739 wxString GetItemText(int item);
740 bool GetRowCount();
741 int GetSelection();
742 int HitTest(const wxPoint& pt, long& OUTPUT);
743 void InsertItem(int item, const wxString& text,
744 int imageId = -1, void* clientData = NULL);
745 // TODO: bool SetItemData(int item, void* data);
746 bool SetItemImage(int item, int image);
747 void SetImageList(wxImageList* imageList);
748 void SetItemSize(const wxSize& size);
749 bool SetItemText(int item, const wxString& text);
750 void SetPadding(const wxSize& padding);
751 int SetSelection(int item);
752
753};
754
9c039d08 755#endif
fb5e0af0
RD
756#endif
757
7bf85405
RD
758//----------------------------------------------------------------------
759
760