3 /////////////////////////////////////////////////////////////////////////////
5 // Purpose: More control (widget) classes for wxPython
11 // Copyright: (c) 1998 by Total Control Software
12 // Licence: wxWindows license
13 /////////////////////////////////////////////////////////////////////////////
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 {
79 wxListCtrl(wxWindow* parent, wxWindowID id,
80 const wxPoint& pos = wxPyDefaultPosition,
81 const wxSize& size = wxPyDefaultSize,
82 long style = wxLC_ICON,
83 const wxValidator& validator = wxPyDefaultValidator,
84 char* name = "listCtrl");
86 bool Arrange(int flag = wxLIST_ALIGN_DEFAULT);
87 bool DeleteItem(long item);
88 bool DeleteAllItems();
89 bool DeleteColumn(int col);
90 bool DeleteAllColumns(void);
92 wxTextCtrl* EditLabel(long item);
93 bool EndEditLabel(bool cancel);
94 bool EnsureVisible(long item);
95 long FindItem(long start, const wxString& str, bool partial = FALSE);
96 %name(FindItemData)long FindItem(long start, long data);
97 %name(FindItemAtPos)long FindItem(long start, const wxPoint& pt,
99 bool GetColumn(int col, wxListItem& item);
100 int GetColumnWidth(int col);
101 int GetCountPerPage();
102 wxTextCtrl* GetEditControl();
103 wxImageList* GetImageList(int which);
104 long GetItemData(long item);
107 %new wxListItem* GetItem() {
108 wxListItem* info = new wxListItem;
109 self->GetItem(*info);
112 %new wxPoint* GetItemPosition(long item) {
113 wxPoint* pos = new wxPoint;
114 self->GetItemPosition(item, *pos);
117 %new wxRect* GetItemRect(long item, int code = wxLIST_RECT_BOUNDS) {
118 wxRect* rect= new wxRect;
119 self->GetItemRect(item, *rect, code);
124 int GetItemState(long item, long stateMask);
126 int GetItemSpacing(bool isSmall);
127 wxString GetItemText(long item);
128 long GetNextItem(long item,
129 int geometry = wxLIST_NEXT_ALL,
130 int state = wxLIST_STATE_DONTCARE);
131 int GetSelectedItemCount();
132 wxColour GetTextColour();
134 long HitTest(const wxPoint& point, int& OUTPUT);
135 %name(InsertColumnWithInfo)long InsertColumn(long col, wxListItem& info);
136 long InsertColumn(long col, const wxString& heading,
137 int format = wxLIST_FORMAT_LEFT,
140 long InsertItem(wxListItem& info);
141 %name(InsertStringItem) long InsertItem(long index, const wxString& label);
142 %name(InsertImageItem) long InsertItem(long index, int imageIndex);
143 %name(InsertImageStringItem)long InsertItem(long index, const wxString& label,
146 bool ScrollList(int dx, int dy);
147 void SetBackgroundColour(const wxColour& col);
148 bool SetColumn(int col, wxListItem& item);
149 bool SetColumnWidth(int col, int width);
150 void SetImageList(wxImageList* imageList, int which);
151 bool SetItem(wxListItem& info);
152 %name(SetItemString)long SetItem(long index, int col, const wxString& label,
154 bool SetItemData(long item, long data);
155 bool SetItemImage(long item, int image, int selImage);
156 bool SetItemPosition(long item, const wxPoint& pos);
157 bool SetItemState(long item, long state, long stateMask);
158 void SetItemText(long item, const wxString& text);
159 void SetSingleStyle(long style, bool add = TRUE);
160 void SetTextColour(const wxColour& col);
161 void SetWindowStyleFlag(long style);
162 // TODO: bool SortItems(wxListCtrlCompare fn, long data);
167 //----------------------------------------------------------------------
175 wxTREE_MASK_SELECTED_IMAGE,
176 wxTREE_MASK_CHILDREN,
180 wxTREE_STATE_DROPHILITED,
181 wxTREE_STATE_EXPANDED,
182 wxTREE_STATE_EXPANDEDONCE,
183 wxTREE_STATE_FOCUSED,
184 wxTREE_STATE_SELECTED,
187 wxTREE_HITTEST_ABOVE,
188 wxTREE_HITTEST_BELOW,
189 wxTREE_HITTEST_NOWHERE,
190 wxTREE_HITTEST_ONITEMBUTTON,
191 wxTREE_HITTEST_ONITEMICON,
192 wxTREE_HITTEST_ONITEMINDENT,
193 wxTREE_HITTEST_ONITEMLABEL,
194 wxTREE_HITTEST_ONITEMRIGHT,
195 wxTREE_HITTEST_ONITEMSTATEICON,
196 wxTREE_HITTEST_TOLEFT,
197 wxTREE_HITTEST_TORIGHT,
198 wxTREE_HITTEST_ONITEM,
205 wxTREE_NEXT_DROPHILITE,
206 wxTREE_NEXT_FIRSTVISIBLE,
208 wxTREE_NEXT_NEXTVISIBLE,
210 wxTREE_NEXT_PREVIOUS,
211 wxTREE_NEXT_PREVIOUSVISIBLE,
216 wxTREE_EXPAND_EXPAND,
217 wxTREE_EXPAND_COLLAPSE,
218 wxTREE_EXPAND_COLLAPSE_RESET,
252 class wxTreeEvent : public wxCommandEvent {
263 class wxTreeCtrl : public wxControl {
265 wxTreeCtrl(wxWindow *parent, wxWindowID id = -1,
266 const wxPoint& pos = wxPyDefaultPosition,
267 const wxSize& size = wxPyDefaultSize,
268 long style = wxTR_HAS_BUTTONS,
269 const wxValidator& validator = wxPyDefaultValidator,
270 char* name = "wxTreeCtrl");
272 bool DeleteAllItems();
273 bool DeleteItem(long item);
274 wxTextCtrl* EditLabel(long item);
275 bool EnsureVisible(long item);
276 bool ExpandItem(long item, int action);
277 long GetChild(long item);
279 wxTextCtrl* GetEditControl();
280 long GetFirstVisibleItem();
281 wxImageList* GetImageList(int which = wxIMAGE_LIST_NORMAL);
283 long GetItemData(long item);
286 %new wxTreeItem* GetItem() {
287 wxTreeItem* info = new wxTreeItem;
288 self->GetItem(*info);
291 %new wxRect* GetItemRect(long item, int textOnly = FALSE) {
292 wxRect* rect = new wxRect;
293 self->GetItemRect(item, *rect, textOnly);
298 int GetItemState(long item, long stateMask);
299 wxString GetItemText(long item);
300 long GetNextItem(long item, int code);
301 long GetNextVisibleItem(long item);
302 long GetParent(long item);
305 long HitTest(const wxPoint& point, int& OUTPUT); // *** check this
306 long InsertItem(long parent, wxTreeItem& info,
307 long insertAfter = wxTREE_INSERT_LAST);
308 %name(InsertItemString)
309 long InsertItem(long parent, const wxString& label,
310 int image = -1, int selImage = -1,
311 long insertAfter = wxTREE_INSERT_LAST);
312 bool ItemHasChildren(long item);
313 bool ScrollTo(long item);
314 bool SelectItem(long item);
315 void SetIndent(int indent);
316 void SetImageList(wxImageList* imageList, int which = wxIMAGE_LIST_NORMAL);
317 bool SetItem(wxTreeItem& info);
318 bool SetItemImage(long item, int image, int selImage);
319 bool SetItemState(long item, long state, long stateMask);
320 void SetItemText(long item, const wxString& text);
321 bool SetItemData(long item, long data);
322 bool SortChildren(long item);
325 //----------------------------------------------------------------------
327 class wxTabEvent : public wxCommandEvent {
333 class wxTabCtrl : public wxControl {
335 wxTabCtrl(wxWindow* parent, wxWindowID id,
336 const wxPoint& pos = wxPyDefaultPosition,
337 const wxSize& size = wxPyDefaultSize,
339 char* name = "tabCtrl");
341 bool DeleteAllItems();
342 bool DeleteItem(int item);
343 wxImageList* GetImageList();
345 // TODO: void* GetItemData();
346 int GetItemImage(int item);
349 %new wxRect* GetItemRect(int item) {
350 wxRect* rect = new wxRect;
351 self->GetItemRect(item, *rect);
356 wxString GetItemText(int item);
359 int HitTest(const wxPoint& pt, long& OUTPUT);
360 void InsertItem(int item, const wxString& text,
361 int imageId = -1, void* clientData = NULL);
362 // TODO: bool SetItemData(int item, void* data);
363 bool SetItemImage(int item, int image);
364 void SetImageList(wxImageList* imageList);
365 void SetItemSize(const wxSize& size);
366 bool SetItemText(int item, const wxString& text);
367 void SetPadding(const wxSize& padding);
368 int SetSelection(int item);
372 //----------------------------------------------------------------------
375 /////////////////////////////////////////////////////////////////////////////
378 // Revision 1.1 1998/08/09 08:25:49 RD