]>
Commit | Line | Data |
---|---|---|
ebf4302c RD |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: gizmos.i | |
3 | // Purpose: Wrappers for the "gizmo" classes in wx/contrib | |
4 | // | |
5 | // Author: Robin Dunn | |
6 | // | |
7 | // Created: 23-Nov-2001 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 2001 by Total Control Software | |
10 | // Licence: wxWindows license | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
c8fac2b6 RD |
13 | %define DOCSTRING |
14 | "Various *gizmo* classes: `DynamicSashWindow`, `EditableListBox`, | |
15 | `LEDNumberCtrl`, `TreeListCtrl`, etc." | |
16 | %enddef | |
17 | ||
b2eb030f | 18 | %module(package="wx", docstring=DOCSTRING) gizmos |
ebf4302c RD |
19 | |
20 | ||
21 | %{ | |
d14a1e28 RD |
22 | #include "wx/wxPython/wxPython.h" |
23 | #include "wx/wxPython/pyclasses.h" | |
28eab81f | 24 | |
611dc22c RD |
25 | #include <wx/gizmos/dynamicsash.h> |
26 | #include <wx/gizmos/editlbox.h> | |
27 | #include <wx/gizmos/splittree.h> | |
950e7faf | 28 | #include <wx/gizmos/ledctrl.h> |
7e4b7f9a | 29 | #include <wx/gizmos/statpict.h> |
1fded56b | 30 | |
7c379a20 | 31 | #include <wx/listctrl.h> |
1fded56b RD |
32 | #include <wx/treectrl.h> |
33 | #include <wx/imaglist.h> | |
28eab81f RD |
34 | |
35 | #include "wx/treelistctrl.h" | |
d14a1e28 | 36 | #include "wx/wxPython/pytree.h" |
ebf4302c | 37 | |
137b5242 RD |
38 | %} |
39 | ||
d14a1e28 RD |
40 | //--------------------------------------------------------------------------- |
41 | ||
42 | %import windows.i | |
43 | %import controls.i | |
648d396c RD |
44 | %pythoncode { import wx } |
45 | %pythoncode { __docfilter__ = wx._core.__DocFilter(globals()) } | |
d14a1e28 | 46 | |
b2dc1044 | 47 | |
089142a5 RD |
48 | MAKE_CONST_WXSTRING2(DynamicSashNameStr, wxT("dynamicSashWindow")); |
49 | MAKE_CONST_WXSTRING2(EditableListBoxNameStr, wxT("editableListBox")); | |
50 | MAKE_CONST_WXSTRING2(TreeListCtrlNameStr, wxT("treelistctrl")); | |
d3397f6a | 51 | MAKE_CONST_WXSTRING(StaticPictureNameStr); |
7e4b7f9a | 52 | |
b2dc1044 RD |
53 | MAKE_CONST_WXSTRING_NOSWIG(EmptyString); |
54 | ||
55 | ||
d14a1e28 RD |
56 | %include _gizmos_rename.i |
57 | ||
58 | //--------------------------------------------------------------------------- | |
137b5242 | 59 | |
ebf4302c | 60 | enum { |
ebf4302c RD |
61 | wxDS_MANAGE_SCROLLBARS, |
62 | wxDS_DRAG_CORNER, | |
63 | }; | |
64 | ||
6c56259a RD |
65 | %constant wxEventType wxEVT_DYNAMIC_SASH_SPLIT; |
66 | %constant wxEventType wxEVT_DYNAMIC_SASH_UNIFY; | |
67 | ||
ebf4302c RD |
68 | |
69 | /* | |
70 | wxDynamicSashSplitEvents are sent to your view by wxDynamicSashWindow | |
71 | whenever your view is being split by the user. It is your | |
72 | responsibility to handle this event by creating a new view window as | |
73 | a child of the wxDynamicSashWindow. wxDynamicSashWindow will | |
74 | automatically reparent it to the proper place in its window hierarchy. | |
75 | */ | |
76 | class wxDynamicSashSplitEvent : public wxCommandEvent { | |
77 | public: | |
78 | wxDynamicSashSplitEvent(wxObject *target); | |
79 | }; | |
80 | ||
81 | ||
82 | /* | |
83 | wxDynamicSashUnifyEvents are sent to your view by wxDynamicSashWindow | |
84 | whenever the sash which splits your view and its sibling is being | |
85 | reunified such that your view is expanding to replace its sibling. | |
86 | You needn't do anything with this event if you are allowing | |
87 | wxDynamicSashWindow to manage your view's scrollbars, but it is useful | |
88 | if you are managing the scrollbars yourself so that you can keep | |
89 | the scrollbars' event handlers connected to your view's event handler | |
90 | class. | |
91 | */ | |
92 | class wxDynamicSashUnifyEvent : public wxCommandEvent { | |
93 | public: | |
94 | wxDynamicSashUnifyEvent(wxObject *target); | |
95 | }; | |
96 | ||
97 | ||
98 | ||
99 | /* | |
100 | ||
101 | wxDynamicSashWindow | |
102 | ||
103 | wxDynamicSashWindow widgets manages the way other widgets are viewed. | |
104 | When a wxDynamicSashWindow is first shown, it will contain one child | |
105 | view, a viewport for that child, and a pair of scrollbars to allow the | |
106 | user to navigate the child view area. Next to each scrollbar is a small | |
107 | tab. By clicking on either tab and dragging to the appropriate spot, a | |
108 | user can split the view area into two smaller views separated by a | |
109 | draggable sash. Later, when the user wishes to reunify the two subviews, | |
110 | the user simply drags the sash to the side of the window. | |
111 | wxDynamicSashWindow will automatically reparent the appropriate child | |
112 | view back up the window hierarchy, and the wxDynamicSashWindow will have | |
113 | only one child view once again. | |
114 | ||
115 | As an application developer, you will simply create a wxDynamicSashWindow | |
116 | using either the Create() function or the more complex constructor | |
611dc22c | 117 | provided below, and then create a view window whose parent is the |
ebf4302c RD |
118 | wxDynamicSashWindow. The child should respond to |
119 | wxDynamicSashSplitEvents -- perhaps with an OnSplit() event handler -- by | |
120 | constructing a new view window whose parent is also the | |
121 | wxDynamicSashWindow. That's it! Now your users can dynamically split | |
122 | and reunify the view you provided. | |
123 | ||
124 | If you wish to handle the scrollbar events for your view, rather than | |
125 | allowing wxDynamicSashWindow to do it for you, things are a bit more | |
126 | complex. (You might want to handle scrollbar events yourself, if, | |
127 | for instance, you wish to scroll a subwindow of the view you add to | |
128 | your wxDynamicSashWindow object, rather than scrolling the whole view.) | |
611dc22c | 129 | In this case, you will need to construct your wxDynamicSashWindow without |
ebf4302c RD |
130 | the wxDS_MANAGE_SCROLLBARS style and you will need to use the |
131 | GetHScrollBar() and GetVScrollBar() methods to retrieve the scrollbar | |
132 | controls and call SetEventHanler() on them to redirect the scrolling | |
133 | events whenever your window is reparented by wxDyanmicSashWindow. | |
134 | You will need to set the scrollbars' event handler at three times: | |
135 | ||
136 | * When your view is created | |
137 | * When your view receives a wxDynamicSashSplitEvent | |
138 | * When your view receives a wxDynamicSashUnifyEvent | |
139 | ||
140 | See the dynsash_switch sample application for an example which does this. | |
141 | ||
142 | */ | |
143 | ||
ab1f7d2a RD |
144 | MustHaveApp(wxDynamicSashWindow); |
145 | ||
ebf4302c RD |
146 | class wxDynamicSashWindow : public wxWindow { |
147 | public: | |
2b9048c5 RD |
148 | %pythonAppend wxDynamicSashWindow "self._setOORInfo(self)" |
149 | %pythonAppend wxDynamicSashWindow() "" | |
d14a1e28 | 150 | |
d5573410 | 151 | wxDynamicSashWindow(wxWindow *parent, wxWindowID id=-1, |
ebf4302c RD |
152 | const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, |
153 | long style = wxCLIP_CHILDREN | wxDS_MANAGE_SCROLLBARS | wxDS_DRAG_CORNER, | |
137b5242 | 154 | const wxString& name = wxPyDynamicSashNameStr); |
1b8c7ba6 | 155 | %RenameCtor(PreDynamicSashWindow, wxDynamicSashWindow()); |
ebf4302c | 156 | |
d5573410 | 157 | bool Create(wxWindow *parent, wxWindowID id=-1, |
ebf4302c RD |
158 | const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, |
159 | long style = wxCLIP_CHILDREN | wxDS_MANAGE_SCROLLBARS | wxDS_DRAG_CORNER, | |
137b5242 | 160 | const wxString& name = wxPyDynamicSashNameStr); |
ebf4302c | 161 | |
ebf4302c RD |
162 | wxScrollBar *GetHScrollBar(const wxWindow *child) const; |
163 | wxScrollBar *GetVScrollBar(const wxWindow *child) const; | |
164 | }; | |
165 | ||
166 | ||
167 | ||
d14a1e28 RD |
168 | %pythoncode { |
169 | EVT_DYNAMIC_SASH_SPLIT = wx.PyEventBinder( wxEVT_DYNAMIC_SASH_SPLIT, 1 ) | |
170 | EVT_DYNAMIC_SASH_UNIFY = wx.PyEventBinder( wxEVT_DYNAMIC_SASH_UNIFY, 1 ) | |
171 | } | |
ebf4302c | 172 | |
d14a1e28 RD |
173 | //--------------------------------------------------------------------------- |
174 | //--------------------------------------------------------------------------- | |
7b7ac0ab | 175 | |
6187ec8f RD |
176 | enum { |
177 | wxEL_ALLOW_NEW, | |
178 | wxEL_ALLOW_EDIT, | |
179 | wxEL_ALLOW_DELETE, | |
180 | }; | |
7b7ac0ab RD |
181 | |
182 | // This class provides a composite control that lets the | |
183 | // user easily enter list of strings | |
ab1f7d2a | 184 | MustHaveApp(wxEditableListBox); |
7b7ac0ab RD |
185 | class wxEditableListBox : public wxPanel |
186 | { | |
187 | public: | |
2b9048c5 RD |
188 | %pythonAppend wxEditableListBox "self._setOORInfo(self)" |
189 | %pythonAppend wxEditableListBox() "" | |
d14a1e28 | 190 | |
d5573410 RD |
191 | wxEditableListBox(wxWindow *parent, wxWindowID id=-1, |
192 | const wxString& label = wxPyEmptyString, | |
7b7ac0ab RD |
193 | const wxPoint& pos = wxDefaultPosition, |
194 | const wxSize& size = wxDefaultSize, | |
6187ec8f | 195 | long style = wxEL_ALLOW_NEW | wxEL_ALLOW_EDIT | wxEL_ALLOW_DELETE, |
137b5242 | 196 | const wxString& name = wxPyEditableListBoxNameStr); |
7b7ac0ab | 197 | |
611dc22c | 198 | |
7b7ac0ab RD |
199 | void SetStrings(const wxArrayString& strings); |
200 | ||
201 | //void GetStrings(wxArrayString& strings); | |
d14a1e28 | 202 | %extend { |
7b7ac0ab RD |
203 | PyObject* GetStrings() { |
204 | wxArrayString strings; | |
205 | self->GetStrings(strings); | |
206 | return wxArrayString2PyList_helper(strings); | |
207 | } | |
208 | } | |
366d7bd6 | 209 | |
15f80007 | 210 | wxPyListCtrl* GetListCtrl(); |
d14a1e28 RD |
211 | wxBitmapButton* GetDelButton(); |
212 | wxBitmapButton* GetNewButton(); | |
213 | wxBitmapButton* GetUpButton(); | |
214 | wxBitmapButton* GetDownButton(); | |
215 | wxBitmapButton* GetEditButton(); | |
7b7ac0ab RD |
216 | }; |
217 | ||
218 | ||
219 | ||
d14a1e28 | 220 | //--------------------------------------------------------------------------- |
611dc22c RD |
221 | |
222 | ||
223 | /* | |
224 | * wxRemotelyScrolledTreeCtrl | |
225 | * | |
226 | * This tree control disables its vertical scrollbar and catches scroll | |
227 | * events passed by a scrolled window higher in the hierarchy. | |
228 | * It also updates the scrolled window vertical scrollbar as appropriate. | |
229 | */ | |
230 | ||
231 | %{ | |
232 | typedef wxTreeCtrl wxPyTreeCtrl; | |
233 | %} | |
234 | ||
ab1f7d2a RD |
235 | MustHaveApp(wxRemotelyScrolledTreeCtrl); |
236 | ||
611dc22c RD |
237 | class wxRemotelyScrolledTreeCtrl: public wxPyTreeCtrl |
238 | { | |
239 | public: | |
2b9048c5 RD |
240 | %pythonAppend wxRemotelyScrolledTreeCtrl "self._setOORInfo(self)" |
241 | %pythonAppend wxRemotelyScrolledTreeCtrl() "" | |
d14a1e28 | 242 | |
611dc22c RD |
243 | wxRemotelyScrolledTreeCtrl(wxWindow* parent, wxWindowID id, |
244 | const wxPoint& pos = wxDefaultPosition, | |
245 | const wxSize& size = wxDefaultSize, | |
246 | long style = wxTR_HAS_BUTTONS); | |
611dc22c RD |
247 | |
248 | ||
249 | void HideVScrollbar(); | |
250 | ||
251 | // Adjust the containing wxScrolledWindow's scrollbars appropriately | |
252 | void AdjustRemoteScrollbars(); | |
253 | ||
254 | // Find the scrolled window that contains this control | |
255 | wxScrolledWindow* GetScrolledWindow() const; | |
256 | ||
257 | // Scroll to the given line (in scroll units where each unit is | |
258 | // the height of an item) | |
259 | void ScrollToLine(int posHoriz, int posVert); | |
260 | ||
261 | // The companion window is one which will get notified when certain | |
262 | // events happen such as node expansion | |
263 | void SetCompanionWindow(wxWindow* companion); | |
264 | wxWindow* GetCompanionWindow() const; | |
265 | }; | |
266 | ||
267 | ||
268 | ||
269 | /* | |
270 | * wxTreeCompanionWindow | |
271 | * | |
272 | * A window displaying values associated with tree control items. | |
273 | */ | |
274 | ||
275 | %{ | |
276 | class wxPyTreeCompanionWindow: public wxTreeCompanionWindow | |
277 | { | |
278 | public: | |
279 | wxPyTreeCompanionWindow(wxWindow* parent, wxWindowID id = -1, | |
280 | const wxPoint& pos = wxDefaultPosition, | |
281 | const wxSize& size = wxDefaultSize, | |
282 | long style = 0) | |
283 | : wxTreeCompanionWindow(parent, id, pos, size, style) {} | |
284 | ||
285 | ||
286 | virtual void DrawItem(wxDC& dc, wxTreeItemId id, const wxRect& rect) { | |
287 | bool found; | |
6e6b3557 | 288 | wxPyBlock_t blocked = wxPyBeginBlockThreads(); |
611dc22c | 289 | if ((found = wxPyCBH_findCallback(m_myInst, "DrawItem"))) { |
6d450e1a | 290 | PyObject* dcobj = wxPyMake_wxObject(&dc,false); |
a72f4631 RD |
291 | PyObject* idobj = wxPyConstructObject((void*)&id, wxT("wxTreeItemId"), false); |
292 | PyObject* recobj= wxPyConstructObject((void*)&rect, wxT("wxRect"), false); | |
611dc22c RD |
293 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOO)", dcobj, idobj, recobj)); |
294 | Py_DECREF(dcobj); | |
295 | Py_DECREF(idobj); | |
296 | Py_DECREF(recobj); | |
297 | } | |
da32eb53 | 298 | wxPyEndBlockThreads(blocked); |
611dc22c RD |
299 | if (! found) |
300 | wxTreeCompanionWindow::DrawItem(dc, id, rect); | |
301 | } | |
302 | ||
303 | PYPRIVATE; | |
304 | }; | |
305 | %} | |
306 | ||
307 | ||
ab1f7d2a RD |
308 | MustHaveApp(wxPyTreeCompanionWindow); |
309 | ||
1b8c7ba6 RD |
310 | %rename(TreeCompanionWindow) wxPyTreeCompanionWindow; |
311 | class wxPyTreeCompanionWindow: public wxWindow | |
611dc22c RD |
312 | { |
313 | public: | |
2b9048c5 RD |
314 | %pythonAppend wxPyTreeCompanionWindow "self._setOORInfo(self);self._setCallbackInfo(self, TreeCompanionWindow)" |
315 | %pythonAppend wxPyTreeCompanionWindow() "" | |
d14a1e28 | 316 | |
611dc22c RD |
317 | wxPyTreeCompanionWindow(wxWindow* parent, wxWindowID id = -1, |
318 | const wxPoint& pos = wxDefaultPosition, | |
319 | const wxSize& size = wxDefaultSize, | |
320 | long style = 0); | |
321 | void _setCallbackInfo(PyObject* self, PyObject* _class); | |
611dc22c RD |
322 | |
323 | wxRemotelyScrolledTreeCtrl* GetTreeCtrl() const; | |
324 | void SetTreeCtrl(wxRemotelyScrolledTreeCtrl* treeCtrl); | |
325 | }; | |
326 | ||
327 | ||
328 | ||
329 | /* | |
330 | * wxThinSplitterWindow | |
331 | * | |
332 | * Implements a splitter with a less obvious sash | |
333 | * than the usual one. | |
334 | */ | |
335 | ||
ab1f7d2a RD |
336 | MustHaveApp(wxThinSplitterWindow); |
337 | ||
611dc22c RD |
338 | class wxThinSplitterWindow: public wxSplitterWindow |
339 | { | |
340 | public: | |
2b9048c5 RD |
341 | %pythonAppend wxThinSplitterWindow "self._setOORInfo(self)" |
342 | %pythonAppend wxThinSplitterWindow() "" | |
d14a1e28 | 343 | |
611dc22c RD |
344 | wxThinSplitterWindow(wxWindow* parent, wxWindowID id = -1, |
345 | const wxPoint& pos = wxDefaultPosition, | |
346 | const wxSize& size = wxDefaultSize, | |
347 | long style = wxSP_3D | wxCLIP_CHILDREN); | |
611dc22c RD |
348 | }; |
349 | ||
350 | ||
d14a1e28 | 351 | |
611dc22c RD |
352 | /* |
353 | * wxSplitterScrolledWindow | |
354 | * | |
355 | * This scrolled window is aware of the fact that one of its | |
356 | * children is a splitter window. It passes on its scroll events | |
357 | * (after some processing) to both splitter children for them | |
358 | * scroll appropriately. | |
359 | */ | |
360 | ||
ab1f7d2a RD |
361 | MustHaveApp(wxSplitterScrolledWindow); |
362 | ||
611dc22c RD |
363 | class wxSplitterScrolledWindow: public wxScrolledWindow |
364 | { | |
365 | public: | |
2b9048c5 RD |
366 | %pythonAppend wxSplitterScrolledWindow "self._setOORInfo(self)" |
367 | %pythonAppend wxSplitterScrolledWindow() "" | |
d14a1e28 | 368 | |
611dc22c RD |
369 | wxSplitterScrolledWindow(wxWindow* parent, wxWindowID id = -1, |
370 | const wxPoint& pos = wxDefaultPosition, | |
371 | const wxSize& size = wxDefaultSize, | |
372 | long style = 0); | |
611dc22c RD |
373 | }; |
374 | ||
375 | ||
d14a1e28 RD |
376 | //--------------------------------------------------------------------------- |
377 | //--------------------------------------------------------------------------- | |
950e7faf RD |
378 | |
379 | ||
380 | enum wxLEDValueAlign | |
381 | { | |
382 | wxLED_ALIGN_LEFT, | |
383 | wxLED_ALIGN_RIGHT, | |
384 | wxLED_ALIGN_CENTER, | |
385 | ||
386 | wxLED_ALIGN_MASK, | |
387 | ||
388 | wxLED_DRAW_FADED, | |
389 | }; | |
390 | ||
391 | ||
ab1f7d2a RD |
392 | MustHaveApp(wxLEDNumberCtrl); |
393 | ||
950e7faf RD |
394 | class wxLEDNumberCtrl : public wxControl |
395 | { | |
396 | public: | |
2b9048c5 RD |
397 | %pythonAppend wxLEDNumberCtrl "self._setOORInfo(self)" |
398 | %pythonAppend wxLEDNumberCtrl() "" | |
d14a1e28 | 399 | |
950e7faf RD |
400 | wxLEDNumberCtrl(wxWindow *parent, wxWindowID id = -1, |
401 | const wxPoint& pos = wxDefaultPosition, | |
402 | const wxSize& size = wxDefaultSize, | |
403 | long style = wxLED_ALIGN_LEFT | wxLED_DRAW_FADED); | |
1b8c7ba6 | 404 | %RenameCtor(PreLEDNumberCtrl, wxLEDNumberCtrl()); |
950e7faf | 405 | |
950e7faf RD |
406 | bool Create(wxWindow *parent, wxWindowID id = -1, |
407 | const wxPoint& pos = wxDefaultPosition, | |
408 | const wxSize& size = wxDefaultSize, | |
409 | long style = wxLED_ALIGN_LEFT | wxLED_DRAW_FADED); | |
410 | ||
d14a1e28 RD |
411 | wxLEDValueAlign GetAlignment() const; |
412 | bool GetDrawFaded() const; | |
413 | const wxString &GetValue() const; | |
950e7faf RD |
414 | |
415 | void SetAlignment(wxLEDValueAlign Alignment, bool Redraw = true); | |
416 | void SetDrawFaded(bool DrawFaded, bool Redraw = true); | |
417 | void SetValue(const wxString &Value, bool Redraw = true); | |
418 | ||
419 | }; | |
420 | ||
1fded56b RD |
421 | |
422 | ||
423 | //---------------------------------------------------------------------------- | |
424 | // wxTreeListCtrl - the multicolumn tree control | |
425 | //---------------------------------------------------------------------------- | |
426 | ||
427 | enum wxTreeListColumnAlign { | |
428 | wxTL_ALIGN_LEFT, | |
429 | wxTL_ALIGN_RIGHT, | |
430 | wxTL_ALIGN_CENTER | |
431 | }; | |
432 | ||
433 | ||
434 | ||
435 | enum { | |
436 | wxTREE_HITTEST_ONITEMCOLUMN | |
437 | }; | |
438 | ||
439 | ||
28eab81f RD |
440 | enum { |
441 | // flags for FindItem | |
442 | wxTL_SEARCH_VISIBLE, | |
443 | wxTL_SEARCH_LEVEL, | |
444 | wxTL_SEARCH_FULL, | |
445 | wxTL_SEARCH_PARTIAL, | |
446 | wxTL_SEARCH_NOCASE | |
447 | }; | |
448 | ||
648d396c RD |
449 | enum { |
450 | // extra tree styles | |
451 | wxTR_DONT_ADJUST_MAC | |
452 | }; | |
453 | %pythoncode { wx.TR_DONT_ADJUST_MAC = TR_DONT_ADJUST_MAC } | |
1fded56b RD |
454 | |
455 | ||
456 | class wxTreeListColumnInfo: public wxObject { | |
457 | public: | |
458 | wxTreeListColumnInfo(const wxString& text = wxPyEmptyString, | |
459 | int image = -1, | |
460 | size_t width = 100, | |
a72f4631 | 461 | bool shown = true, |
1fded56b RD |
462 | wxTreeListColumnAlign alignment = wxTL_ALIGN_LEFT); |
463 | ||
7f80dd64 RD |
464 | ~wxTreeListColumnInfo(); |
465 | ||
28eab81f | 466 | bool GetShown() const; |
1fded56b RD |
467 | wxTreeListColumnAlign GetAlignment() const; |
468 | wxString GetText() const; | |
469 | int GetImage() const; | |
470 | int GetSelectedImage() const; | |
471 | size_t GetWidth() const; | |
472 | ||
28eab81f RD |
473 | // TODO: These all actually return wxTreeListColumnInfo&, any problem with doing it for Python too? |
474 | void SetShown(bool shown); | |
1fded56b RD |
475 | void SetAlignment(wxTreeListColumnAlign alignment); |
476 | void SetText(const wxString& text); | |
477 | void SetImage(int image); | |
478 | void SetSelectedImage(int image); | |
479 | void SetWidth(size_t with); | |
480 | }; | |
481 | ||
482 | ||
483 | ||
484 | ||
485 | %{ // C++ version of Python aware control | |
486 | class wxPyTreeListCtrl : public wxTreeListCtrl { | |
487 | DECLARE_ABSTRACT_CLASS(wxPyTreeListCtrl); | |
488 | public: | |
489 | wxPyTreeListCtrl() : wxTreeListCtrl() {} | |
490 | wxPyTreeListCtrl(wxWindow *parent, wxWindowID id, | |
491 | const wxPoint& pos, | |
492 | const wxSize& size, | |
493 | long style, | |
494 | const wxValidator &validator, | |
495 | const wxString& name) : | |
496 | wxTreeListCtrl(parent, id, pos, size, style, validator, name) {} | |
497 | ||
498 | int OnCompareItems(const wxTreeItemId& item1, | |
499 | const wxTreeItemId& item2) { | |
500 | int rval = 0; | |
501 | bool found; | |
6e6b3557 | 502 | wxPyBlock_t blocked = wxPyBeginBlockThreads(); |
1fded56b RD |
503 | if ((found = wxPyCBH_findCallback(m_myInst, "OnCompareItems"))) { |
504 | PyObject *o1 = wxPyConstructObject((void*)&item1, wxT("wxTreeItemId"), 0); | |
505 | PyObject *o2 = wxPyConstructObject((void*)&item2, wxT("wxTreeItemId"), 0); | |
506 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)",o1,o2)); | |
507 | Py_DECREF(o1); | |
508 | Py_DECREF(o2); | |
509 | } | |
da32eb53 | 510 | wxPyEndBlockThreads(blocked); |
1fded56b RD |
511 | if (! found) |
512 | rval = wxTreeListCtrl::OnCompareItems(item1, item2); | |
513 | return rval; | |
514 | } | |
515 | PYPRIVATE; | |
516 | }; | |
517 | ||
518 | IMPLEMENT_ABSTRACT_CLASS(wxPyTreeListCtrl, wxTreeListCtrl) | |
519 | ||
520 | %} | |
521 | ||
522 | ||
523 | ||
524 | ||
1fded56b RD |
525 | |
526 | ||
ab1f7d2a RD |
527 | MustHaveApp(wxPyTreeListCtrl); |
528 | ||
1b8c7ba6 RD |
529 | %rename(TreeListCtrl) wxPyTreeListCtrl; |
530 | class wxPyTreeListCtrl : public wxControl | |
1fded56b RD |
531 | { |
532 | public: | |
2b9048c5 RD |
533 | %pythonAppend wxPyTreeListCtrl "self._setOORInfo(self);self._setCallbackInfo(self, TreeListCtrl)" |
534 | %pythonAppend wxPyTreeListCtrl() "" | |
d14a1e28 | 535 | |
1fded56b RD |
536 | wxPyTreeListCtrl(wxWindow *parent, wxWindowID id = -1, |
537 | const wxPoint& pos = wxDefaultPosition, | |
538 | const wxSize& size = wxDefaultSize, | |
539 | long style = wxTR_DEFAULT_STYLE, | |
540 | const wxValidator &validator = wxDefaultValidator, | |
541 | const wxString& name = wxPyTreeListCtrlNameStr ); | |
1b8c7ba6 | 542 | %RenameCtor(PreTreeListCtrl, wxPyTreeListCtrl()); |
1fded56b RD |
543 | |
544 | bool Create(wxWindow *parent, wxWindowID id = -1, | |
545 | const wxPoint& pos = wxDefaultPosition, | |
546 | const wxSize& size = wxDefaultSize, | |
547 | long style = wxTR_DEFAULT_STYLE, | |
548 | const wxValidator &validator = wxDefaultValidator, | |
549 | const wxString& name = wxPyTreeListCtrlNameStr ); | |
550 | ||
551 | void _setCallbackInfo(PyObject* self, PyObject* _class); | |
1fded56b | 552 | |
28eab81f | 553 | |
1fded56b RD |
554 | // get the total number of items in the control |
555 | size_t GetCount() const; | |
556 | ||
557 | // indent is the number of pixels the children are indented relative to | |
558 | // the parents position. SetIndent() also redraws the control | |
559 | // immediately. | |
560 | unsigned int GetIndent() const; | |
561 | void SetIndent(unsigned int indent); | |
562 | ||
1fded56b RD |
563 | // line spacing is the space above and below the text on each line |
564 | unsigned int GetLineSpacing() const; | |
565 | void SetLineSpacing(unsigned int spacing); | |
566 | ||
567 | // image list: these functions allow to associate an image list with | |
568 | // the control and retrieve it. Note that when assigned with | |
569 | // SetImageList, the control does _not_ delete | |
570 | // the associated image list when it's deleted in order to allow image | |
571 | // lists to be shared between different controls. If you use | |
572 | // AssignImageList, the control _does_ delete the image list. | |
573 | // | |
574 | // The normal image list is for the icons which correspond to the | |
575 | // normal tree item state (whether it is selected or not). | |
576 | // Additionally, the application might choose to show a state icon | |
577 | // which corresponds to an app-defined item state (for example, | |
578 | // checked/unchecked) which are taken from the state image list. | |
579 | wxImageList *GetImageList() const; | |
580 | wxImageList *GetStateImageList() const; | |
581 | wxImageList *GetButtonsImageList() const; | |
582 | ||
583 | void SetImageList(wxImageList *imageList); | |
584 | void SetStateImageList(wxImageList *imageList); | |
585 | void SetButtonsImageList(wxImageList *imageList); | |
15d9a04c | 586 | |
214c4fbe | 587 | %disownarg( wxImageList *imageList ); |
1fded56b RD |
588 | void AssignImageList(wxImageList *imageList); |
589 | void AssignStateImageList(wxImageList *imageList); | |
590 | void AssignButtonsImageList(wxImageList *imageList); | |
214c4fbe | 591 | %cleardisown( wxImageList *imageList ); |
1fded56b RD |
592 | |
593 | ||
594 | // adds a column | |
595 | void AddColumn(const wxString& text); | |
28eab81f RD |
596 | // void AddColumn(const wxString& text, |
597 | // size_t width, | |
598 | // wxTreeListColumnAlign alignment = wxTL_ALIGN_LEFT); | |
1b8c7ba6 | 599 | %Rename(AddColumnInfo, void, AddColumn(const wxTreeListColumnInfo& col)); |
1fded56b RD |
600 | |
601 | // inserts a column before the given one | |
602 | void InsertColumn(size_t before, const wxString& text); | |
1b8c7ba6 | 603 | %Rename(InsertColumnInfo, void, InsertColumn(size_t before, const wxTreeListColumnInfo& col)); |
1fded56b RD |
604 | |
605 | // deletes the given column - does not delete the corresponding column | |
606 | // of each item | |
607 | void RemoveColumn(size_t column); | |
608 | ||
609 | // returns the number of columns in the ctrl | |
610 | size_t GetColumnCount() const; | |
611 | ||
612 | void SetColumnWidth(size_t column, size_t width); | |
613 | int GetColumnWidth(size_t column) const; | |
614 | ||
615 | // tells which column is the "main" one, i.e. the "threaded" one | |
616 | void SetMainColumn(size_t column); | |
617 | size_t GetMainColumn() const; | |
618 | ||
619 | void SetColumnText(size_t column, const wxString& text); | |
620 | wxString GetColumnText(size_t column) const; | |
621 | ||
622 | void SetColumn(size_t column, const wxTreeListColumnInfo& info); | |
623 | wxTreeListColumnInfo& GetColumn(size_t column); | |
624 | ||
625 | // other column-related methods | |
626 | void SetColumnAlignment(size_t column, wxTreeListColumnAlign align); | |
627 | wxTreeListColumnAlign GetColumnAlignment(size_t column) const; | |
628 | ||
629 | void SetColumnImage(size_t column, int image); | |
630 | int GetColumnImage(size_t column) const; | |
631 | ||
28eab81f RD |
632 | void ShowColumn(size_t column, bool shown); |
633 | bool IsColumnShown(size_t column) const; | |
1fded56b | 634 | |
d14a1e28 | 635 | %extend { |
1fded56b RD |
636 | // retrieves item's label of the given column (main column by default) |
637 | wxString GetItemText(const wxTreeItemId& item, int column = -1) { | |
638 | if (column < 0) column = self->GetMainColumn(); | |
639 | return self->GetItemText(item, column); | |
640 | } | |
641 | ||
642 | // get one of the images associated with the item (normal by default) | |
643 | int GetItemImage(const wxTreeItemId& item, int column = -1, | |
644 | wxTreeItemIcon which = wxTreeItemIcon_Normal) { | |
645 | if (column < 0) column = self->GetMainColumn(); | |
646 | return self->GetItemImage(item, column, which); | |
647 | } | |
648 | ||
649 | // set item's label (main column by default) | |
650 | void SetItemText(const wxTreeItemId& item, const wxString& text, int column = -1) { | |
651 | if (column < 0) column = self->GetMainColumn(); | |
652 | self->SetItemText(item, column, text); | |
653 | } | |
654 | ||
655 | // set one of the images associated with the item (normal by default) | |
656 | // the which parameter is ignored for all columns but the main one | |
657 | void SetItemImage(const wxTreeItemId& item, int image, int column = -1, | |
658 | wxTreeItemIcon which = wxTreeItemIcon_Normal) { | |
659 | if (column < 0) column = self->GetMainColumn(); | |
660 | self->SetItemImage(item, column, image, which); | |
661 | } | |
662 | ||
663 | ||
664 | // [Get|Set]ItemData substitutes. Automatically create wxPyTreeItemData | |
665 | // if needed. | |
666 | wxPyTreeItemData* GetItemData(const wxTreeItemId& item) { | |
667 | wxPyTreeItemData* data = (wxPyTreeItemData*)self->GetItemData(item); | |
668 | if (data == NULL) { | |
669 | data = new wxPyTreeItemData(); | |
670 | data->SetId(item); // set the id | |
671 | self->SetItemData(item, data); | |
672 | } | |
673 | return data; | |
674 | } | |
675 | ||
7f80dd64 | 676 | %disownarg( wxPyTreeItemData* data ); |
1fded56b RD |
677 | void SetItemData(const wxTreeItemId& item, wxPyTreeItemData* data) { |
678 | data->SetId(item); // set the id | |
679 | self->SetItemData(item, data); | |
680 | } | |
7f80dd64 | 681 | %cleardisown(wxPyTreeItemData* data ); |
1fded56b | 682 | |
d14a1e28 | 683 | // [Get|Set]ItemPyData are short-cuts. Also made somewhat crash-proof by |
1fded56b | 684 | // automatically creating data classes. |
d14a1e28 | 685 | PyObject* GetItemPyData(const wxTreeItemId& item) { |
1fded56b RD |
686 | wxPyTreeItemData* data = (wxPyTreeItemData*)self->GetItemData(item); |
687 | if (data == NULL) { | |
688 | data = new wxPyTreeItemData(); | |
689 | data->SetId(item); // set the id | |
690 | self->SetItemData(item, data); | |
691 | } | |
692 | return data->GetData(); | |
693 | } | |
694 | ||
d14a1e28 | 695 | void SetItemPyData(const wxTreeItemId& item, PyObject* obj) { |
1fded56b RD |
696 | wxPyTreeItemData* data = (wxPyTreeItemData*)self->GetItemData(item); |
697 | if (data == NULL) { | |
698 | data = new wxPyTreeItemData(obj); | |
699 | data->SetId(item); // set the id | |
700 | self->SetItemData(item, data); | |
701 | } else | |
702 | data->SetData(obj); | |
703 | } | |
704 | } | |
4e0b6696 RD |
705 | %pythoncode { GetPyData = GetItemPyData } |
706 | %pythoncode { SetPyData = SetItemPyData } | |
1fded56b RD |
707 | |
708 | ||
709 | // force appearance of [+] button near the item. This is useful to | |
710 | // allow the user to expand the items which don't have any children now | |
711 | // - but instead add them only when needed, thus minimizing memory | |
712 | // usage and loading time. | |
a72f4631 | 713 | void SetItemHasChildren(const wxTreeItemId& item, bool has = true); |
1fded56b RD |
714 | |
715 | // the item will be shown in bold | |
a72f4631 | 716 | void SetItemBold(const wxTreeItemId& item, bool bold = true); |
1fded56b RD |
717 | |
718 | // set the item's text colour | |
28eab81f | 719 | void SetItemTextColour(const wxTreeItemId& item, const wxColour& colour); |
1fded56b RD |
720 | |
721 | // set the item's background colour | |
722 | void SetItemBackgroundColour(const wxTreeItemId& item, | |
28eab81f | 723 | const wxColour& colour); |
1fded56b RD |
724 | |
725 | // set the item's font (should be of the same height for all items) | |
726 | void SetItemFont(const wxTreeItemId& item, const wxFont& font); | |
727 | ||
728 | ||
729 | bool GetItemBold(const wxTreeItemId& item) const; | |
730 | wxColour GetItemTextColour(const wxTreeItemId& item) const; | |
731 | wxColour GetItemBackgroundColour(const wxTreeItemId& item) const; | |
732 | wxFont GetItemFont(const wxTreeItemId& item) const; | |
733 | ||
734 | // is the item visible (it might be outside the view or not expanded)? | |
735 | bool IsVisible(const wxTreeItemId& item) const; | |
736 | ||
737 | // does the item has any children? | |
738 | bool ItemHasChildren(const wxTreeItemId& item) const; | |
739 | ||
740 | // is the item expanded (only makes sense if HasChildren())? | |
741 | bool IsExpanded(const wxTreeItemId& item) const; | |
742 | ||
743 | // is this item currently selected (the same as has focus)? | |
744 | bool IsSelected(const wxTreeItemId& item) const; | |
745 | ||
746 | // is item text in bold font? | |
747 | bool IsBold(const wxTreeItemId& item) const; | |
748 | ||
dd9f7fea | 749 | // if 'recursively' is False, only immediate children count, otherwise |
1fded56b | 750 | // the returned number is the number of all items in this branch |
a72f4631 | 751 | size_t GetChildrenCount(const wxTreeItemId& item, bool recursively = true); |
1fded56b RD |
752 | |
753 | ||
dd9f7fea | 754 | // wxTreeItemId.IsOk() will return False if there is no such item |
1fded56b RD |
755 | |
756 | // get the root tree item | |
757 | wxTreeItemId GetRootItem() const; | |
758 | ||
759 | // get the item currently selected (may return NULL if no selection) | |
760 | wxTreeItemId GetSelection() const; | |
761 | ||
762 | // get the items currently selected, return the number of such item | |
763 | //size_t GetSelections(wxArrayTreeItemIds&) const; | |
d14a1e28 | 764 | %extend { |
1fded56b | 765 | PyObject* GetSelections() { |
6e6b3557 | 766 | wxPyBlock_t blocked = wxPyBeginBlockThreads(); |
1fded56b RD |
767 | PyObject* rval = PyList_New(0); |
768 | wxArrayTreeItemIds array; | |
769 | size_t num, x; | |
770 | num = self->GetSelections(array); | |
771 | for (x=0; x < num; x++) { | |
772 | wxTreeItemId *tii = new wxTreeItemId(array.Item(x)); | |
a72f4631 | 773 | PyObject* item = wxPyConstructObject((void*)tii, wxT("wxTreeItemId"), true); |
1fded56b | 774 | PyList_Append(rval, item); |
faca2e45 | 775 | Py_DECREF(item); |
1fded56b | 776 | } |
da32eb53 | 777 | wxPyEndBlockThreads(blocked); |
1fded56b RD |
778 | return rval; |
779 | } | |
780 | } | |
781 | ||
782 | ||
783 | // get the parent of this item (may return NULL if root) | |
28eab81f | 784 | wxTreeItemId GetItemParent(const wxTreeItemId& item) const; |
1fded56b RD |
785 | |
786 | // for this enumeration function you must pass in a "cookie" parameter | |
787 | // which is opaque for the application but is necessary for the library | |
788 | // to make these functions reentrant (i.e. allow more than one | |
789 | // enumeration on one and the same object simultaneously). Of course, | |
790 | // the "cookie" passed to GetFirstChild() and GetNextChild() should be | |
791 | // the same! | |
792 | ||
1fded56b | 793 | |
28eab81f RD |
794 | // NOTE: These are a copy of the same methods in _treectrl.i, be sure to |
795 | // update both at the same time. (Or find a good way to refactor!) | |
d14a1e28 RD |
796 | %extend { |
797 | // Get the first child of this item. Returns a wxTreeItemId and an | |
798 | // opaque "cookie" value that should be passed to GetNextChild in | |
799 | // order to continue the search. | |
800 | PyObject* GetFirstChild(const wxTreeItemId& item) { | |
28eab81f | 801 | void* cookie = 0; |
61136550 | 802 | wxTreeItemId* ritem = new wxTreeItemId(self->GetFirstChild(item, cookie)); |
6e6b3557 | 803 | wxPyBlock_t blocked = wxPyBeginBlockThreads(); |
d14a1e28 | 804 | PyObject* tup = PyTuple_New(2); |
a72f4631 | 805 | PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(ritem, wxT("wxTreeItemId"), true)); |
28eab81f | 806 | PyTuple_SET_ITEM(tup, 1, wxPyMakeSwigPtr(cookie, wxT("void"))); |
da32eb53 | 807 | wxPyEndBlockThreads(blocked); |
d14a1e28 RD |
808 | return tup; |
809 | } | |
810 | ||
811 | ||
812 | // Get the next child of this item. The cookie parameter is the 2nd | |
813 | // value returned from GetFirstChild or the previous GetNextChild. | |
814 | // Returns a wxTreeItemId and an opaque "cookie" value that should be | |
815 | // passed to GetNextChild in order to continue the search. | |
28eab81f | 816 | PyObject* GetNextChild(const wxTreeItemId& item, void* cookie) { |
61136550 | 817 | wxTreeItemId* ritem = new wxTreeItemId(self->GetNextChild(item, cookie)); |
6e6b3557 | 818 | wxPyBlock_t blocked = wxPyBeginBlockThreads(); |
d14a1e28 | 819 | PyObject* tup = PyTuple_New(2); |
a72f4631 | 820 | PyTuple_SET_ITEM(tup, 0, wxPyConstructObject(ritem, wxT("wxTreeItemId"), true)); |
28eab81f | 821 | PyTuple_SET_ITEM(tup, 1, wxPyMakeSwigPtr(cookie, wxT("void"))); |
da32eb53 | 822 | wxPyEndBlockThreads(blocked); |
d14a1e28 | 823 | return tup; |
28eab81f RD |
824 | } |
825 | ||
826 | ||
827 | // TODO: GetPrevChild | |
828 | ||
d14a1e28 | 829 | } |
1fded56b RD |
830 | |
831 | // get the last child of this item - this method doesn't use cookies | |
832 | wxTreeItemId GetLastChild(const wxTreeItemId& item) const; | |
833 | ||
834 | // get the next sibling of this item | |
835 | wxTreeItemId GetNextSibling(const wxTreeItemId& item) const; | |
836 | ||
837 | // get the previous sibling | |
838 | wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const; | |
839 | ||
840 | // get first visible item | |
841 | wxTreeItemId GetFirstVisibleItem() const; | |
842 | ||
843 | // get the next visible item: item must be visible itself! | |
844 | // see IsVisible() and wxTreeCtrl::GetFirstVisibleItem() | |
845 | wxTreeItemId GetNextVisible(const wxTreeItemId& item) const; | |
846 | ||
847 | // get the previous visible item: item must be visible itself! | |
848 | wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const; | |
849 | ||
850 | // Only for internal use right now, but should probably be public | |
851 | wxTreeItemId GetNext(const wxTreeItemId& item) const; | |
852 | ||
853 | ||
7f80dd64 RD |
854 | %disownarg( wxPyTreeItemData* data ); |
855 | ||
1fded56b RD |
856 | // add the root node to the tree |
857 | wxTreeItemId AddRoot(const wxString& text, | |
858 | int image = -1, int selectedImage = -1, | |
859 | wxPyTreeItemData *data = NULL); | |
860 | ||
861 | // insert a new item in as the first child of the parent | |
862 | wxTreeItemId PrependItem(const wxTreeItemId& parent, | |
863 | const wxString& text, | |
864 | int image = -1, int selectedImage = -1, | |
865 | wxPyTreeItemData *data = NULL); | |
866 | ||
867 | // insert a new item after a given one | |
868 | wxTreeItemId InsertItem(const wxTreeItemId& parent, | |
869 | const wxTreeItemId& idPrevious, | |
870 | const wxString& text, | |
871 | int image = -1, int selectedImage = -1, | |
872 | wxPyTreeItemData *data = NULL); | |
873 | ||
874 | // insert a new item before the one with the given index | |
1b8c7ba6 RD |
875 | %Rename(InsertItemBefore, |
876 | wxTreeItemId, InsertItem(const wxTreeItemId& parent, | |
1fded56b RD |
877 | size_t index, |
878 | const wxString& text, | |
879 | int image = -1, int selectedImage = -1, | |
1b8c7ba6 | 880 | wxPyTreeItemData *data = NULL)); |
1fded56b RD |
881 | |
882 | // insert a new item in as the last child of the parent | |
883 | wxTreeItemId AppendItem(const wxTreeItemId& parent, | |
884 | const wxString& text, | |
885 | int image = -1, int selectedImage = -1, | |
886 | wxPyTreeItemData *data = NULL); | |
887 | ||
7f80dd64 RD |
888 | %cleardisown(wxPyTreeItemData* data ); |
889 | ||
1fded56b RD |
890 | // delete this item and associated data if any |
891 | void Delete(const wxTreeItemId& item); | |
892 | ||
893 | // delete all children (but don't delete the item itself) | |
894 | // NB: this won't send wxEVT_COMMAND_TREE_ITEM_DELETED events | |
895 | void DeleteChildren(const wxTreeItemId& item); | |
896 | ||
897 | // delete all items from the tree | |
898 | // NB: this won't send wxEVT_COMMAND_TREE_ITEM_DELETED events | |
899 | void DeleteAllItems(); | |
900 | ||
901 | // expand this item | |
902 | void Expand(const wxTreeItemId& item); | |
903 | ||
904 | // expand this item and all subitems recursively | |
905 | void ExpandAll(const wxTreeItemId& item); | |
906 | ||
907 | // collapse the item without removing its children | |
908 | void Collapse(const wxTreeItemId& item); | |
909 | ||
910 | // collapse the item and remove all children | |
911 | void CollapseAndReset(const wxTreeItemId& item); | |
912 | ||
913 | // toggles the current state | |
914 | void Toggle(const wxTreeItemId& item); | |
915 | ||
916 | // remove the selection from currently selected item (if any) | |
917 | void Unselect(); | |
918 | void UnselectAll(); | |
919 | ||
920 | // select this item | |
a72f4631 RD |
921 | void SelectItem(const wxTreeItemId& item, bool unselect_others=true, |
922 | bool extended_select=false); | |
1fded56b | 923 | |
a72f4631 | 924 | void SelectAll(bool extended_select=false); |
28eab81f | 925 | |
1fded56b RD |
926 | // make sure this item is visible (expanding the parent item and/or |
927 | // scrolling to this item if necessary) | |
928 | void EnsureVisible(const wxTreeItemId& item); | |
929 | ||
930 | // scroll to this item (but don't expand its parent) | |
931 | void ScrollTo(const wxTreeItemId& item); | |
932 | ||
933 | // Returns wxTreeItemId, flags, and column | |
934 | wxTreeItemId HitTest(const wxPoint& point, int& OUTPUT, int& OUTPUT); | |
935 | ||
d14a1e28 | 936 | %extend { |
1fded56b | 937 | // get the bounding rectangle of the item (or of its label only) |
a72f4631 | 938 | PyObject* GetBoundingRect(const wxTreeItemId& item, bool textOnly = false) { |
1fded56b RD |
939 | wxRect rect; |
940 | if (self->GetBoundingRect(item, rect, textOnly)) { | |
6e6b3557 | 941 | wxPyBlock_t blocked = wxPyBeginBlockThreads(); |
1fded56b RD |
942 | wxRect* r = new wxRect(rect); |
943 | PyObject* val = wxPyConstructObject((void*)r, wxT("wxRect"), 1); | |
da32eb53 | 944 | wxPyEndBlockThreads(blocked); |
1fded56b RD |
945 | return val; |
946 | } | |
947 | else { | |
d14a1e28 | 948 | RETURN_NONE(); |
1fded56b RD |
949 | } |
950 | } | |
951 | } | |
952 | ||
953 | ||
954 | // Start editing the item label: this (temporarily) replaces the item | |
955 | // with a one line edit control. The item will be selected if it hadn't | |
956 | // been before. | |
957 | void EditLabel( const wxTreeItemId& item ); | |
958 | void Edit( const wxTreeItemId& item ); | |
959 | ||
960 | // sort the children of this item using OnCompareItems | |
961 | void SortChildren(const wxTreeItemId& item); | |
962 | ||
28eab81f RD |
963 | // searching |
964 | wxTreeItemId FindItem (const wxTreeItemId& item, const wxString& str, int flags = 0); | |
1fded56b RD |
965 | |
966 | wxWindow* GetHeaderWindow() const; | |
6d450e1a | 967 | wxScrolledWindow* GetMainWindow() const; |
1fded56b | 968 | |
1fded56b RD |
969 | }; |
970 | ||
7e4b7f9a RD |
971 | //---------------------------------------------------------------------- |
972 | ||
973 | enum | |
974 | { | |
975 | wxSCALE_HORIZONTAL, | |
976 | wxSCALE_VERTICAL, | |
977 | wxSCALE_UNIFORM, | |
978 | wxSCALE_CUSTOM | |
979 | }; | |
980 | ||
981 | MustHaveApp(wxStaticPicture); | |
982 | ||
983 | class wxStaticPicture : public wxControl | |
984 | { | |
985 | public: | |
986 | %pythonAppend wxStaticPicture "self._setOORInfo(self)" | |
987 | %pythonAppend wxStaticPicture() "" | |
988 | ||
d3397f6a RD |
989 | wxStaticPicture( wxWindow* parent, wxWindowID id=-1, |
990 | const wxBitmap& label=wxNullBitmap, | |
7e4b7f9a RD |
991 | const wxPoint& pos = wxDefaultPosition, |
992 | const wxSize& size = wxDefaultSize, | |
993 | long style = 0, | |
994 | const wxString& name = wxPyStaticPictureNameStr ); | |
995 | ||
996 | %RenameCtor(PreStaticPicture, wxStaticPicture()); | |
997 | ||
d3397f6a RD |
998 | bool Create( wxWindow* parent, wxWindowID id=-1, |
999 | const wxBitmap& label=wxNullBitmap, | |
7e4b7f9a RD |
1000 | const wxPoint& pos = wxDefaultPosition, |
1001 | const wxSize& size = wxDefaultSize, | |
1002 | long style = 0, | |
1003 | const wxString& name = wxPyStaticPictureNameStr ); | |
1004 | ||
1005 | void SetBitmap( const wxBitmap& bmp ); | |
1006 | wxBitmap GetBitmap() const; | |
1007 | void SetIcon( const wxIcon& icon ); | |
1008 | wxIcon GetIcon() const; | |
1fded56b | 1009 | |
7e4b7f9a RD |
1010 | void SetAlignment( int align ); |
1011 | int GetAlignment() const; | |
1012 | ||
1013 | void SetScale( int scale ); | |
1014 | int GetScale() const; | |
1015 | ||
1016 | void SetCustomScale( float sx, float sy ); | |
1017 | void GetCustomScale( float* OUTPUT, float* OUTPUT ) const; | |
1018 | ||
1019 | }; | |
1fded56b RD |
1020 | |
1021 | ||
950e7faf | 1022 | //---------------------------------------------------------------------- |
ebf4302c RD |
1023 | //---------------------------------------------------------------------- |
1024 | ||
1025 | %init %{ | |
1026 | ||
611dc22c | 1027 | wxPyPtrTypeMap_Add("wxTreeCompanionWindow", "wxPyTreeCompanionWindow"); |
1fded56b | 1028 | wxPyPtrTypeMap_Add("wxTreeListCtrl", "wxPyTreeListCtrl"); |
ebf4302c RD |
1029 | %} |
1030 | ||
1031 | ||
ebf4302c RD |
1032 | %pragma(python) include="_gizmoextras.py"; |
1033 | ||
1034 | //---------------------------------------------------------------------- | |
1035 | //---------------------------------------------------------------------- | |
1036 |