]> git.saurik.com Git - wxWidgets.git/blame - utils/wxPython/src/controls2.i
Just a teeny change -- addition of wxFrame::IsMaximized. For wxMDIChildFrame
[wxWidgets.git] / utils / 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
RD
16#include "helpers.h"
17#include <wx/listctrl.h>
18#include <wx/treectrl.h>
7bf85405
RD
19%}
20
21//----------------------------------------------------------------------
22
23%include typemaps.i
24%include my_typemaps.i
25
26// Import some definitions of other classes, etc.
27%import _defs.i
28%import misc.i
29%import windows.i
30%import gdi.i
31%import events.i
32%import controls.i
33
b8b8dda7 34%pragma(python) code = "import wx"
9c039d08 35
7bf85405
RD
36//----------------------------------------------------------------------
37
38%{
39extern wxValidator wxPyDefaultValidator;
40%}
41
42//----------------------------------------------------------------------
43
44class wxListItem {
45public:
46 long m_mask; // Indicates what fields are valid
47 long m_itemId; // The zero-based item position
48 int m_col; // Zero-based column, if in report mode
49 long m_state; // The state of the item
50 long m_stateMask; // Which flags of m_state are valid (uses same flags)
51 wxString m_text; // The label/header text
52 int m_image; // The zero-based index into an image list
53 long m_data; // App-defined data
54// wxColour *m_colour; // only wxGLC, not supported by Windows ;->
55
56 // For columns only
57 int m_format; // left, right, centre
58 int m_width; // width of column
59
60 wxListItem();
61 ~wxListItem();
62};
63
64class wxListEvent: public wxCommandEvent {
65public:
66 int m_code;
67 long m_itemIndex;
68 long m_oldItemIndex;
69 int m_col;
70 bool m_cancelled;
71 wxPoint m_pointDrag;
72 wxListItem m_item;
73};
74
75
76
77
78class wxListCtrl : public wxControl {
79public:
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");
86
b8b8dda7 87 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08 88
7bf85405
RD
89 bool Arrange(int flag = wxLIST_ALIGN_DEFAULT);
90 bool DeleteItem(long item);
91 bool DeleteAllItems();
92 bool DeleteColumn(int col);
93 bool DeleteAllColumns(void);
94 void ClearAll(void);
4f22cf8d 95#ifdef __WXMSW__
7bf85405
RD
96 wxTextCtrl* EditLabel(long item);
97 bool EndEditLabel(bool cancel);
4f22cf8d 98 wxTextCtrl* GetEditControl();
fb5e0af0 99#endif
7bf85405
RD
100 bool EnsureVisible(long item);
101 long FindItem(long start, const wxString& str, bool partial = FALSE);
102 %name(FindItemData)long FindItem(long start, long data);
103 %name(FindItemAtPos)long FindItem(long start, const wxPoint& pt,
104 int direction);
105 bool GetColumn(int col, wxListItem& item);
106 int GetColumnWidth(int col);
107 int GetCountPerPage();
7bf85405
RD
108 wxImageList* GetImageList(int which);
109 long GetItemData(long item);
110
111 %addmethods {
112 %new wxListItem* GetItem() {
113 wxListItem* info = new wxListItem;
114 self->GetItem(*info);
115 return info;
116 }
117 %new wxPoint* GetItemPosition(long item) {
118 wxPoint* pos = new wxPoint;
119 self->GetItemPosition(item, *pos);
120 return pos;
121 }
122 %new wxRect* GetItemRect(long item, int code = wxLIST_RECT_BOUNDS) {
123 wxRect* rect= new wxRect;
124 self->GetItemRect(item, *rect, code);
125 return rect;
126 }
127 }
128
129 int GetItemState(long item, long stateMask);
130 int GetItemCount();
131 int GetItemSpacing(bool isSmall);
132 wxString GetItemText(long item);
133 long GetNextItem(long item,
134 int geometry = wxLIST_NEXT_ALL,
135 int state = wxLIST_STATE_DONTCARE);
136 int GetSelectedItemCount();
fb5e0af0 137#ifdef __WXMSW__
7bf85405 138 wxColour GetTextColour();
4f22cf8d 139 void SetTextColour(const wxColour& col);
fb5e0af0 140#endif
7bf85405
RD
141 long GetTopItem();
142 long HitTest(const wxPoint& point, int& OUTPUT);
143 %name(InsertColumnWithInfo)long InsertColumn(long col, wxListItem& info);
144 long InsertColumn(long col, const wxString& heading,
145 int format = wxLIST_FORMAT_LEFT,
146 int width = -1);
147
148 long InsertItem(wxListItem& info);
149 %name(InsertStringItem) long InsertItem(long index, const wxString& label);
150 %name(InsertImageItem) long InsertItem(long index, int imageIndex);
151 %name(InsertImageStringItem)long InsertItem(long index, const wxString& label,
152 int imageIndex);
153
154 bool ScrollList(int dx, int dy);
155 void SetBackgroundColour(const wxColour& col);
156 bool SetColumn(int col, wxListItem& item);
157 bool SetColumnWidth(int col, int width);
158 void SetImageList(wxImageList* imageList, int which);
159 bool SetItem(wxListItem& info);
160 %name(SetItemString)long SetItem(long index, int col, const wxString& label,
161 int imageId = -1);
162 bool SetItemData(long item, long data);
163 bool SetItemImage(long item, int image, int selImage);
164 bool SetItemPosition(long item, const wxPoint& pos);
165 bool SetItemState(long item, long state, long stateMask);
166 void SetItemText(long item, const wxString& text);
167 void SetSingleStyle(long style, bool add = TRUE);
7bf85405
RD
168 void SetWindowStyleFlag(long style);
169 // TODO: bool SortItems(wxListCtrlCompare fn, long data);
170};
171
172
173
174//----------------------------------------------------------------------
175
176
d5c9047a
RD
177class wxTreeItemId {
178public:
179 wxTreeItemId();
180 ~wxTreeItemId();
181 bool IsOk() const { return m_itemId != 0; }
182
60e05667
RD
183// %addmethods {
184// long GetId() { return (long)(*self); }
185// }
d5c9047a
RD
186};
187
188
189
190// **** This isn't very useful yet. This needs to be specialized to enable
191// derived Python classes...
192class wxTreeItemData {
193public:
194 wxTreeItemData();
195 ~wxTreeItemData();
196
630d84f2
RD
197 const wxTreeItemId& GetId();
198 void SetId(const wxTreeItemId& id);
d5c9047a
RD
199};
200
201
202
203
204class wxTreeEvent : public wxCommandEvent {
205public:
206 wxTreeItemId GetItem();
207 wxTreeItemId GetOldItem();
208 wxPoint GetPoint();
209 int GetCode();
210 void Veto();
211};
212
213
214// These are for the GetFirstChild/GetNextChild methods below
215%typemap(python, in) long& INOUT = long* INOUT;
216%typemap(python, argout) long& INOUT = long* INOUT;
217
218
219class wxTreeCtrl : public wxControl {
220public:
221 wxTreeCtrl(wxWindow *parent, wxWindowID id = -1,
222 const wxPoint& pos = wxPyDefaultPosition,
223 const wxSize& size = wxPyDefaultSize,
224 long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT,
225 const wxValidator& validator = wxPyDefaultValidator,
226 char* name = "wxTreeCtrl");
227
b8b8dda7 228 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
d5c9047a
RD
229
230 size_t GetCount();
231 unsigned int GetIndent();
232 void SetIndent(unsigned int indent);
233 wxImageList *GetImageList();
234 wxImageList *GetStateImageList();
235 void SetImageList(wxImageList *imageList);
236 void SetStateImageList(wxImageList *imageList);
237
238 wxString GetItemText(const wxTreeItemId& item);
239 int GetItemImage(const wxTreeItemId& item);
240 int GetItemSelectedImage(const wxTreeItemId& item);
241 wxTreeItemData *GetItemData(const wxTreeItemId& item);
242
243 void SetItemText(const wxTreeItemId& item, const wxString& text);
244 void SetItemImage(const wxTreeItemId& item, int image);
245 void SetItemSelectedImage(const wxTreeItemId& item, int image);
246 void SetItemData(const wxTreeItemId& item, wxTreeItemData *data);
247
248 bool IsVisible(const wxTreeItemId& item);
249 bool ItemHasChildren(const wxTreeItemId& item);
250 bool IsExpanded(const wxTreeItemId& item);
251 bool IsSelected(const wxTreeItemId& item);
252
253 wxTreeItemId GetRootItem();
254 wxTreeItemId GetSelection();
255 wxTreeItemId GetParent(const wxTreeItemId& item);
256
257 wxTreeItemId GetFirstChild(const wxTreeItemId& item, long& INOUT);
258 wxTreeItemId GetNextChild(const wxTreeItemId& item, long& INOUT);
259 wxTreeItemId GetNextSibling(const wxTreeItemId& item);
260 wxTreeItemId GetPrevSibling(const wxTreeItemId& item);
261 wxTreeItemId GetFirstVisibleItem();
262 wxTreeItemId GetNextVisible(const wxTreeItemId& item);
263 wxTreeItemId GetPrevVisible(const wxTreeItemId& item);
264
265
266 wxTreeItemId AddRoot(const wxString& text,
267 int image = -1, int selectedImage = -1,
268 wxTreeItemData *data = NULL);
269 wxTreeItemId PrependItem(const wxTreeItemId& parent,
270 const wxString& text,
271 int image = -1, int selectedImage = -1,
272 wxTreeItemData *data = NULL);
273 wxTreeItemId InsertItem(const wxTreeItemId& parent,
274 const wxTreeItemId& idPrevious,
275 const wxString& text,
276 int image = -1, int selectedImage = -1,
277 wxTreeItemData *data = NULL);
278 wxTreeItemId AppendItem(const wxTreeItemId& parent,
279 const wxString& text,
280 int image = -1, int selectedImage = -1,
281 wxTreeItemData *data = NULL);
282
283 void Delete(const wxTreeItemId& item);
284 void DeleteAllItems();
285
286 void Expand(const wxTreeItemId& item);
287 void Collapse(const wxTreeItemId& item);
288 void CollapseAndReset(const wxTreeItemId& item);
289 void Toggle(const wxTreeItemId& item);
290
291 void Unselect();
292 void SelectItem(const wxTreeItemId& item);
293 void EnsureVisible(const wxTreeItemId& item);
294 void ScrollTo(const wxTreeItemId& item);
295
296 wxTextCtrl* EditLabel(const wxTreeItemId& item);
297 // **** figure out how to do this
298 // wxClassInfo* textCtrlClass = CLASSINFO(wxTextCtrl));
299 wxTextCtrl* GetEditControl();
300 void EndEditLabel(const wxTreeItemId& item, bool discardChanges = FALSE);
301
60e05667 302// void SortChildren(const wxTreeItemId& item);
d5c9047a
RD
303 // **** And this too
304 // wxTreeItemCmpFunc *cmpFunction = NULL);
305
b8b8dda7
RD
306 void SetItemBold(const wxTreeItemId& item, bool bold = TRUE);
307 bool IsBold(const wxTreeItemId& item) const;
308 wxTreeItemId HitTest(const wxPoint& point);
d5c9047a
RD
309};
310
d5c9047a 311
7bf85405
RD
312//----------------------------------------------------------------------
313
9c039d08 314#ifdef SKIPTHIS
fb5e0af0 315#ifdef __WXMSW__
7bf85405
RD
316class wxTabEvent : public wxCommandEvent {
317public:
318};
319
320
321
322class wxTabCtrl : public wxControl {
323public:
324 wxTabCtrl(wxWindow* parent, wxWindowID id,
325 const wxPoint& pos = wxPyDefaultPosition,
326 const wxSize& size = wxPyDefaultSize,
327 long style = 0,
328 char* name = "tabCtrl");
329
b8b8dda7 330 %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)"
9c039d08 331
7bf85405
RD
332 bool DeleteAllItems();
333 bool DeleteItem(int item);
334 wxImageList* GetImageList();
335 int GetItemCount();
336 // TODO: void* GetItemData();
337 int GetItemImage(int item);
338
339 %addmethods {
340 %new wxRect* GetItemRect(int item) {
341 wxRect* rect = new wxRect;
342 self->GetItemRect(item, *rect);
343 return rect;
344 }
345 }
346
347 wxString GetItemText(int item);
348 bool GetRowCount();
349 int GetSelection();
350 int HitTest(const wxPoint& pt, long& OUTPUT);
351 void InsertItem(int item, const wxString& text,
352 int imageId = -1, void* clientData = NULL);
353 // TODO: bool SetItemData(int item, void* data);
354 bool SetItemImage(int item, int image);
355 void SetImageList(wxImageList* imageList);
356 void SetItemSize(const wxSize& size);
357 bool SetItemText(int item, const wxString& text);
358 void SetPadding(const wxSize& padding);
359 int SetSelection(int item);
360
361};
362
9c039d08 363#endif
fb5e0af0
RD
364#endif
365
7bf85405
RD
366//----------------------------------------------------------------------
367
368
369/////////////////////////////////////////////////////////////////////////////
370//
371// $Log$
4f22cf8d
RR
372// Revision 1.13 1998/12/17 14:07:34 RR
373// Removed minor differences between wxMSW and wxGTK
374//
105e45b9 375// Revision 1.12 1998/12/16 22:10:52 RD
4f22cf8d 376//
105e45b9
RD
377// Tweaks needed to be able to build wxPython with wxGTK.
378//
b8b8dda7
RD
379// Revision 1.11 1998/12/15 20:41:16 RD
380// Changed the import semantics from "from wxPython import *" to "from
381// wxPython.wx import *" This is for people who are worried about
382// namespace pollution, they can use "from wxPython import wx" and then
383// prefix all the wxPython identifiers with "wx."
384//
385// Added wxTaskbarIcon for wxMSW.
386//
387// Made the events work for wxGrid.
388//
389// Added wxConfig.
390//
391// Added wxMiniFrame for wxGTK, (untested.)
392//
393// Changed many of the args and return values that were pointers to gdi
394// objects to references to reflect changes in the wxWindows API.
395//
396// Other assorted fixes and additions.
397//
b639c3c5 398// Revision 1.10 1998/11/25 08:45:23 RD
b8b8dda7 399//
b639c3c5
RD
400// Added wxPalette, wxRegion, wxRegionIterator, wxTaskbarIcon
401// Added events for wxGrid
402// Other various fixes and additions
403//
62bd0874
RD
404// Revision 1.9 1998/11/16 00:00:54 RD
405// Generic treectrl for wxPython/GTK compiles...
406//
60e05667
RD
407// Revision 1.8 1998/11/11 04:40:20 RD
408// wxTreeCtrl now works (sort of) for wxPython-GTK. This is the new
409// TreeCtrl in src/gtk/treectrl.cpp not the old generic one.
410//
630d84f2 411// Revision 1.7 1998/11/11 03:12:25 RD
60e05667 412//
630d84f2
RD
413// Additions for wxTreeCtrl
414//
d5c9047a
RD
415// Revision 1.6 1998/10/20 06:43:55 RD
416// New wxTreeCtrl wrappers (untested)
417// some changes in helpers
418// etc.
419//
b26e2dc4
RD
420// Revision 1.5 1998/10/07 07:34:33 RD
421// Version 0.4.1 for wxGTK
422//
9c039d08 423// Revision 1.4 1998/10/02 06:40:36 RD
b26e2dc4 424//
9c039d08
RD
425// Version 0.4 of wxPython for MSW.
426//
fb5e0af0
RD
427// Revision 1.3 1998/08/18 19:48:15 RD
428// more wxGTK compatibility things.
429//
430// It builds now but there are serious runtime problems...
431//
03e9bead
RD
432// Revision 1.2 1998/08/15 07:36:30 RD
433// - Moved the header in the .i files out of the code that gets put into
434// the .cpp files. It caused CVS conflicts because of the RCS ID being
435// different each time.
436//
437// - A few minor fixes.
438//
7bf85405
RD
439// Revision 1.1 1998/08/09 08:25:49 RD
440// Initial version
441//
442//