]>
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; |
7bf85405 RD |
168 | self->GetItem(*info); |
169 | return info; | |
170 | } | |
171 | %new wxPoint* GetItemPosition(long item) { | |
172 | wxPoint* pos = new wxPoint; | |
173 | self->GetItemPosition(item, *pos); | |
174 | return pos; | |
175 | } | |
176 | %new wxRect* GetItemRect(long item, int code = wxLIST_RECT_BOUNDS) { | |
177 | wxRect* rect= new wxRect; | |
178 | self->GetItemRect(item, *rect, code); | |
179 | return rect; | |
180 | } | |
181 | } | |
182 | ||
183 | int GetItemState(long item, long stateMask); | |
184 | int GetItemCount(); | |
185 | int GetItemSpacing(bool isSmall); | |
186 | wxString GetItemText(long item); | |
187 | long GetNextItem(long item, | |
188 | int geometry = wxLIST_NEXT_ALL, | |
189 | int state = wxLIST_STATE_DONTCARE); | |
190 | int GetSelectedItemCount(); | |
fb5e0af0 | 191 | #ifdef __WXMSW__ |
7bf85405 | 192 | wxColour GetTextColour(); |
4f22cf8d | 193 | void SetTextColour(const wxColour& col); |
fb5e0af0 | 194 | #endif |
7bf85405 RD |
195 | long GetTopItem(); |
196 | long HitTest(const wxPoint& point, int& OUTPUT); | |
0699c864 | 197 | %name(InsertColumnWith)long InsertColumn(long col, wxListItem& info); |
7bf85405 RD |
198 | long InsertColumn(long col, const wxString& heading, |
199 | int format = wxLIST_FORMAT_LEFT, | |
200 | int width = -1); | |
201 | ||
202 | long InsertItem(wxListItem& info); | |
203 | %name(InsertStringItem) long InsertItem(long index, const wxString& label); | |
204 | %name(InsertImageItem) long InsertItem(long index, int imageIndex); | |
205 | %name(InsertImageStringItem)long InsertItem(long index, const wxString& label, | |
206 | int imageIndex); | |
207 | ||
208 | bool ScrollList(int dx, int dy); | |
209 | void SetBackgroundColour(const wxColour& col); | |
210 | bool SetColumn(int col, wxListItem& item); | |
211 | bool SetColumnWidth(int col, int width); | |
212 | void SetImageList(wxImageList* imageList, int which); | |
af309447 | 213 | |
7bf85405 | 214 | bool SetItem(wxListItem& info); |
af309447 | 215 | %name(SetStringItem)long SetItem(long index, int col, const wxString& label, |
7bf85405 | 216 | int imageId = -1); |
af309447 | 217 | |
7bf85405 RD |
218 | bool SetItemData(long item, long data); |
219 | bool SetItemImage(long item, int image, int selImage); | |
220 | bool SetItemPosition(long item, const wxPoint& pos); | |
221 | bool SetItemState(long item, long state, long stateMask); | |
222 | void SetItemText(long item, const wxString& text); | |
223 | void SetSingleStyle(long style, bool add = TRUE); | |
7bf85405 RD |
224 | void SetWindowStyleFlag(long style); |
225 | // TODO: bool SortItems(wxListCtrlCompare fn, long data); | |
226 | }; | |
227 | ||
228 | ||
229 | ||
230 | //---------------------------------------------------------------------- | |
231 | ||
694759cf RD |
232 | enum wxTreeItemIcon |
233 | { | |
234 | wxTreeItemIcon_Normal, // not selected, not expanded | |
235 | wxTreeItemIcon_Selected, // selected, not expanded | |
236 | wxTreeItemIcon_Expanded, // not selected, expanded | |
237 | wxTreeItemIcon_SelectedExpanded, // selected, expanded | |
238 | wxTreeItemIcon_Max | |
239 | }; | |
240 | ||
7bf85405 | 241 | |
d5c9047a RD |
242 | class wxTreeItemId { |
243 | public: | |
244 | wxTreeItemId(); | |
245 | ~wxTreeItemId(); | |
bb0054cd | 246 | bool IsOk(); |
d5c9047a | 247 | |
d5c9047a RD |
248 | }; |
249 | ||
250 | ||
251 | ||
cf694132 RD |
252 | %{ |
253 | class wxPyTreeItemData : public wxTreeItemData { | |
d5c9047a | 254 | public: |
cf694132 RD |
255 | wxPyTreeItemData(PyObject* obj = NULL) { |
256 | if (obj == NULL) | |
257 | obj = Py_None; | |
258 | Py_INCREF(obj); | |
259 | m_obj = obj; | |
260 | } | |
d5c9047a | 261 | |
cf694132 | 262 | ~wxPyTreeItemData() { |
1afc06c2 | 263 | bool doSave = wxPyRestoreThread(); |
cf694132 | 264 | Py_DECREF(m_obj); |
1afc06c2 | 265 | wxPySaveThread(doSave); |
cf694132 RD |
266 | } |
267 | ||
268 | PyObject* GetData() { | |
269 | Py_INCREF(m_obj); | |
270 | return m_obj; | |
271 | } | |
272 | ||
273 | void SetData(PyObject* obj) { | |
274 | Py_DECREF(m_obj); | |
275 | m_obj = obj; | |
276 | Py_INCREF(obj); | |
277 | } | |
278 | ||
279 | PyObject* m_obj; | |
d5c9047a | 280 | }; |
cf694132 | 281 | %} |
d5c9047a RD |
282 | |
283 | ||
284 | ||
cf694132 RD |
285 | %name(wxTreeItemData) class wxPyTreeItemData { |
286 | public: | |
287 | wxPyTreeItemData(PyObject* obj = NULL); | |
288 | ||
289 | PyObject* GetData(); | |
290 | void SetData(PyObject* obj); | |
291 | ||
292 | const wxTreeItemId& GetId(); | |
293 | void SetId(const wxTreeItemId& id); | |
294 | }; | |
295 | ||
296 | ||
d5c9047a | 297 | |
8bf5d46e | 298 | class wxTreeEvent : public wxNotifyEvent { |
d5c9047a RD |
299 | public: |
300 | wxTreeItemId GetItem(); | |
301 | wxTreeItemId GetOldItem(); | |
302 | wxPoint GetPoint(); | |
303 | int GetCode(); | |
8bf5d46e | 304 | const wxString& GetLabel(); |
d5c9047a RD |
305 | }; |
306 | ||
307 | ||
308 | // These are for the GetFirstChild/GetNextChild methods below | |
309 | %typemap(python, in) long& INOUT = long* INOUT; | |
310 | %typemap(python, argout) long& INOUT = long* INOUT; | |
311 | ||
312 | ||
313 | class wxTreeCtrl : public wxControl { | |
314 | public: | |
315 | wxTreeCtrl(wxWindow *parent, wxWindowID id = -1, | |
316 | const wxPoint& pos = wxPyDefaultPosition, | |
317 | const wxSize& size = wxPyDefaultSize, | |
318 | long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT, | |
319 | const wxValidator& validator = wxPyDefaultValidator, | |
320 | char* name = "wxTreeCtrl"); | |
321 | ||
b8b8dda7 | 322 | %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" |
d5c9047a RD |
323 | |
324 | size_t GetCount(); | |
325 | unsigned int GetIndent(); | |
326 | void SetIndent(unsigned int indent); | |
327 | wxImageList *GetImageList(); | |
328 | wxImageList *GetStateImageList(); | |
694759cf | 329 | void SetImageList(wxImageList *imageList/*, int which = wxIMAGE_LIST_NORMAL*/); |
d5c9047a RD |
330 | void SetStateImageList(wxImageList *imageList); |
331 | ||
b1462dfa RD |
332 | unsigned int GetSpacing(); |
333 | void SetSpacing(unsigned int spacing); | |
334 | ||
d5c9047a | 335 | wxString GetItemText(const wxTreeItemId& item); |
694759cf RD |
336 | int GetItemImage(const wxTreeItemId& item, |
337 | wxTreeItemIcon which = wxTreeItemIcon_Normal); | |
d5c9047a | 338 | int GetItemSelectedImage(const wxTreeItemId& item); |
d5c9047a RD |
339 | |
340 | void SetItemText(const wxTreeItemId& item, const wxString& text); | |
694759cf RD |
341 | void SetItemImage(const wxTreeItemId& item, int image, |
342 | wxTreeItemIcon which = wxTreeItemIcon_Normal); | |
d5c9047a | 343 | void SetItemSelectedImage(const wxTreeItemId& item, int image); |
08127323 | 344 | void SetItemHasChildren(const wxTreeItemId& item, bool hasChildren = TRUE); |
d5c9047a | 345 | |
cf694132 RD |
346 | %addmethods { |
347 | // [Get|Set]ItemData substitutes. Automatically create wxPyTreeItemData | |
348 | // if needed. | |
349 | wxPyTreeItemData* GetItemData(const wxTreeItemId& item) { | |
350 | wxPyTreeItemData* data = (wxPyTreeItemData*)self->GetItemData(item); | |
351 | if (data == NULL) { | |
352 | data = new wxPyTreeItemData(); | |
353 | self->SetItemData(item, data); | |
354 | } | |
355 | return data; | |
356 | } | |
357 | ||
358 | void SetItemData(const wxTreeItemId& item, wxPyTreeItemData* data) { | |
359 | self->SetItemData(item, data); | |
360 | } | |
361 | ||
362 | // [Get|Set]PyData are short-cuts. Also made somewhat crash-proof by | |
363 | // automatically creating data classes. | |
364 | PyObject* GetPyData(const wxTreeItemId& item) { | |
365 | wxPyTreeItemData* data = (wxPyTreeItemData*)self->GetItemData(item); | |
366 | if (data == NULL) { | |
367 | data = new wxPyTreeItemData(); | |
368 | self->SetItemData(item, data); | |
369 | } | |
370 | return data->GetData(); | |
371 | } | |
372 | ||
373 | void SetPyData(const wxTreeItemId& item, PyObject* obj) { | |
374 | wxPyTreeItemData* data = (wxPyTreeItemData*)self->GetItemData(item); | |
375 | if (data == NULL) { | |
376 | data = new wxPyTreeItemData(obj); | |
377 | self->SetItemData(item, data); | |
378 | } else | |
379 | data->SetData(obj); | |
380 | } | |
381 | } | |
382 | ||
383 | ||
d5c9047a RD |
384 | bool IsVisible(const wxTreeItemId& item); |
385 | bool ItemHasChildren(const wxTreeItemId& item); | |
386 | bool IsExpanded(const wxTreeItemId& item); | |
387 | bool IsSelected(const wxTreeItemId& item); | |
388 | ||
389 | wxTreeItemId GetRootItem(); | |
390 | wxTreeItemId GetSelection(); | |
eb715945 | 391 | %name(GetItemParent) wxTreeItemId GetParent(const wxTreeItemId& item); |
d426c97e RD |
392 | //size_t GetSelections(wxArrayTreeItemIds& selection); |
393 | %addmethods { | |
394 | PyObject* GetSelections() { | |
395 | PyObject* rval = PyList_New(0); | |
396 | wxArrayTreeItemIds array; | |
397 | size_t num, x; | |
398 | num = self->GetSelections(array); | |
399 | for (x=0; x < num; x++) { | |
400 | PyObject* item = wxPyConstructObject((void*)&array.Item(x), | |
401 | "wxTreeItemId"); | |
402 | PyList_Append(rval, item); | |
403 | } | |
404 | return rval; | |
405 | } | |
406 | } | |
407 | ||
408 | ||
d5c9047a | 409 | |
bb0054cd RD |
410 | size_t GetChildrenCount(const wxTreeItemId& item, bool recursively = TRUE); |
411 | ||
d5c9047a RD |
412 | wxTreeItemId GetFirstChild(const wxTreeItemId& item, long& INOUT); |
413 | wxTreeItemId GetNextChild(const wxTreeItemId& item, long& INOUT); | |
414 | wxTreeItemId GetNextSibling(const wxTreeItemId& item); | |
415 | wxTreeItemId GetPrevSibling(const wxTreeItemId& item); | |
416 | wxTreeItemId GetFirstVisibleItem(); | |
417 | wxTreeItemId GetNextVisible(const wxTreeItemId& item); | |
418 | wxTreeItemId GetPrevVisible(const wxTreeItemId& item); | |
d426c97e RD |
419 | wxTreeItemId GetLastChild(const wxTreeItemId& item); |
420 | ||
d5c9047a RD |
421 | |
422 | ||
423 | wxTreeItemId AddRoot(const wxString& text, | |
424 | int image = -1, int selectedImage = -1, | |
cf694132 | 425 | wxPyTreeItemData *data = NULL); |
d5c9047a RD |
426 | wxTreeItemId PrependItem(const wxTreeItemId& parent, |
427 | const wxString& text, | |
428 | int image = -1, int selectedImage = -1, | |
cf694132 | 429 | wxPyTreeItemData *data = NULL); |
d5c9047a RD |
430 | wxTreeItemId InsertItem(const wxTreeItemId& parent, |
431 | const wxTreeItemId& idPrevious, | |
432 | const wxString& text, | |
433 | int image = -1, int selectedImage = -1, | |
cf694132 | 434 | wxPyTreeItemData *data = NULL); |
d5c9047a RD |
435 | wxTreeItemId AppendItem(const wxTreeItemId& parent, |
436 | const wxString& text, | |
437 | int image = -1, int selectedImage = -1, | |
cf694132 | 438 | wxPyTreeItemData *data = NULL); |
d5c9047a RD |
439 | |
440 | void Delete(const wxTreeItemId& item); | |
08127323 | 441 | void DeleteChildren(const wxTreeItemId& item); |
d5c9047a RD |
442 | void DeleteAllItems(); |
443 | ||
444 | void Expand(const wxTreeItemId& item); | |
445 | void Collapse(const wxTreeItemId& item); | |
446 | void CollapseAndReset(const wxTreeItemId& item); | |
447 | void Toggle(const wxTreeItemId& item); | |
448 | ||
449 | void Unselect(); | |
8bf5d46e | 450 | void UnselectAll(); |
d5c9047a RD |
451 | void SelectItem(const wxTreeItemId& item); |
452 | void EnsureVisible(const wxTreeItemId& item); | |
453 | void ScrollTo(const wxTreeItemId& item); | |
8bf5d46e | 454 | #ifdef __WXMSW__ |
d5c9047a | 455 | wxTextCtrl* EditLabel(const wxTreeItemId& item); |
d5c9047a | 456 | wxTextCtrl* GetEditControl(); |
b1462dfa | 457 | void EndEditLabel(const wxTreeItemId& item, int discardChanges = FALSE); |
8bf5d46e RD |
458 | #else |
459 | void EditLabel(const wxTreeItemId& item); | |
460 | #endif | |
d5c9047a | 461 | |
d426c97e | 462 | void SortChildren(const wxTreeItemId& item); |
d5c9047a | 463 | |
b1462dfa | 464 | void SetItemBold(const wxTreeItemId& item, int bold = TRUE); |
b8b8dda7 RD |
465 | bool IsBold(const wxTreeItemId& item) const; |
466 | wxTreeItemId HitTest(const wxPoint& point); | |
c127177f | 467 | |
4120ef2b | 468 | #ifdef __WXMSW__ |
b1462dfa RD |
469 | void SetItemDropHighlight(const wxTreeItemId& item, int highlight = TRUE); |
470 | ||
d426c97e RD |
471 | //bool GetBoundingRect(const wxTreeItemId& item, wxRect& rect, int textOnly = FALSE) |
472 | %addmethods { | |
473 | PyObject* GetBoundingRect(const wxTreeItemId& item, int textOnly = FALSE) { | |
474 | wxRect rect; | |
475 | if (self->GetBoundingRect(item, rect, textOnly)) | |
476 | return wxPyConstructObject((void*)&rect, "wxRect"); | |
477 | else { | |
478 | Py_INCREF(Py_None); | |
479 | return Py_None; | |
480 | } | |
481 | } | |
482 | } | |
761a9d2b | 483 | #endif |
d426c97e | 484 | |
c127177f RD |
485 | %pragma(python) addtoclass = " |
486 | # Redefine a couple methods that SWIG gets a bit confused on... | |
487 | def GetFirstChild(self,arg0,arg1): | |
488 | val1, val2 = controls2c.wxTreeCtrl_GetFirstChild(self.this,arg0.this,arg1) | |
489 | val1 = wxTreeItemIdPtr(val1) | |
490 | val1.thisown = 1 | |
491 | return (val1,val2) | |
492 | def GetNextChild(self,arg0,arg1): | |
bb0054cd | 493 | val1, val2 = controls2c.wxTreeCtrl_GetNextChild(self.this,arg0.this,arg1) |
c127177f RD |
494 | val1 = wxTreeItemIdPtr(val1) |
495 | val1.thisown = 1 | |
496 | return (val1,val2) | |
497 | " | |
d5c9047a RD |
498 | }; |
499 | ||
d5c9047a | 500 | |
7bf85405 RD |
501 | //---------------------------------------------------------------------- |
502 | ||
9c039d08 | 503 | #ifdef SKIPTHIS |
fb5e0af0 | 504 | #ifdef __WXMSW__ |
7bf85405 RD |
505 | class wxTabEvent : public wxCommandEvent { |
506 | public: | |
507 | }; | |
508 | ||
509 | ||
510 | ||
511 | class wxTabCtrl : public wxControl { | |
512 | public: | |
513 | wxTabCtrl(wxWindow* parent, wxWindowID id, | |
514 | const wxPoint& pos = wxPyDefaultPosition, | |
515 | const wxSize& size = wxPyDefaultSize, | |
516 | long style = 0, | |
517 | char* name = "tabCtrl"); | |
518 | ||
b8b8dda7 | 519 | %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" |
9c039d08 | 520 | |
7bf85405 RD |
521 | bool DeleteAllItems(); |
522 | bool DeleteItem(int item); | |
523 | wxImageList* GetImageList(); | |
524 | int GetItemCount(); | |
525 | // TODO: void* GetItemData(); | |
526 | int GetItemImage(int item); | |
527 | ||
528 | %addmethods { | |
529 | %new wxRect* GetItemRect(int item) { | |
530 | wxRect* rect = new wxRect; | |
531 | self->GetItemRect(item, *rect); | |
532 | return rect; | |
533 | } | |
534 | } | |
535 | ||
536 | wxString GetItemText(int item); | |
537 | bool GetRowCount(); | |
538 | int GetSelection(); | |
539 | int HitTest(const wxPoint& pt, long& OUTPUT); | |
540 | void InsertItem(int item, const wxString& text, | |
541 | int imageId = -1, void* clientData = NULL); | |
542 | // TODO: bool SetItemData(int item, void* data); | |
543 | bool SetItemImage(int item, int image); | |
544 | void SetImageList(wxImageList* imageList); | |
545 | void SetItemSize(const wxSize& size); | |
546 | bool SetItemText(int item, const wxString& text); | |
547 | void SetPadding(const wxSize& padding); | |
548 | int SetSelection(int item); | |
549 | ||
550 | }; | |
551 | ||
9c039d08 | 552 | #endif |
fb5e0af0 RD |
553 | #endif |
554 | ||
7bf85405 RD |
555 | //---------------------------------------------------------------------- |
556 | ||
557 |