1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: More control (widget) classes for wxPython
9 // Copyright: (c) 1998 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
17 #include <wx/listctrl.h>
18 #include <wx/treectrl.h>
19 #include <wx/tabctrl.h>
22 //----------------------------------------------------------------------
25 %include my_typemaps.i
27 // Import some definitions of other classes, etc.
35 //----------------------------------------------------------------------
38 extern wxValidator wxPyDefaultValidator;
41 //----------------------------------------------------------------------
45 long m_mask; // Indicates what fields are valid
46 long m_itemId; // The zero-based item position
47 int m_col; // Zero-based column, if in report mode
48 long m_state; // The state of the item
49 long m_stateMask; // Which flags of m_state are valid (uses same flags)
50 wxString m_text; // The label/header text
51 int m_image; // The zero-based index into an image list
52 long m_data; // App-defined data
53 // wxColour *m_colour; // only wxGLC, not supported by Windows ;->
56 int m_format; // left, right, centre
57 int m_width; // width of column
63 class wxListEvent: public wxCommandEvent {
77 class wxListCtrl : public wxControl {
80 wxListCtrl(wxWindow* parent, wxWindowID id,
81 const wxPoint& pos = wxPyDefaultPosition,
82 const wxSize& size = wxPyDefaultSize,
83 long style = wxLC_ICON,
84 const wxValidator& validator = wxPyDefaultValidator,
85 char* name = "listCtrl");
87 wxListCtrl(wxWindow* parent, wxWindowID id,
88 const wxPoint& pos = wxPyDefaultPosition,
89 const wxSize& size = wxPyDefaultSize,
90 long style = wxLC_ICON,
91 char* name = "listctrl");
94 bool Arrange(int flag = wxLIST_ALIGN_DEFAULT);
95 bool DeleteItem(long item);
96 bool DeleteAllItems();
97 bool DeleteColumn(int col);
99 bool DeleteAllColumns(void);
101 wxTextCtrl* EditLabel(long item);
102 bool EndEditLabel(bool cancel);
104 bool EnsureVisible(long item);
105 long FindItem(long start, const wxString& str, bool partial = FALSE);
106 %name(FindItemData)long FindItem(long start, long data);
107 %name(FindItemAtPos)long FindItem(long start, const wxPoint& pt,
109 bool GetColumn(int col, wxListItem& item);
110 int GetColumnWidth(int col);
111 int GetCountPerPage();
113 wxTextCtrl* GetEditControl();
115 wxImageList* GetImageList(int which);
116 long GetItemData(long item);
119 %new wxListItem* GetItem() {
120 wxListItem* info = new wxListItem;
121 self->GetItem(*info);
124 %new wxPoint* GetItemPosition(long item) {
125 wxPoint* pos = new wxPoint;
126 self->GetItemPosition(item, *pos);
129 %new wxRect* GetItemRect(long item, int code = wxLIST_RECT_BOUNDS) {
130 wxRect* rect= new wxRect;
131 self->GetItemRect(item, *rect, code);
136 int GetItemState(long item, long stateMask);
138 int GetItemSpacing(bool isSmall);
139 wxString GetItemText(long item);
140 long GetNextItem(long item,
141 int geometry = wxLIST_NEXT_ALL,
142 int state = wxLIST_STATE_DONTCARE);
143 int GetSelectedItemCount();
145 wxColour GetTextColour();
148 long HitTest(const wxPoint& point, int& OUTPUT);
149 %name(InsertColumnWithInfo)long InsertColumn(long col, wxListItem& info);
150 long InsertColumn(long col, const wxString& heading,
151 int format = wxLIST_FORMAT_LEFT,
154 long InsertItem(wxListItem& info);
155 %name(InsertStringItem) long InsertItem(long index, const wxString& label);
156 %name(InsertImageItem) long InsertItem(long index, int imageIndex);
157 %name(InsertImageStringItem)long InsertItem(long index, const wxString& label,
160 bool ScrollList(int dx, int dy);
161 void SetBackgroundColour(const wxColour& col);
162 bool SetColumn(int col, wxListItem& item);
163 bool SetColumnWidth(int col, int width);
164 void SetImageList(wxImageList* imageList, int which);
165 bool SetItem(wxListItem& info);
166 %name(SetItemString)long SetItem(long index, int col, const wxString& label,
168 bool SetItemData(long item, long data);
169 bool SetItemImage(long item, int image, int selImage);
170 bool SetItemPosition(long item, const wxPoint& pos);
171 bool SetItemState(long item, long state, long stateMask);
172 void SetItemText(long item, const wxString& text);
173 void SetSingleStyle(long style, bool add = TRUE);
175 void SetTextColour(const wxColour& col);
177 void SetWindowStyleFlag(long style);
178 // TODO: bool SortItems(wxListCtrlCompare fn, long data);
183 //----------------------------------------------------------------------
191 wxTREE_MASK_SELECTED_IMAGE,
192 wxTREE_MASK_CHILDREN,
196 wxTREE_STATE_DROPHILITED,
197 wxTREE_STATE_EXPANDED,
198 wxTREE_STATE_EXPANDEDONCE,
199 wxTREE_STATE_FOCUSED,
200 wxTREE_STATE_SELECTED,
203 wxTREE_HITTEST_ABOVE,
204 wxTREE_HITTEST_BELOW,
205 wxTREE_HITTEST_NOWHERE,
206 wxTREE_HITTEST_ONITEMBUTTON,
207 wxTREE_HITTEST_ONITEMICON,
208 wxTREE_HITTEST_ONITEMINDENT,
209 wxTREE_HITTEST_ONITEMLABEL,
210 wxTREE_HITTEST_ONITEMRIGHT,
211 wxTREE_HITTEST_ONITEMSTATEICON,
212 wxTREE_HITTEST_TOLEFT,
213 wxTREE_HITTEST_TORIGHT,
214 wxTREE_HITTEST_ONITEM,
221 wxTREE_NEXT_DROPHILITE,
222 wxTREE_NEXT_FIRSTVISIBLE,
224 wxTREE_NEXT_NEXTVISIBLE,
226 wxTREE_NEXT_PREVIOUS,
227 wxTREE_NEXT_PREVIOUSVISIBLE,
232 wxTREE_EXPAND_EXPAND,
233 wxTREE_EXPAND_COLLAPSE,
234 wxTREE_EXPAND_COLLAPSE_RESET,
268 class wxTreeEvent : public wxCommandEvent {
279 class wxTreeCtrl : public wxControl {
282 wxTreeCtrl(wxWindow *parent, wxWindowID id = -1,
283 const wxPoint& pos = wxPyDefaultPosition,
284 const wxSize& size = wxPyDefaultSize,
285 long style = wxTR_HAS_BUTTONS,
286 const wxValidator& validator = wxPyDefaultValidator,
287 char* name = "wxTreeCtrl");
289 wxTreeCtrl(wxWindow *parent, wxWindowID id = -1,
290 const wxPoint& pos = wxPyDefaultPosition,
291 const wxSize& size = wxPyDefaultSize,
292 long style = wxTR_HAS_BUTTONS,
293 char* name = "wxTreeCtrl");
296 bool DeleteAllItems();
298 bool DeleteItem(long item);
300 void DeleteItem(long item);
303 wxTextCtrl* EditLabel(long item);
304 bool EnsureVisible(long item);
305 bool ExpandItem(long item, int action);
306 long GetChild(long item);
310 wxTextCtrl* GetEditControl();
311 long GetFirstVisibleItem();
313 wxImageList* GetImageList(int which = wxIMAGE_LIST_NORMAL);
315 long GetItemData(long item);
318 %new wxTreeItem* GetItem() {
319 wxTreeItem* info = new wxTreeItem;
320 self->GetItem(*info);
324 %new wxRect* GetItemRect(long item, int textOnly = FALSE) {
325 wxRect* rect = new wxRect;
326 self->GetItemRect(item, *rect, textOnly);
333 int GetItemState(long item, long stateMask);
335 wxString GetItemText(long item);
337 long GetNextItem(long item, int code);
338 long GetNextVisibleItem(long item);
340 long GetParent(long item);
343 long HitTest(const wxPoint& point, int& OUTPUT); // *** check this
344 long InsertItem(long parent, wxTreeItem& info,
345 long insertAfter = wxTREE_INSERT_LAST);
346 %name(InsertItemString)
347 long InsertItem(long parent, const wxString& label,
348 int image = -1, int selImage = -1,
349 long insertAfter = wxTREE_INSERT_LAST);
350 bool ItemHasChildren(long item);
352 bool ScrollTo(long item);
354 bool SelectItem(long item);
355 void SetIndent(int indent);
356 void SetImageList(wxImageList* imageList, int which = wxIMAGE_LIST_NORMAL);
357 bool SetItem(wxTreeItem& info);
359 bool SetItemImage(long item, int image, int selImage);
361 void SetItemImage(long item, int image, int selImage);
364 bool SetItemState(long item, long state, long stateMask);
366 void SetItemText(long item, const wxString& text);
367 bool SetItemData(long item, long data);
369 bool SortChildren(long item);
373 //----------------------------------------------------------------------
376 class wxTabEvent : public wxCommandEvent {
382 class wxTabCtrl : public wxControl {
384 wxTabCtrl(wxWindow* parent, wxWindowID id,
385 const wxPoint& pos = wxPyDefaultPosition,
386 const wxSize& size = wxPyDefaultSize,
388 char* name = "tabCtrl");
390 bool DeleteAllItems();
391 bool DeleteItem(int item);
392 wxImageList* GetImageList();
394 // TODO: void* GetItemData();
395 int GetItemImage(int item);
398 %new wxRect* GetItemRect(int item) {
399 wxRect* rect = new wxRect;
400 self->GetItemRect(item, *rect);
405 wxString GetItemText(int item);
408 int HitTest(const wxPoint& pt, long& OUTPUT);
409 void InsertItem(int item, const wxString& text,
410 int imageId = -1, void* clientData = NULL);
411 // TODO: bool SetItemData(int item, void* data);
412 bool SetItemImage(int item, int image);
413 void SetImageList(wxImageList* imageList);
414 void SetItemSize(const wxSize& size);
415 bool SetItemText(int item, const wxString& text);
416 void SetPadding(const wxSize& padding);
417 int SetSelection(int item);
423 //----------------------------------------------------------------------
426 /////////////////////////////////////////////////////////////////////////////
429 // Revision 1.3 1998/08/18 19:48:15 RD
430 // more wxGTK compatibility things.
432 // It builds now but there are serious runtime problems...
434 // Revision 1.2 1998/08/15 07:36:30 RD
435 // - Moved the header in the .i files out of the code that gets put into
436 // the .cpp files. It caused CVS conflicts because of the RCS ID being
437 // different each time.
439 // - A few minor fixes.
441 // Revision 1.1 1998/08/09 08:25:49 RD