]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/listctrl.h
Add wxDirCtrl::GetPath().
[wxWidgets.git] / interface / wx / listctrl.h
CommitLineData
23324ae1 1/////////////////////////////////////////////////////////////////////////////
80cc5fc7 2// Name: wx/listctrl.h
e54c96f1 3// Purpose: interface of wxListCtrl
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
526954c5 6// Licence: wxWindows licence
23324ae1
FM
7/////////////////////////////////////////////////////////////////////////////
8
0ffc1704
RD
9/// style flags
10#define wxLC_VRULES 0x0001
11#define wxLC_HRULES 0x0002
12
13#define wxLC_ICON 0x0004
14#define wxLC_SMALL_ICON 0x0008
15#define wxLC_LIST 0x0010
16#define wxLC_REPORT 0x0020
17
18#define wxLC_ALIGN_TOP 0x0040
19#define wxLC_ALIGN_LEFT 0x0080
20#define wxLC_AUTOARRANGE 0x0100
21#define wxLC_VIRTUAL 0x0200
22#define wxLC_EDIT_LABELS 0x0400
23#define wxLC_NO_HEADER 0x0800
24#define wxLC_NO_SORT_HEADER 0x1000
25#define wxLC_SINGLE_SEL 0x2000
26#define wxLC_SORT_ASCENDING 0x4000
27#define wxLC_SORT_DESCENDING 0x8000
28
29#define wxLC_MASK_TYPE (wxLC_ICON | wxLC_SMALL_ICON | wxLC_LIST | wxLC_REPORT)
30#define wxLC_MASK_ALIGN (wxLC_ALIGN_TOP | wxLC_ALIGN_LEFT)
31#define wxLC_MASK_SORT (wxLC_SORT_ASCENDING | wxLC_SORT_DESCENDING)
32
33
34/// Mask flags to tell app/GUI what fields of wxListItem are valid
35#define wxLIST_MASK_STATE 0x0001
36#define wxLIST_MASK_TEXT 0x0002
37#define wxLIST_MASK_IMAGE 0x0004
38#define wxLIST_MASK_DATA 0x0008
39#define wxLIST_SET_ITEM 0x0010
40#define wxLIST_MASK_WIDTH 0x0020
41#define wxLIST_MASK_FORMAT 0x0040
42
43/// State flags for indicating the state of an item
44#define wxLIST_STATE_DONTCARE 0x0000
45#define wxLIST_STATE_DROPHILITED 0x0001 // MSW only
46#define wxLIST_STATE_FOCUSED 0x0002
47#define wxLIST_STATE_SELECTED 0x0004
48#define wxLIST_STATE_CUT 0x0008 // MSW only
49#define wxLIST_STATE_DISABLED 0x0010 // OS2 only
50#define wxLIST_STATE_FILTERED 0x0020 // OS2 only
51#define wxLIST_STATE_INUSE 0x0040 // OS2 only
52#define wxLIST_STATE_PICKED 0x0080 // OS2 only
53#define wxLIST_STATE_SOURCE 0x0100 // OS2 only
54
55/// Hit test flags, used in HitTest
56#define wxLIST_HITTEST_ABOVE 0x0001 // Above the client area.
57#define wxLIST_HITTEST_BELOW 0x0002 // Below the client area.
58#define wxLIST_HITTEST_NOWHERE 0x0004 // In the client area but below the last item.
59#define wxLIST_HITTEST_ONITEMICON 0x0020 // On the bitmap associated with an item.
60#define wxLIST_HITTEST_ONITEMLABEL 0x0080 // On the label (string) associated with an item.
61#define wxLIST_HITTEST_ONITEMRIGHT 0x0100 // In the area to the right of an item.
62#define wxLIST_HITTEST_ONITEMSTATEICON 0x0200 // On the state icon for a tree view item that is in a user-defined state.
63#define wxLIST_HITTEST_TOLEFT 0x0400 // To the left of the client area.
64#define wxLIST_HITTEST_TORIGHT 0x0800 // To the right of the client area.
65
66#define wxLIST_HITTEST_ONITEM (wxLIST_HITTEST_ONITEMICON | wxLIST_HITTEST_ONITEMLABEL | wxLIST_HITTEST_ONITEMSTATEICON)
67
68/// GetSubItemRect constants
69#define wxLIST_GETSUBITEMRECT_WHOLEITEM -1l
70
71/// Flags for GetNextItem (MSW only except wxLIST_NEXT_ALL)
72enum
73{
74 wxLIST_NEXT_ABOVE, // Searches for an item above the specified item
75 wxLIST_NEXT_ALL, // Searches for subsequent item by index
76 wxLIST_NEXT_BELOW, // Searches for an item below the specified item
77 wxLIST_NEXT_LEFT, // Searches for an item to the left of the specified item
78 wxLIST_NEXT_RIGHT // Searches for an item to the right of the specified item
79};
80
81/// Alignment flags for Arrange (MSW only except wxLIST_ALIGN_LEFT)
82enum
83{
84 wxLIST_ALIGN_DEFAULT,
85 wxLIST_ALIGN_LEFT,
86 wxLIST_ALIGN_TOP,
87 wxLIST_ALIGN_SNAP_TO_GRID
88};
89
90/// Column format (MSW only except wxLIST_FORMAT_LEFT)
91enum wxListColumnFormat
92{
93 wxLIST_FORMAT_LEFT,
94 wxLIST_FORMAT_RIGHT,
95 wxLIST_FORMAT_CENTRE,
96 wxLIST_FORMAT_CENTER = wxLIST_FORMAT_CENTRE
97};
98
99/// Autosize values for SetColumnWidth
100enum
101{
102 wxLIST_AUTOSIZE = -1,
103 wxLIST_AUTOSIZE_USEHEADER = -2 // partly supported by generic version
104};
105
106/// Flag values for GetItemRect
107enum
108{
109 wxLIST_RECT_BOUNDS,
110 wxLIST_RECT_ICON,
111 wxLIST_RECT_LABEL
112};
113
114/// Flag values for FindItem (MSW only)
115enum
116{
117 wxLIST_FIND_UP,
118 wxLIST_FIND_DOWN,
119 wxLIST_FIND_LEFT,
120 wxLIST_FIND_RIGHT
121};
122
123
124
125
23324ae1
FM
126/**
127 @class wxListCtrl
7c913512 128
23324ae1
FM
129 A list control presents lists in a number of formats: list view, report view,
130 icon view and small icon view. In any case, elements are numbered from zero.
131 For all these modes, the items are stored in the control and must be added to
132 it using wxListCtrl::InsertItem method.
7c913512 133
23324ae1
FM
134 A special case of report view quite different from the other modes of the list
135 control is a virtual control in which the items data (including text, images
136 and attributes) is managed by the main program and is requested by the control
137 itself only when needed which allows to have controls with millions of items
138 without consuming much memory. To use virtual list control you must use
75504144 139 wxListCtrl::SetItemCount first and override at least wxListCtrl::OnGetItemText
320ab87c
FM
140 (and optionally wxListCtrl::OnGetItemImage or wxListCtrl::OnGetItemColumnImage and
141 wxListCtrl::OnGetItemAttr) to return the information about the items when the
142 control requests it.
5bcb6a69 143
320ab87c
FM
144 Virtual list control can be used as a normal one except that no operations
145 which can take time proportional to the number of items in the control happen
146 -- this is required to allow having a practically infinite number of items.
147 For example, in a multiple selection virtual list control, the selections won't
148 be sent when many items are selected at once because this could mean iterating
149 over all the items.
7c913512 150
23324ae1 151 Using many of wxListCtrl features is shown in the
320ab87c 152 @ref page_samples_listctrl "corresponding sample".
7c913512 153
23324ae1
FM
154 To intercept events from a list control, use the event table macros described
155 in wxListEvent.
7c913512 156
320ab87c
FM
157 <b>wxMac Note</b>: Starting with wxWidgets 2.8, wxListCtrl uses a native
158 implementation for report mode, and uses a generic implementation for other
159 modes. You can use the generic implementation for report mode as well by setting
5bcb6a69 160 the @c mac.listctrl.always_use_generic system option (see wxSystemOptions) to 1.
2e2b4d24 161
7c913512 162
23324ae1 163 @beginStyleTable
8c6791e4 164 @style{wxLC_LIST}
23324ae1
FM
165 Multicolumn list view, with optional small icons. Columns are
166 computed automatically, i.e. you don't set columns as in
5bcb6a69 167 @c wxLC_REPORT. In other words, the list wraps, unlike a wxListBox.
8c6791e4 168 @style{wxLC_REPORT}
23324ae1 169 Single or multicolumn report view, with optional header.
8c6791e4 170 @style{wxLC_VIRTUAL}
23324ae1 171 The application provides items text on demand. May only be used
5bcb6a69 172 with @c wxLC_REPORT.
8c6791e4 173 @style{wxLC_ICON}
23324ae1 174 Large icon view, with optional labels.
8c6791e4 175 @style{wxLC_SMALL_ICON}
23324ae1 176 Small icon view, with optional labels.
8c6791e4 177 @style{wxLC_ALIGN_TOP}
23324ae1 178 Icons align to the top. Win32 default, Win32 only.
8c6791e4 179 @style{wxLC_ALIGN_LEFT}
23324ae1 180 Icons align to the left.
8c6791e4 181 @style{wxLC_AUTOARRANGE}
23324ae1 182 Icons arrange themselves. Win32 only.
8c6791e4 183 @style{wxLC_EDIT_LABELS}
23324ae1
FM
184 Labels are editable: the application will be notified when editing
185 starts.
8c6791e4 186 @style{wxLC_NO_HEADER}
23324ae1 187 No header in report mode.
8c6791e4 188 @style{wxLC_SINGLE_SEL}
23324ae1 189 Single selection (default is multiple).
8c6791e4 190 @style{wxLC_SORT_ASCENDING}
b45506e8
VZ
191 Sort in ascending order. (You must still supply a comparison callback
192 in wxListCtrl::SortItems.)
8c6791e4 193 @style{wxLC_SORT_DESCENDING}
b45506e8
VZ
194 Sort in descending order. (You must still supply a comparison callback
195 in wxListCtrl::SortItems.)
8c6791e4 196 @style{wxLC_HRULES}
23324ae1 197 Draws light horizontal rules between rows in report mode.
8c6791e4 198 @style{wxLC_VRULES}
23324ae1
FM
199 Draws light vertical rules between columns in report mode.
200 @endStyleTable
7c913512 201
2e2b4d24 202
3051a44a 203 @beginEventEmissionTable{wxListEvent}
2e2b4d24
RR
204 @event{EVT_LIST_BEGIN_DRAG(id, func)}
205 Begin dragging with the left mouse button.
232fdc63 206 Processes a @c wxEVT_COMMAND_LIST_BEGIN_DRAG event type.
2e2b4d24 207 @event{EVT_LIST_BEGIN_RDRAG(id, func)}
232fdc63
VZ
208 Begin dragging with the right mouse button.
209 Processes a @c wxEVT_COMMAND_LIST_BEGIN_RDRAG event type.
210 @event{EVT_BEGIN_LABEL_EDIT(id, func)}
2e2b4d24 211 Begin editing a label. This can be prevented by calling Veto().
232fdc63 212 Processes a @c wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT event type.
2e2b4d24
RR
213 @event{EVT_LIST_END_LABEL_EDIT(id, func)}
214 Finish editing a label. This can be prevented by calling Veto().
232fdc63 215 Processes a @c wxEVT_COMMAND_LIST_END_LABEL_EDIT event type.
2e2b4d24
RR
216 @event{EVT_LIST_DELETE_ITEM(id, func)}
217 An item was deleted.
232fdc63 218 Processes a @c wxEVT_COMMAND_LIST_DELETE_ITEM event type.
2e2b4d24
RR
219 @event{EVT_LIST_DELETE_ALL_ITEMS(id, func)}
220 All items were deleted.
232fdc63 221 Processes a @c wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS event type.
2e2b4d24
RR
222 @event{EVT_LIST_ITEM_SELECTED(id, func)}
223 The item has been selected.
232fdc63 224 Processes a @c wxEVT_COMMAND_LIST_ITEM_SELECTED event type.
2e2b4d24
RR
225 @event{EVT_LIST_ITEM_DESELECTED(id, func)}
226 The item has been deselected.
232fdc63 227 Processes a @c wxEVT_COMMAND_LIST_ITEM_DESELECTED event type.
2e2b4d24
RR
228 @event{EVT_LIST_ITEM_ACTIVATED(id, func)}
229 The item has been activated (ENTER or double click).
232fdc63 230 Processes a @c wxEVT_COMMAND_LIST_ITEM_ACTIVATED event type.
2e2b4d24
RR
231 @event{EVT_LIST_ITEM_FOCUSED(id, func)}
232 The currently focused item has changed.
232fdc63 233 Processes a @c wxEVT_COMMAND_LIST_ITEM_FOCUSED event type.
2e2b4d24 234 @event{EVT_LIST_ITEM_MIDDLE_CLICK(id, func)}
232fdc63
VZ
235 The middle mouse button has been clicked on an item. This is
236 only supported by the generic control.
237 Processes a @c wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK event type.
2e2b4d24 238 @event{EVT_LIST_ITEM_RIGHT_CLICK(id, func)}
320ab87c 239 The right mouse button has been clicked on an item.
232fdc63 240 Processes a @c wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK event type.
2e2b4d24
RR
241 @event{EVT_LIST_KEY_DOWN(id, func)}
242 A key has been pressed.
232fdc63 243 Processes a @c wxEVT_COMMAND_LIST_KEY_DOWN event type.
2e2b4d24
RR
244 @event{EVT_LIST_INSERT_ITEM(id, func)}
245 An item has been inserted.
232fdc63 246 Processes a @c wxEVT_COMMAND_LIST_INSERT_ITEM event type.
2e2b4d24
RR
247 @event{EVT_LIST_COL_CLICK(id, func)}
248 A column (m_col) has been left-clicked.
232fdc63 249 Processes a @c wxEVT_COMMAND_LIST_COL_CLICK event type.
2e2b4d24
RR
250 @event{EVT_LIST_COL_RIGHT_CLICK(id, func)}
251 A column (m_col) has been right-clicked.
232fdc63 252 Processes a @c wxEVT_COMMAND_LIST_COL_RIGHT_CLICK event type.
2e2b4d24
RR
253 @event{EVT_LIST_COL_BEGIN_DRAG(id, func)}
254 The user started resizing a column - can be vetoed.
232fdc63 255 Processes a @c wxEVT_COMMAND_LIST_COL_BEGIN_DRAG event type.
2e2b4d24
RR
256 @event{EVT_LIST_COL_DRAGGING(id, func)}
257 The divider between columns is being dragged.
232fdc63 258 Processes a @c wxEVT_COMMAND_LIST_COL_DRAGGING event type.
2e2b4d24
RR
259 @event{EVT_LIST_COL_END_DRAG(id, func)}
260 A column has been resized by the user.
232fdc63 261 Processes a @c wxEVT_COMMAND_LIST_COL_END_DRAG event type.
2e2b4d24
RR
262 @event{EVT_LIST_CACHE_HINT(id, func)}
263 Prepare cache for a virtual list control.
232fdc63 264 Processes a @c wxEVT_COMMAND_LIST_CACHE_HINT event type.
2e2b4d24
RR
265 @endEventTable
266
267
23324ae1
FM
268 @library{wxcore}
269 @category{ctrl}
7e59b885 270 @appearance{listctrl.png}
7c913512 271
320ab87c
FM
272 @see @ref overview_listctrl, wxListView, wxListBox, wxTreeCtrl, wxImageList,
273 wxListEvent, wxListItem, wxEditableListBox
23324ae1
FM
274*/
275class wxListCtrl : public wxControl
276{
277public:
b45506e8 278 /**
1d7c0c08 279 Default constructor.
b45506e8
VZ
280 */
281 wxListCtrl();
282
23324ae1
FM
283 /**
284 Constructor, creating and showing a list control.
3c4f71cc 285
7c913512 286 @param parent
4cc4bfaf 287 Parent window. Must not be @NULL.
7c913512 288 @param id
4cc4bfaf 289 Window identifier. The value wxID_ANY indicates a default value.
7c913512 290 @param pos
4cc4bfaf 291 Window position.
dc1b07fd 292 If ::wxDefaultPosition is specified then a default position is chosen.
7c913512 293 @param size
320ab87c 294 Window size.
dc1b07fd 295 If ::wxDefaultSize is specified then the window is sized appropriately.
7c913512 296 @param style
4cc4bfaf 297 Window style. See wxListCtrl.
7c913512 298 @param validator
4cc4bfaf 299 Window validator.
7c913512 300 @param name
4cc4bfaf 301 Window name.
3c4f71cc 302
4cc4bfaf 303 @see Create(), wxValidator
23324ae1 304 */
7c913512
FM
305 wxListCtrl(wxWindow* parent, wxWindowID id,
306 const wxPoint& pos = wxDefaultPosition,
307 const wxSize& size = wxDefaultSize,
308 long style = wxLC_ICON,
309 const wxValidator& validator = wxDefaultValidator,
310 const wxString& name = wxListCtrlNameStr);
23324ae1
FM
311
312 /**
313 Destructor, destroying the list control.
314 */
adaaa686 315 virtual ~wxListCtrl();
23324ae1 316
c23edb1b
VZ
317 /**
318 Adds a new column to the list control in report view mode.
319
320 This is just a convenient wrapper for InsertColumn() which adds the new
321 column after all the existing ones without having to specify its
322 position explicitly.
323
324 @since 2.9.4
325 */
326 long AppendColumn(const wxString& heading,
327 int format = wxLIST_FORMAT_LEFT,
328 int width = -1);
329
23324ae1 330 /**
320ab87c
FM
331 Arranges the items in icon or small icon view.
332 This only has effect on Win32. @a flag is one of:
1d7c0c08
RR
333 - wxLIST_ALIGN_DEFAULT: Default alignment.
334 - wxLIST_ALIGN_LEFT: Align to the left side of the control.
335 - wxLIST_ALIGN_TOP: Align to the top side of the control.
336 - wxLIST_ALIGN_SNAP_TO_GRID: Snap to grid.
23324ae1
FM
337 */
338 bool Arrange(int flag = wxLIST_ALIGN_DEFAULT);
339
340 /**
320ab87c
FM
341 Sets the image list associated with the control and takes ownership of it
342 (i.e. the control will, unlike when using SetImageList(), delete the list
343 when destroyed). @a which is one of @c wxIMAGE_LIST_NORMAL, @c wxIMAGE_LIST_SMALL,
344 @c wxIMAGE_LIST_STATE (the last is unimplemented).
3c4f71cc 345
4cc4bfaf 346 @see SetImageList()
23324ae1
FM
347 */
348 void AssignImageList(wxImageList* imageList, int which);
349
350 /**
351 Deletes all items and all columns.
232fdc63
VZ
352
353 @note This sends an event of type @c wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS
354 under all platforms.
23324ae1
FM
355 */
356 void ClearAll();
357
358 /**
359 Creates the list control. See wxListCtrl() for further details.
360 */
361 bool Create(wxWindow* parent, wxWindowID id,
362 const wxPoint& pos = wxDefaultPosition,
363 const wxSize& size = wxDefaultSize,
364 long style = wxLC_ICON,
365 const wxValidator& validator = wxDefaultValidator,
366 const wxString& name = wxListCtrlNameStr);
367
368 /**
369 Deletes all items in the list control.
320ab87c 370
4b97af90
VZ
371 This function does @e not send the @c wxEVT_COMMAND_LIST_DELETE_ITEM
372 event because deleting many items from the control would be too slow
373 then (unlike wxListCtrl::DeleteItem) but it does send the special @c
374 wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS event if the control was not empty.
375 If it was already empty, nothing is done and no event is sent.
376
377 @return @true if the items were successfully deleted or if the control
378 was already empty, @false if an error occurred while deleting the
379 items.
23324ae1
FM
380 */
381 bool DeleteAllItems();
382
383 /**
384 Deletes a column.
385 */
386 bool DeleteColumn(int col);
387
388 /**
320ab87c
FM
389 Deletes the specified item.
390 This function sends the @c wxEVT_COMMAND_LIST_DELETE_ITEM event for the
391 item being deleted.
392
393 @see DeleteAllItems()
23324ae1
FM
394 */
395 bool DeleteItem(long item);
396
397 /**
320ab87c
FM
398 Starts editing the label of the given item.
399
400 This function generates a @c EVT_LIST_BEGIN_LABEL_EDIT event which can be
401 vetoed so that no text control will appear for in-place editing.
402
23324ae1 403 If the user changed the label (i.e. s/he does not press ESC or leave
320ab87c 404 the text control without changes, a @c EVT_LIST_END_LABEL_EDIT event
23324ae1
FM
405 will be sent which can be vetoed as well.
406 */
5267aefd 407 wxTextCtrl* EditLabel(long item,
b19b28c8 408 wxClassInfo* textControlClass = wxCLASSINFO(wxTextCtrl));
23324ae1 409
d34d31f6
VZ
410 /**
411 Enable or disable a beep if there is no match for the currently
412 entered text when searching for the item from keyboard.
413
414 The default is to not beep in this case except in wxMSW where the
415 beep is always generated by the native control and cannot be disabled,
416 i.e. calls to this function do nothing there.
417
418 @since 2.9.5
419 */
d01c1746 420 void EnableBellOnNoMatch(bool on = true);
d34d31f6 421
747eb0f6
VZ
422 /**
423 Finish editing the label.
424
425 This method allows to programmatically end editing a list control item
426 in place. Usually it will only be called when editing is in progress,
417b8fcc
VZ
427 i.e. if GetEditControl() returns non-NULL. In particular, do not call
428 it from EVT_LIST_BEGIN_LABEL_EDIT handler as the edit control is not
429 yet fully created by then, just veto the event in this handler instead
430 to prevent the editing from even starting.
431
432 Notice that calling this method will result in EVT_LIST_END_LABEL_EDIT
433 event being generated.
747eb0f6
VZ
434
435 Currently only implemented in wxMSW.
436
437 @param cancel If @true, discard the changes made by user, as if @c
438 Escape key was pressed. Otherwise, accept the changes as if @c
439 Return was pressed.
440 @return @true if item editing wad finished or @false if no item as
441 being edited.
442 */
443 bool EndEditLabel(bool cancel);
444
23324ae1
FM
445 /**
446 Ensures this item is visible.
447 */
448 bool EnsureVisible(long item);
449
23324ae1 450 /**
320ab87c
FM
451 Find an item whose label matches this string, starting from start or the
452 beginning if start is @c -1. The string comparison is case insensitive.
453
454 If @a partial is @true then this method will look for items which begin with @a str.
c2ebca9b
VZ
455
456 @return The next matching item if any or @c -1 (wxNOT_FOUND) otherwise.
23324ae1
FM
457 */
458 long FindItem(long start, const wxString& str,
4cc4bfaf 459 bool partial = false);
320ab87c 460
1d7c0c08 461 /**
320ab87c
FM
462 Find an item whose data matches this data, starting from start or the
463 beginning if 'start' is @c -1.
1058f652
MB
464
465 @beginWxPerlOnly
466 In wxPerl this method is implemented as FindItemData(start, data).
467 @endWxPerlOnly
c2ebca9b
VZ
468
469 @return The next matching item if any or @c -1 (wxNOT_FOUND) otherwise.
1d7c0c08 470 */
0a98423e 471 long FindItem(long start, wxUIntPtr data);
320ab87c 472
1d7c0c08
RR
473 /**
474 Find an item nearest this position in the specified direction,
475 starting from @a start or the beginning if @a start is -1.
1058f652
MB
476
477 @beginWxPerlOnly
478 In wxPerl this method is implemented as FindItemAtPos(start, pt, direction).
479 @endWxPerlOnly
c2ebca9b
VZ
480
481 @return The next matching item if any or @c -1 (wxNOT_FOUND) otherwise.
1d7c0c08 482 */
7c913512 483 long FindItem(long start, const wxPoint& pt, int direction);
23324ae1
FM
484
485 /**
320ab87c
FM
486 Gets information about this column.
487 See SetItem() for more information.
1058f652
MB
488
489 @beginWxPerlOnly
490 In wxPerl this method takes only the @a col parameter and
491 returns a @c Wx::ListItem (or @c undef).
492 @endWxPerlOnly
23324ae1 493 */
328f5751 494 bool GetColumn(int col, wxListItem& item) const;
23324ae1
FM
495
496 /**
497 Returns the number of columns.
498 */
328f5751 499 int GetColumnCount() const;
23324ae1
FM
500
501 /**
80cc5fc7
VZ
502 Gets the column index from its position in visual order.
503
504 After calling SetColumnsOrder(), the index returned by this function
505 corresponds to the value of the element number @a pos in the array
506 returned by GetColumnsOrder().
507
508 Please see SetColumnsOrder() documentation for an example and
509 additional remarks about the columns ordering.
510
511 @see GetColumnOrder()
23324ae1 512 */
80cc5fc7 513 int GetColumnIndexFromOrder(int pos) const;
23324ae1
FM
514
515 /**
80cc5fc7
VZ
516 Gets the column visual order position.
517
518 This function returns the index of the column which appears at the
519 given visual position, e.g. calling it with @a col equal to 0 returns
520 the index of the first shown column.
521
522 Please see SetColumnsOrder() documentation for an example and
523 additional remarks about the columns ordering.
524
525 @see GetColumnsOrder(), GetColumnIndexFromOrder()
23324ae1 526 */
328f5751 527 int GetColumnOrder(int col) const;
23324ae1
FM
528
529 /**
530 Gets the column width (report view only).
531 */
328f5751 532 int GetColumnWidth(int col) const;
23324ae1
FM
533
534 /**
320ab87c 535 Returns the array containing the orders of all columns.
80cc5fc7 536
320ab87c 537 On error, an empty array is returned.
80cc5fc7
VZ
538
539 Please see SetColumnsOrder() documentation for an example and
540 additional remarks about the columns ordering.
541
542 @see GetColumnOrder(), GetColumnIndexFromOrder()
23324ae1 543 */
328f5751 544 wxArrayInt GetColumnsOrder() const;
23324ae1
FM
545
546 /**
320ab87c
FM
547 Gets the number of items that can fit vertically in the visible area of
548 the list control (list or report view) or the total number of items in
549 the list control (icon or small icon view).
23324ae1 550 */
328f5751 551 int GetCountPerPage() const;
23324ae1
FM
552
553 /**
320ab87c
FM
554 Returns the edit control being currently used to edit a label.
555 Returns @NULL if no label is being edited.
556
1f1d2182 557 @note It is currently only implemented for wxMSW and the generic version,
320ab87c 558 not for the native Mac OS X version.
23324ae1 559 */
328f5751 560 wxTextCtrl* GetEditControl() const;
23324ae1
FM
561
562 /**
4cc4bfaf 563 Returns the specified image list. @a which may be one of:
1d7c0c08
RR
564 - wxIMAGE_LIST_NORMAL: The normal (large icon) image list.
565 - wxIMAGE_LIST_SMALL: The small icon image list.
566 - wxIMAGE_LIST_STATE: The user-defined state image list (unimplemented).
23324ae1 567 */
328f5751 568 wxImageList* GetImageList(int which) const;
23324ae1
FM
569
570 /**
320ab87c 571 Gets information about the item. See SetItem() for more information.
c86b476d
FM
572
573 You must call @e info.SetId() to set the ID of item you're interested in
574 before calling this method, and @e info.SetMask() with the flags indicating
575 what fields you need to retrieve from @a info.
1058f652
MB
576
577 @beginWxPerlOnly
578 In wxPerl this method takes as parameter the ID of the item
579 and (optionally) the column, and returns a Wx::ListItem object.
580 @endWxPerlOnly
23324ae1 581 */
328f5751 582 bool GetItem(wxListItem& info) const;
23324ae1
FM
583
584 /**
320ab87c
FM
585 Returns the colour for this item.
586 If the item has no specific colour, returns an invalid colour
587 (and not the default background control of the control itself).
3c4f71cc 588
4cc4bfaf 589 @see GetItemTextColour()
23324ae1 590 */
328f5751 591 wxColour GetItemBackgroundColour(long item) const;
23324ae1
FM
592
593 /**
594 Returns the number of items in the list control.
595 */
328f5751 596 int GetItemCount() const;
23324ae1
FM
597
598 /**
599 Gets the application-defined data associated with this item.
600 */
5267aefd 601 wxUIntPtr GetItemData(long item) const;
23324ae1
FM
602
603 /**
604 Returns the item's font.
605 */
328f5751 606 wxFont GetItemFont(long item) const;
23324ae1
FM
607
608 /**
609 Returns the position of the item, in icon or small icon view.
1058f652
MB
610
611 @beginWxPerlOnly
612 In wxPerl this method takes only the @a item parameter and
613 returns a @c Wx::Point (or @c undef).
614 @endWxPerlOnly
23324ae1 615 */
328f5751 616 bool GetItemPosition(long item, wxPoint& pos) const;
23324ae1
FM
617
618 /**
619 Returns the rectangle representing the item's size and position, in physical
620 coordinates.
320ab87c 621
4cc4bfaf 622 @a code is one of wxLIST_RECT_BOUNDS, wxLIST_RECT_ICON, wxLIST_RECT_LABEL.
1058f652
MB
623
624 @beginWxPerlOnly
625 In wxPerl this method takes only the @a item and @a code parameters and
626 returns a @c Wx::Rect (or @c undef).
627 @endWxPerlOnly
23324ae1
FM
628 */
629 bool GetItemRect(long item, wxRect& rect,
328f5751 630 int code = wxLIST_RECT_BOUNDS) const;
23324ae1
FM
631
632 /**
320ab87c
FM
633 Retrieves the spacing between icons in pixels: horizontal spacing is
634 returned as @c x component of the wxSize object and the vertical spacing
635 as its @c y component.
23324ae1 636 */
328f5751 637 wxSize GetItemSpacing() const;
23324ae1
FM
638
639 /**
640 Gets the item state. For a list of state flags, see SetItem().
320ab87c 641 The @a stateMask indicates which state flags are of interest.
23324ae1 642 */
328f5751 643 int GetItemState(long item, long stateMask) const;
23324ae1
FM
644
645 /**
646 Gets the item text for this item.
b6812a6f
VZ
647
648 @param item
649 Item (zero-based) index.
650 @param col
651 Item column (zero-based) index. Column 0 is the default. This
652 parameter is new in wxWidgets 2.9.1.
23324ae1 653 */
b6812a6f 654 wxString GetItemText(long item, int col = 0) const;
23324ae1
FM
655
656 /**
320ab87c
FM
657 Returns the colour for this item.
658
659 If the item has no specific colour, returns an invalid colour (and not the
660 default foreground control of the control itself as this wouldn't allow
661 distinguishing between items having the same colour as the current control
662 foreground and items with default colour which, hence, have always the
663 same colour as the control).
23324ae1 664 */
328f5751 665 wxColour GetItemTextColour(long item) const;
23324ae1
FM
666
667 /**
668 Searches for an item with the given geometry or state, starting from
320ab87c 669 @a item but excluding the @a item itself.
3c4f71cc 670
320ab87c
FM
671 If @a item is -1, the first item that matches the specified flags will be returned.
672 Returns the first item with given state following @a item or -1 if no such item found.
673 This function may be used to find all selected items in the control like this:
3c4f71cc 674
320ab87c
FM
675 @code
676 long item = -1;
677 for ( ;; )
678 {
679 item = listctrl->GetNextItem(item,
680 wxLIST_NEXT_ALL,
681 wxLIST_STATE_SELECTED);
682 if ( item == -1 )
683 break;
684
685 // this item is selected - do whatever is needed with it
686 wxLogMessage("Item %ld is selected.", item);
687 }
688 @endcode
3c4f71cc 689
320ab87c
FM
690 @a geometry can be one of:
691 - wxLIST_NEXT_ABOVE: Searches for an item above the specified item.
692 - wxLIST_NEXT_ALL: Searches for subsequent item by index.
693 - wxLIST_NEXT_BELOW: Searches for an item below the specified item.
694 - wxLIST_NEXT_LEFT: Searches for an item to the left of the specified item.
695 - wxLIST_NEXT_RIGHT: Searches for an item to the right of the specified item.
3c4f71cc 696
1f1d2182 697 @note this parameter is only supported by wxMSW currently and ignored on
320ab87c 698 other platforms.
3c4f71cc 699
320ab87c
FM
700 @a state can be a bitlist of the following:
701 - wxLIST_STATE_DONTCARE: Don't care what the state is.
702 - wxLIST_STATE_DROPHILITED: The item indicates it is a drop target.
703 - wxLIST_STATE_FOCUSED: The item has the focus.
704 - wxLIST_STATE_SELECTED: The item is selected.
705 - wxLIST_STATE_CUT: The item is selected as part of a cut and paste operation.
23324ae1
FM
706 */
707 long GetNextItem(long item, int geometry = wxLIST_NEXT_ALL,
328f5751 708 int state = wxLIST_STATE_DONTCARE) const;
23324ae1
FM
709
710 /**
711 Returns the number of selected items in the list control.
712 */
328f5751 713 int GetSelectedItemCount() const;
23324ae1
FM
714
715 /**
716 Returns the rectangle representing the size and position, in physical
4cc4bfaf 717 coordinates, of the given subitem, i.e. the part of the row @a item in the
320ab87c
FM
718 column @a subItem.
719
d13b34d3 720 This method is only meaningful when the wxListCtrl is in the report mode.
320ab87c 721 If @a subItem parameter is equal to the special value
23324ae1
FM
722 @c wxLIST_GETSUBITEMRECT_WHOLEITEM the return value is the same as
723 for GetItemRect().
320ab87c
FM
724
725 @a code can be one of @c wxLIST_RECT_BOUNDS, @c wxLIST_RECT_ICON or
726 @c wxLIST_RECT_LABEL.
3c4f71cc 727
1e24c2af 728 @since 2.7.0
23324ae1
FM
729 */
730 bool GetSubItemRect(long item, long subItem, wxRect& rect,
328f5751 731 int code = wxLIST_RECT_BOUNDS) const;
23324ae1
FM
732
733 /**
734 Gets the text colour of the list control.
735 */
328f5751 736 wxColour GetTextColour() const;
23324ae1
FM
737
738 /**
320ab87c 739 Gets the index of the topmost visible item when in list or report view.
23324ae1 740 */
328f5751 741 long GetTopItem() const;
23324ae1
FM
742
743 /**
744 Returns the rectangle taken by all items in the control. In other words, if the
745 controls client size were equal to the size of this rectangle, no scrollbars
746 would be needed and no free space would be left.
320ab87c 747
23324ae1
FM
748 Note that this function only works in the icon and small icon views, not in
749 list or report views (this is a limitation of the native Win32 control).
750 */
328f5751 751 wxRect GetViewRect() const;
23324ae1
FM
752
753 /**
320ab87c
FM
754 Determines which item (if any) is at the specified point, giving details
755 in @a flags. Returns index of the item or @c wxNOT_FOUND if no item is at
756 the specified point.
3c4f71cc 757
320ab87c
FM
758 @a flags will be a combination of the following flags:
759 - wxLIST_HITTEST_ABOVE: Above the client area.
760 - wxLIST_HITTEST_BELOW: Below the client area.
761 - wxLIST_HITTEST_NOWHERE: In the client area but below the last item.
762 - wxLIST_HITTEST_ONITEMICON: On the bitmap associated with an item.
763 - wxLIST_HITTEST_ONITEMLABEL: On the label (string) associated with an item.
764 - wxLIST_HITTEST_ONITEMRIGHT: In the area to the right of an item.
765 - wxLIST_HITTEST_ONITEMSTATEICON: On the state icon for a tree view item
766 that is in a user-defined state.
767 - wxLIST_HITTEST_TOLEFT: To the right of the client area.
768 - wxLIST_HITTEST_TORIGHT: To the left of the client area.
769 - wxLIST_HITTEST_ONITEM: Combination of @c wxLIST_HITTEST_ONITEMICON,
770 @c wxLIST_HITTEST_ONITEMLABEL, @c wxLIST_HITTEST_ONITEMSTATEICON.
3c4f71cc 771
4cc4bfaf 772 If @a ptrSubItem is not @NULL and the wxListCtrl is in the report
7c913512 773 mode the subitem (or column) number will also be provided.
23324ae1
FM
774 This feature is only available in version 2.7.0 or higher and is currently only
775 implemented under wxMSW and requires at least comctl32.dll of verion 4.70 on
320ab87c
FM
776 the host system or the value stored in @a ptrSubItem will be always -1.
777 To compile this feature into wxWidgets library you need to have access to
23324ae1 778 commctrl.h of version 4.70 that is provided by Microsoft.
1058f652
MB
779
780 @beginWxPerlOnly
781 In wxPerl this method only takes the @a point parameter
782 and returns a 2-element list (item, flags).
783 @endWxPerlOnly
23324ae1 784 */
5267aefd 785 long HitTest(const wxPoint& point, int& flags, long* ptrSubItem = NULL) const;
23324ae1 786
54d323d2
VZ
787 /**
788 Returns true if the control is currently using ::wxLC_REPORT style.
789 */
790 bool InReportView() const;
791
23324ae1 792 /**
0fb731b8
VZ
793 For report view mode (only), inserts a column.
794
795 For more details, see SetItem(). Also see InsertColumn(long, const
796 wxString&, int, int) overload for a usually more convenient
797 alternative to this method and the description of how the item width
798 is interpreted by this method.
23324ae1 799 */
0fb731b8 800 long InsertColumn(long col, const wxListItem& info);
320ab87c 801
1d7c0c08 802 /**
0fb731b8
VZ
803 For report view mode (only), inserts a column.
804
805 Insert a new column in the list control in report view mode at the
806 given position specifying its most common attributes.
807
808 Notice that to set the image for the column you need to use
809 Insert(long, const wxListItem&) overload and specify ::wxLIST_MASK_IMAGE
810 in the item mask.
811
812 @param col
813 The index where the column should be inserted. Valid indices are
814 from 0 up to GetColumnCount() inclusive and the latter can be used
815 to append the new column after the last existing one.
816 @param heading
817 The string specifying the column heading.
818 @param format
819 The flags specifying the control heading text alignment.
820 @param width
821 If positive, the width of the column in pixels. Otherwise it can be
822 @c wxLIST_AUTOSIZE to choose the default size for the column or @c
823 wxLIST_AUTOSIZE_USEHEADER to fit the column width to @a heading or
824 to extend to fill all the remaining space for the last column.
825 Notice that in case of @c wxLIST_AUTOSIZE fixed width is used as
826 there are no items in this column to use for determining its best
827 size yet. If you want to fit the column to its contents, use
828 SetColumnWidth() after adding the items with values in this column.
829 @return
830 The index of the inserted column or -1 if adding it failed.
1d7c0c08 831 */
7c913512
FM
832 long InsertColumn(long col, const wxString& heading,
833 int format = wxLIST_FORMAT_LEFT,
0fb731b8 834 int width = wxLIST_AUTOSIZE);
23324ae1 835
23324ae1 836 /**
320ab87c
FM
837 Inserts an item, returning the index of the new item if successful, -1 otherwise.
838
7c913512 839 @param info
4cc4bfaf 840 wxListItem object
b45506e8
VZ
841 */
842 long InsertItem(wxListItem& info);
843
844 /**
845 Insert an string item.
320ab87c 846
7c913512 847 @param index
4cc4bfaf 848 Index of the new item, supplied by the application
7c913512 849 @param label
4cc4bfaf 850 String label
1058f652
MB
851
852 @beginWxPerlOnly
853 In wxPerl this method is implemented as InsertStringItem(index, label).
854 @endWxPerlOnly
23324ae1 855 */
7c913512 856 long InsertItem(long index, const wxString& label);
320ab87c 857
b45506e8
VZ
858 /**
859 Insert an image item.
320ab87c 860
b45506e8
VZ
861 @param index
862 Index of the new item, supplied by the application
863 @param imageIndex
864 Index into the image list associated with this control and view style
1058f652
MB
865
866 @beginWxPerlOnly
867 In wxPerl this method is implemented as InsertImageItem(index, imageIndex).
868 @endWxPerlOnly
320ab87c 869 */
7c913512 870 long InsertItem(long index, int imageIndex);
320ab87c 871
b45506e8
VZ
872 /**
873 Insert an image/string item.
320ab87c 874
b45506e8
VZ
875 @param index
876 Index of the new item, supplied by the application
877 @param label
878 String label
879 @param imageIndex
880 Index into the image list associated with this control and view style
1058f652
MB
881
882 @beginWxPerlOnly
883 In wxPerl this method is implemented as InsertImageStringItem(index, label, imageIndex).
884 @endWxPerlOnly
320ab87c 885 */
7c913512
FM
886 long InsertItem(long index, const wxString& label,
887 int imageIndex);
23324ae1 888
54d323d2
VZ
889 /**
890 Returns true if the control is currently in virtual report view.
891 */
892 bool IsVirtual() const;
893
23324ae1 894 /**
320ab87c
FM
895 Redraws the given @e item.
896
897 This is only useful for the virtual list controls as without calling this
898 function the displayed value of the item doesn't change even when the
899 underlying data does change.
3c4f71cc 900
4cc4bfaf 901 @see RefreshItems()
23324ae1
FM
902 */
903 void RefreshItem(long item);
904
905 /**
320ab87c
FM
906 Redraws the items between @a itemFrom and @e itemTo.
907 The starting item must be less than or equal to the ending one.
908
909 Just as RefreshItem() this is only useful for virtual list controls.
23324ae1
FM
910 */
911 void RefreshItems(long itemFrom, long itemTo);
912
913 /**
914 Scrolls the list control. If in icon, small icon or report view mode,
4cc4bfaf
FM
915 @a dx specifies the number of pixels to scroll. If in list view mode,
916 @a dx specifies the number of columns to scroll. @a dy always specifies
23324ae1 917 the number of pixels to scroll vertically.
320ab87c 918
1f1d2182 919 @note This method is currently only implemented in the Windows version.
23324ae1
FM
920 */
921 bool ScrollList(int dx, int dy);
922
923 /**
320ab87c
FM
924 Sets the background colour.
925
926 Note that the wxWindow::GetBackgroundColour() function of wxWindow base
927 class can be used to retrieve the current background colour.
23324ae1 928 */
5267aefd 929 virtual bool SetBackgroundColour(const wxColour& col);
23324ae1
FM
930
931 /**
320ab87c
FM
932 Sets information about this column.
933 See SetItem() for more information.
23324ae1
FM
934 */
935 bool SetColumn(int col, wxListItem& item);
936
937 /**
938 Sets the column width.
320ab87c
FM
939
940 @a width can be a width in pixels or @c wxLIST_AUTOSIZE (-1) or
941 @c wxLIST_AUTOSIZE_USEHEADER (-2).
942
943 @c wxLIST_AUTOSIZE will resize the column to the length of its longest item.
944
945 @c wxLIST_AUTOSIZE_USEHEADER will resize the column to the length of the
946 header (Win32) or 80 pixels (other platforms).
947
4cc4bfaf 948 In small or normal icon view, @a col must be -1, and the column width is set
23324ae1
FM
949 for all columns.
950 */
951 bool SetColumnWidth(int col, int width);
952
953 /**
80cc5fc7
VZ
954 Changes the order in which the columns are shown.
955
956 By default, the columns of a list control appear on the screen in order
957 of their indices, i.e. the column 0 appears first, the column 1 next
958 and so on. However by using this function it is possible to arbitrarily
959 reorder the columns visual order and the user can also rearrange the
960 columns interactively by dragging them. In this case, the index of the
961 column is not the same as its order and the functions GetColumnOrder()
962 and GetColumnIndexFromOrder() should be used to translate between them.
963 Notice that all the other functions still work with the column indices,
964 i.e. the visual positioning of the columns on screen doesn't affect the
965 code setting or getting their values for example.
320ab87c
FM
966
967 The @a orders array must have the same number elements as the number of
80cc5fc7
VZ
968 columns and contain each position exactly once. Its n-th element
969 contains the index of the column to be shown in n-th position, so for a
970 control with three columns passing an array with elements 2, 0 and 1
971 results in the third column being displayed first, the first one next
972 and the second one last.
973
974 Example of using it:
975 @code
976 wxListCtrl *list = new wxListCtrl(...);
977 for ( int i = 0; i < 3; i++ )
978 list->InsertColumn(i, wxString::Format("Column %d", i));
979
980 wxArrayInt order(3);
981 order[0] = 2;
982 order[1] = 0;
983 order[2] = 1;
984 list->SetColumnsOrder(order);
985
986 // now list->GetColumnsOrder() will return order and
987 // list->GetColumnIndexFromOrder(n) will return order[n] and
988 // list->GetColumnOrder() will return 1, 2 and 0 for the column 0,
989 // 1 and 2 respectively
990 @endcode
991
992 Please notice that this function makes sense for report view only and
993 currently is only implemented in wxMSW port. To avoid explicit tests
994 for @c __WXMSW__ in your code, please use @c wxHAS_LISTCTRL_COLUMN_ORDER
995 as this will allow it to start working under the other platforms when
996 support for the column reordering is added there.
320ab87c 997
80cc5fc7 998 @see GetColumnsOrder()
23324ae1 999 */
b5176f6d 1000 bool SetColumnsOrder(const wxArrayInt& orders);
23324ae1
FM
1001
1002 /**
320ab87c
FM
1003 Sets the image list associated with the control.
1004
1005 @a which is one of @c wxIMAGE_LIST_NORMAL, @c wxIMAGE_LIST_SMALL,
1006 @c wxIMAGE_LIST_STATE (the last is unimplemented).
1007
23324ae1
FM
1008 This method does not take ownership of the image list, you have to
1009 delete it yourself.
3c4f71cc 1010
4cc4bfaf 1011 @see AssignImageList()
23324ae1
FM
1012 */
1013 void SetImageList(wxImageList* imageList, int which);
1014
23324ae1 1015 /**
1d7c0c08 1016 Sets the data of an item.
320ab87c
FM
1017
1018 Using the wxListItem's mask and state mask, you can change only selected
1019 attributes of a wxListCtrl item.
23324ae1
FM
1020 */
1021 bool SetItem(wxListItem& info);
320ab87c 1022
1d7c0c08 1023 /**
320ab87c 1024 Sets an item string field at a particular column.
1d7c0c08 1025 */
320ab87c 1026 long SetItem(long index, int column, const wxString& label, int imageId = -1);
23324ae1
FM
1027
1028 /**
320ab87c
FM
1029 Sets the background colour for this item.
1030 This function only works in report view mode.
1031 The colour can be retrieved using GetItemBackgroundColour().
23324ae1
FM
1032 */
1033 void SetItemBackgroundColour(long item, const wxColour& col);
1034
1035 /**
320ab87c
FM
1036 Sets the image associated with the item.
1037 In report view, you can specify the column.
1038 The image is an index into the image list associated with the list control.
23324ae1
FM
1039 */
1040 bool SetItemColumnImage(long item, long column, int image);
1041
1042 /**
558a6e06
VZ
1043 This method can only be used with virtual list controls.
1044
1045 It is used to indicate to the control the number of items it contains.
1046 After calling it, the main program should be ready to handle calls to
1047 various item callbacks (such as wxListCtrl::OnGetItemText) for all
1048 items in the range from 0 to @a count.
1049
1050 Notice that the control is not necessarily redrawn after this call as
1051 it may be undesirable if an item which is not visible on the screen
1052 anyhow was added to or removed from a control displaying many items, if
1053 you do need to refresh the display you can just call Refresh() manually.
23324ae1
FM
1054 */
1055 void SetItemCount(long count);
1056
1057 /**
320ab87c
FM
1058 Associates application-defined data with this item.
1059
1060 Notice that this function cannot be used to associate pointers with the control
1061 items, use SetItemPtrData() instead.
23324ae1
FM
1062 */
1063 bool SetItemData(long item, long data);
1064
1065 /**
1d7c0c08 1066 Sets the item's font.
23324ae1
FM
1067 */
1068 void SetItemFont(long item, const wxFont& font);
1069
23324ae1 1070 /**
320ab87c
FM
1071 Sets the unselected and selected images associated with the item.
1072 The images are indices into the image list associated with the list control.
23324ae1 1073 */
5267aefd 1074 bool SetItemImage(long item, int image, int selImage = -1);
320ab87c 1075
23324ae1
FM
1076
1077 /**
1078 Sets the position of the item, in icon or small icon view. Windows only.
1079 */
1080 bool SetItemPosition(long item, const wxPoint& pos);
1081
1082 /**
320ab87c
FM
1083 Associates application-defined data with this item.
1084
1085 The @a data parameter may be either an integer or a pointer cast to the
1086 @c wxUIntPtr type which is guaranteed to be large enough to be able to
1087 contain all integer types and pointers.
3c4f71cc 1088
1e24c2af 1089 @since 2.8.4
23324ae1
FM
1090 */
1091 bool SetItemPtrData(long item, wxUIntPtr data);
1092
1093 /**
f9c2e12f
VZ
1094 Sets the item state.
1095
1096 The @a stateMask is a combination of @c wxLIST_STATE_XXX constants
1097 described in wxListItem documentation. For each of the bits specified
1098 in @a stateMask, the corresponding state is set or cleared depending on
1099 whether @a state argument contains the same bit or not.
1100
1101 So to select an item you can use
1102 @code
1103 list->SetItemState(item, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
1104 @endcode
1105 while to deselect it you should use
1106 @code
1107 list->SetItemState(item, 0, wxLIST_STATE_SELECTED);
1108 @endcode
1109
1110 Consider using wxListView if possible to avoid dealing with this
1111 error-prone and confusing method.
23324ae1
FM
1112 */
1113 bool SetItemState(long item, long state, long stateMask);
1114
1115 /**
1116 Sets the item text for this item.
1117 */
1118 void SetItemText(long item, const wxString& text);
1119
1120 /**
320ab87c
FM
1121 Sets the colour for this item.
1122 This function only works in report view.
1123 The colour can be retrieved using GetItemTextColour().
23324ae1
FM
1124 */
1125 void SetItemTextColour(long item, const wxColour& col);
1126
1127 /**
1128 Adds or removes a single window style.
1129 */
4cc4bfaf 1130 void SetSingleStyle(long style, bool add = true);
23324ae1
FM
1131
1132 /**
1133 Sets the text colour of the list control.
1134 */
1135 void SetTextColour(const wxColour& col);
1136
1137 /**
1138 Sets the whole window style, deleting all items.
1139 */
1140 void SetWindowStyleFlag(long style);
1141
1142 /**
1143 Call this function to sort the items in the list control. Sorting is done
4cc4bfaf 1144 using the specified @a fnSortCallBack function. This function must have the
23324ae1 1145 following prototype:
320ab87c 1146 @code
d3ca8487 1147 int wxCALLBACK wxListCompareFunction(wxIntPtr item1, wxIntPtr item2, wxIntPtr sortData)
320ab87c 1148 @endcode
3c4f71cc 1149
23324ae1
FM
1150 It is called each time when the two items must be compared and should return 0
1151 if the items are equal, negative value if the first item is less than the
1152 second one and positive value if the first one is greater than the second one
1153 (the same convention as used by @c qsort(3)).
3c4f71cc 1154
320ab87c
FM
1155 The parameter @e item1 is the client data associated with the first item (NOT the index).
1156 The parameter @e item2 is the client data associated with the second item (NOT the index).
1157 The parameter @e data is the value passed to SortItems() itself.
1158
1159 Notice that the control may only be sorted on client data associated with
1160 the items, so you must use SetItemData if you want to be able to sort the
1161 items in the control.
1162
1163 Please see the @ref page_samples_listctrl for an example of using this function.
1058f652
MB
1164
1165 @beginWxPerlOnly
1166 In wxPerl the comparison function must take just two parameters;
1167 however, you may use a closure to achieve an effect similar to the
1168 SortItems third parameter.
1169 @endWxPerlOnly
23324ae1 1170 */
b18e2046 1171 bool SortItems(wxListCtrlCompare fnSortCallBack, wxIntPtr data);
5e6e278d
FM
1172
1173protected:
1174
1175 /**
75504144 1176 This function may be overridden in the derived class for a control with
5e6e278d
FM
1177 @c wxLC_VIRTUAL style. It should return the attribute for the specified
1178 @c item or @NULL to use the default appearance parameters.
1179
1180 wxListCtrl will not delete the pointer or keep a reference of it.
1181 You can return the same wxListItemAttr pointer for every OnGetItemAttr() call.
1182
1183 The base class version always returns @NULL.
1184
eab1336c
VZ
1185 @see OnGetItemImage(), OnGetItemColumnImage(), OnGetItemText(),
1186 OnGetItemColumnAttr()
5e6e278d
FM
1187 */
1188 virtual wxListItemAttr* OnGetItemAttr(long item) const;
1189
eab1336c
VZ
1190 /**
1191 This function may be overridden in the derived class for a control with
1192 @c wxLC_VIRTUAL style.
1193
1194 It should return the attribute for the for the specified @a item and @a
1195 column or @NULL to use the default appearance parameters.
1196
1197 The base class version returns @c OnGetItemAttr(item).
1198
1199 @note Currently this function is only called under wxMSW, the other
1200 ports only support OnGetItemAttr()
1201
1202 @see OnGetItemAttr(), OnGetItemText(),
1203 OnGetItemImage(), OnGetItemColumnImage(),
1204 */
1205 virtual wxListItemAttr* OnGetItemColumnAttr(long item, long column) const;
1206
5e6e278d 1207 /**
75504144 1208 Override this function in the derived class for a control with
5e6e278d
FM
1209 @c wxLC_VIRTUAL and @c wxLC_REPORT styles in order to specify the image
1210 index for the given line and column.
1211
1212 The base class version always calls OnGetItemImage() for the first column, else
1213 it returns -1.
1214
eab1336c
VZ
1215 @see OnGetItemText(), OnGetItemImage(), OnGetItemAttr(),
1216 OnGetItemColumnAttr()
5e6e278d
FM
1217 */
1218 virtual int OnGetItemColumnImage(long item, long column) const;
1219
1220 /**
75504144 1221 This function must be overridden in the derived class for a control with
e2c4ccaf 1222 @c wxLC_VIRTUAL style having an "image list" (see SetImageList(); if the
75504144 1223 control doesn't have an image list, it is not necessary to override it).
5e6e278d
FM
1224 It should return the index of the items image in the controls image list
1225 or -1 for no image.
1226
1227 In a control with @c wxLC_REPORT style, OnGetItemImage() only gets called for
1228 the first column of each line.
1229
1230 The base class version always returns -1.
1231
1232 @see OnGetItemText(), OnGetItemColumnImage(), OnGetItemAttr()
1233 */
1234 virtual int OnGetItemImage(long item) const;
1235
1236 /**
75504144 1237 This function @b must be overridden in the derived class for a control with
5e6e278d
FM
1238 @c wxLC_VIRTUAL style. It should return the string containing the text of
1239 the given @a column for the specified @c item.
1240
1241 @see SetItemCount(), OnGetItemImage(), OnGetItemColumnImage(), OnGetItemAttr()
1242 */
1243 virtual wxString OnGetItemText(long item, long column) const;
23324ae1
FM
1244};
1245
1246
e54c96f1 1247
23324ae1
FM
1248/**
1249 @class wxListEvent
7c913512 1250
23324ae1 1251 A list event holds information about events associated with wxListCtrl objects.
7c913512 1252
320ab87c
FM
1253 @beginEventTable{wxListEvent}
1254 @event{EVT_LIST_BEGIN_DRAG(id, func)}
1255 Begin dragging with the left mouse button.
1256 @event{EVT_LIST_BEGIN_RDRAG(id, func)}
1257 Begin dragging with the right mouse button.
1258 @event{EVT_LIST_BEGIN_LABEL_EDIT(id, func)}
1259 Begin editing a label. This can be prevented by calling Veto().
1260 @event{EVT_LIST_END_LABEL_EDIT(id, func)}
1261 Finish editing a label. This can be prevented by calling Veto().
1262 @event{EVT_LIST_DELETE_ITEM(id, func)}
1263 Delete an item.
1264 @event{EVT_LIST_DELETE_ALL_ITEMS(id, func)}
1265 Delete all items.
1266 @event{EVT_LIST_ITEM_SELECTED(id, func)}
1267 The item has been selected.
1268 @event{EVT_LIST_ITEM_DESELECTED(id, func)}
1269 The item has been deselected.
1270 @event{EVT_LIST_ITEM_ACTIVATED(id, func)}
1271 The item has been activated (ENTER or double click).
1272 @event{EVT_LIST_ITEM_FOCUSED(id, func)}
1273 The currently focused item has changed.
1274 @event{EVT_LIST_ITEM_MIDDLE_CLICK(id, func)}
1275 The middle mouse button has been clicked on an item.
1276 @event{EVT_LIST_ITEM_RIGHT_CLICK(id, func)}
1277 The right mouse button has been clicked on an item.
1278 @event{EVT_LIST_KEY_DOWN(id, func)}
92d9d10f 1279 A key has been pressed. GetIndex() may be -1 if no item is selected.
320ab87c
FM
1280 @event{EVT_LIST_INSERT_ITEM(id, func)}
1281 An item has been inserted.
1282 @event{EVT_LIST_COL_CLICK(id, func)}
1283 A column (m_col) has been left-clicked.
1284 @event{EVT_LIST_COL_RIGHT_CLICK(id, func)}
1285 A column (m_col) (which can be -1 if the click occurred outside any column)
1286 has been right-clicked.
1287 @event{EVT_LIST_COL_BEGIN_DRAG(id, func)}
1288 The user started resizing a column - can be vetoed.
1289 @event{EVT_LIST_COL_DRAGGING(id, func)}
1290 The divider between columns is being dragged.
1291 @event{EVT_LIST_COL_END_DRAG(id, func)}
1292 A column has been resized by the user.
1293 @event{EVT_LIST_CACHE_HINT(id, func)}
1294 Prepare cache for a virtual list control
1295 @endEventTable
1296
1297
f00f01b3 1298 @library{wxcore}
23324ae1 1299 @category{events}
7c913512 1300
e54c96f1 1301 @see wxListCtrl
23324ae1
FM
1302*/
1303class wxListEvent : public wxNotifyEvent
1304{
1305public:
1306 /**
1307 Constructor.
1308 */
0a98423e 1309 wxListEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
23324ae1
FM
1310
1311 /**
1312 For @c EVT_LIST_CACHE_HINT event only: return the first item which the
1313 list control advises us to cache.
1314 */
328f5751 1315 long GetCacheFrom() const;
23324ae1
FM
1316
1317 /**
1318 For @c EVT_LIST_CACHE_HINT event only: return the last item (inclusive)
1319 which the list control advises us to cache.
1320 */
328f5751 1321 long GetCacheTo() const;
23324ae1
FM
1322
1323 /**
320ab87c
FM
1324 The column position: it is only used with @c COL events.
1325
1326 For the column dragging events, it is the column to the left of the divider
1327 being dragged, for the column click events it may be -1 if the user clicked
1328 in the list control header outside any column.
23324ae1 1329 */
328f5751 1330 int GetColumn() const;
23324ae1
FM
1331
1332 /**
1333 The data.
1334 */
328f5751 1335 long GetData() const;
23324ae1
FM
1336
1337 /**
1338 The image.
1339 */
328f5751 1340 int GetImage() const;
23324ae1
FM
1341
1342 /**
1343 The item index.
1344 */
328f5751 1345 long GetIndex() const;
23324ae1
FM
1346
1347 /**
1348 An item object, used by some events. See also wxListCtrl::SetItem.
1349 */
5267aefd 1350 const wxListItem& GetItem() const;
23324ae1
FM
1351
1352 /**
1353 Key code if the event is a keypress event.
1354 */
328f5751 1355 int GetKeyCode() const;
23324ae1
FM
1356
1357 /**
1358 The (new) item label for @c EVT_LIST_END_LABEL_EDIT event.
1359 */
5267aefd 1360 const wxString& GetLabel() const;
23324ae1
FM
1361
1362 /**
1363 The mask.
1364 */
328f5751 1365 long GetMask() const;
23324ae1
FM
1366
1367 /**
1368 The position of the mouse pointer if the event is a drag event.
1369 */
328f5751 1370 wxPoint GetPoint() const;
23324ae1
FM
1371
1372 /**
1373 The text.
1374 */
5267aefd 1375 const wxString& GetText() const;
23324ae1
FM
1376
1377 /**
320ab87c
FM
1378 This method only makes sense for @c EVT_LIST_END_LABEL_EDIT message and
1379 returns @true if it the label editing has been cancelled by the user
1380 (GetLabel() returns an empty string in this case but it doesn't allow the
1381 application to distinguish between really cancelling the edit and the
1382 admittedly rare case when the user wants to rename it to an empty string).
23324ae1 1383 */
328f5751 1384 bool IsEditCancelled() const;
23324ae1
FM
1385};
1386
1387
0ffc1704
RD
1388wxEventType wxEVT_COMMAND_LIST_BEGIN_DRAG;
1389wxEventType wxEVT_COMMAND_LIST_BEGIN_RDRAG;
1390wxEventType wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT;
1391wxEventType wxEVT_COMMAND_LIST_END_LABEL_EDIT;
1392wxEventType wxEVT_COMMAND_LIST_DELETE_ITEM;
1393wxEventType wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS;
1394wxEventType wxEVT_COMMAND_LIST_ITEM_SELECTED;
1395wxEventType wxEVT_COMMAND_LIST_ITEM_DESELECTED;
1396wxEventType wxEVT_COMMAND_LIST_KEY_DOWN;
1397wxEventType wxEVT_COMMAND_LIST_INSERT_ITEM;
1398wxEventType wxEVT_COMMAND_LIST_COL_CLICK;
1399wxEventType wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK;
1400wxEventType wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK;
1401wxEventType wxEVT_COMMAND_LIST_ITEM_ACTIVATED;
1402wxEventType wxEVT_COMMAND_LIST_CACHE_HINT;
1403wxEventType wxEVT_COMMAND_LIST_COL_RIGHT_CLICK;
1404wxEventType wxEVT_COMMAND_LIST_COL_BEGIN_DRAG;
1405wxEventType wxEVT_COMMAND_LIST_COL_DRAGGING;
1406wxEventType wxEVT_COMMAND_LIST_COL_END_DRAG;
1407wxEventType wxEVT_COMMAND_LIST_ITEM_FOCUSED;
1408
e54c96f1 1409
23324ae1
FM
1410/**
1411 @class wxListItemAttr
7c913512 1412
320ab87c 1413 Represents the attributes (color, font, ...) of a wxListCtrl's wxListItem.
7c913512 1414
f00f01b3 1415 @library{wxcore}
3c99e2fd 1416 @category{data}
7c913512 1417
320ab87c 1418 @see @ref overview_listctrl, wxListCtrl, wxListItem
23324ae1 1419*/
7c913512 1420class wxListItemAttr
23324ae1
FM
1421{
1422public:
1d7c0c08
RR
1423 /**
1424 Default Constructor.
1425 */
1426 wxListItemAttr();
320ab87c 1427
23324ae1
FM
1428 /**
1429 Construct a wxListItemAttr with the specified foreground and
1430 background colors and font.
1431 */
0a98423e
FM
1432 wxListItemAttr(const wxColour& colText,
1433 const wxColour& colBack,
1434 const wxFont& font);
23324ae1
FM
1435
1436 /**
1437 Returns the currently set background color.
1438 */
320ab87c 1439 const wxColour& GetBackgroundColour() const;
23324ae1
FM
1440
1441 /**
1442 Returns the currently set font.
1443 */
320ab87c 1444 const wxFont& GetFont() const;
23324ae1
FM
1445
1446 /**
1447 Returns the currently set text color.
1448 */
320ab87c 1449 const wxColour& GetTextColour() const;
23324ae1
FM
1450
1451 /**
1452 Returns @true if the currently set background color is valid.
1453 */
328f5751 1454 bool HasBackgroundColour() const;
23324ae1
FM
1455
1456 /**
1457 Returns @true if the currently set font is valid.
1458 */
328f5751 1459 bool HasFont() const;
23324ae1
FM
1460
1461 /**
1462 Returns @true if the currently set text color is valid.
1463 */
328f5751 1464 bool HasTextColour() const;
23324ae1
FM
1465
1466 /**
1467 Sets a new background color.
1468 */
1469 void SetBackgroundColour(const wxColour& colour);
1470
1471 /**
1472 Sets a new font.
1473 */
1474 void SetFont(const wxFont& font);
1475
1476 /**
1477 Sets a new text color.
1478 */
1479 void SetTextColour(const wxColour& colour);
1480};
1481
1482
e54c96f1 1483
23324ae1
FM
1484/**
1485 @class wxListView
7c913512
FM
1486
1487 This class currently simply presents a simpler to use interface for the
320ab87c
FM
1488 wxListCtrl -- it can be thought of as a @e façade for that complicated class.
1489
1490 Using it is preferable to using wxListCtrl directly whenever possible because
1491 in the future some ports might implement wxListView but not the full set of
1492 wxListCtrl features.
7c913512 1493
320ab87c
FM
1494 Other than different interface, this class is identical to wxListCtrl.
1495 In particular, it uses the same events, same window styles and so on.
7c913512 1496
23324ae1
FM
1497 @library{wxcore}
1498 @category{ctrl}
7e59b885 1499 @appearance{listview.png}
7c913512 1500
e54c96f1 1501 @see wxListView::SetColumnImage
23324ae1
FM
1502*/
1503class wxListView : public wxListCtrl
1504{
1505public:
1506 /**
1507 Resets the column image -- after calling this function, no image will be shown.
3c4f71cc 1508
7c913512 1509 @param col
4cc4bfaf 1510 the column to clear image for
3c4f71cc 1511
4cc4bfaf 1512 @see SetColumnImage()
23324ae1
FM
1513 */
1514 void ClearColumnImage(int col);
1515
1516 /**
320ab87c 1517 Sets focus to the item with the given @a index.
23324ae1
FM
1518 */
1519 void Focus(long index);
1520
1521 /**
1522 Returns the first selected item in a (presumably) multiple selection control.
320ab87c
FM
1523 Together with GetNextSelected() it can be used to iterate over all selected
1524 items in the control.
3c4f71cc 1525
d29a9a8a 1526 @return The first selected item, if any, -1 otherwise.
23324ae1 1527 */
328f5751 1528 long GetFirstSelected() const;
23324ae1
FM
1529
1530 /**
1531 Returns the currently focused item or -1 if none.
3c4f71cc 1532
4cc4bfaf 1533 @see IsSelected(), Focus()
23324ae1 1534 */
328f5751 1535 long GetFocusedItem() const;
23324ae1
FM
1536
1537 /**
320ab87c
FM
1538 Used together with GetFirstSelected() to iterate over all selected items
1539 in the control.
3c4f71cc 1540
320ab87c 1541 @return Returns the next selected item or -1 if there are no more of them.
23324ae1 1542 */
328f5751 1543 long GetNextSelected(long item) const;
23324ae1
FM
1544
1545 /**
4cc4bfaf 1546 Returns @true if the item with the given @a index is selected,
23324ae1 1547 @false otherwise.
3c4f71cc 1548
4cc4bfaf 1549 @see GetFirstSelected(), GetNextSelected()
23324ae1 1550 */
328f5751 1551 bool IsSelected(long index) const;
23324ae1
FM
1552
1553 /**
1554 Selects or unselects the given item.
3c4f71cc 1555
7c913512 1556 @param n
4cc4bfaf 1557 the item to select or unselect
7c913512 1558 @param on
4cc4bfaf 1559 if @true (default), selects the item, otherwise unselects it
3c4f71cc 1560
4cc4bfaf 1561 @see wxListCtrl::SetItemState
23324ae1 1562 */
792255cc 1563 void Select(long n, bool on = true);
23324ae1
FM
1564
1565 /**
320ab87c
FM
1566 Sets the column image for the specified column.
1567 To use the column images, the control must have a valid image list with
1568 at least one image.
3c4f71cc 1569
7c913512 1570 @param col
4cc4bfaf 1571 the column to set image for
7c913512 1572 @param image
4cc4bfaf 1573 the index of the column image in the controls image list
23324ae1
FM
1574 */
1575 void SetColumnImage(int col, int image);
1576};
1577
1578
e54c96f1 1579
23324ae1
FM
1580/**
1581 @class wxListItem
7c913512 1582
23324ae1 1583 This class stores information about a wxListCtrl item or column.
7c913512 1584
320ab87c
FM
1585 wxListItem is a class which contains informations about:
1586 - Zero based item position; see SetId() and GetId().
1587 - Zero based column index; see SetColumn() and GetColumn().
1588 - The label (or header for columns); see SetText() and GetText().
1589 - The zero based index into an image list; see GetImage() and SetImage().
1590 - Application defined data; see SetData() and GetData().
1591 - For columns only: the width of the column; see SetWidth() and GetWidth().
1592 - For columns only: the format of the column; one of @c wxLIST_FORMAT_LEFT,
1593 @c wxLIST_FORMAT_RIGHT, @c wxLIST_FORMAT_CENTRE. See SetAlign() and GetAlign().
1594 - The state of the item; see SetState() and GetState().
1595 This is a bitlist of the following flags:
1596 - @c wxLIST_STATE_FOCUSED: The item has the focus.
1597 - @c wxLIST_STATE_SELECTED: The item is selected.
1598 - @c wxLIST_STATE_DONTCARE: Don't care what the state is. Win32 only.
1599 - @c wxLIST_STATE_DROPHILITED: The item is highlighted to receive a drop event. Win32 only.
1600 - @c wxLIST_STATE_CUT: The item is in the cut state. Win32 only.
1601 - A mask indicating which state flags are valid; this is a bitlist of the
1602 flags reported above for the item state. See SetStateMask() and GetStateMask().
1603 - A mask indicating which fields of this class are valid; see SetMask() and GetMask().
1604 This is a bitlist of the following flags:
1605 - @c wxLIST_MASK_STATE: The state field is valid.
1606 - @c wxLIST_MASK_TEXT: The label field is valid.
1607 - @c wxLIST_MASK_IMAGE: The image field is valid.
1608 - @c wxLIST_MASK_DATA: The application-defined data field is valid.
1609 - @c wxLIST_MASK_WIDTH: The column width field is valid.
1610 - @c wxLIST_MASK_FORMAT: The column format field is valid.
1611
1612 The wxListItem object can also contain item-specific colour and font
1613 information: for this you need to call one of SetTextColour(), SetBackgroundColour()
1614 or SetFont() functions on it passing it the colour/font to use.
1615 If the colour/font is not specified, the default list control colour/font is used.
1616
f00f01b3 1617 @library{wxcore}
3c99e2fd 1618 @category{data}
320ab87c
FM
1619
1620 @see wxListCtrl
23324ae1
FM
1621*/
1622class wxListItem : public wxObject
1623{
1624public:
1625 /**
1626 Constructor.
1627 */
1628 wxListItem();
1629
1630 /**
1631 Resets the item state to the default.
1632 */
1633 void Clear();
1634
1635 /**
320ab87c
FM
1636 Returns the alignment for this item.
1637 Can be one of @c wxLIST_FORMAT_LEFT, @c wxLIST_FORMAT_RIGHT or @c wxLIST_FORMAT_CENTRE.
23324ae1 1638 */
328f5751 1639 wxListColumnFormat GetAlign() const;
23324ae1
FM
1640
1641 /**
1642 Returns the background colour for this item.
1643 */
328f5751 1644 wxColour GetBackgroundColour() const;
23324ae1
FM
1645
1646 /**
1647 Returns the zero-based column; meaningful only in report mode.
1648 */
328f5751 1649 int GetColumn() const;
23324ae1
FM
1650
1651 /**
320ab87c
FM
1652 Returns client data associated with the control.
1653 Please note that client data is associated with the item and not with subitems.
23324ae1 1654 */
5267aefd 1655 wxUIntPtr GetData() const;
23324ae1
FM
1656
1657 /**
1658 Returns the font used to display the item.
1659 */
328f5751 1660 wxFont GetFont() const;
23324ae1
FM
1661
1662 /**
1663 Returns the zero-based item position.
1664 */
328f5751 1665 long GetId() const;
23324ae1
FM
1666
1667 /**
320ab87c
FM
1668 Returns the zero-based index of the image associated with the item into
1669 the image list.
23324ae1 1670 */
328f5751 1671 int GetImage() const;
23324ae1
FM
1672
1673 /**
320ab87c 1674 Returns a bit mask indicating which fields of the structure are valid.
3c4f71cc 1675
320ab87c
FM
1676 Can be any combination of the following values:
1677 - wxLIST_MASK_STATE: @b GetState is valid.
1678 - wxLIST_MASK_TEXT: @b GetText is valid.
1679 - wxLIST_MASK_IMAGE: @b GetImage is valid.
1680 - wxLIST_MASK_DATA: @b GetData is valid.
1681 - wxLIST_MASK_WIDTH: @b GetWidth is valid.
1682 - wxLIST_MASK_FORMAT: @b GetFormat is valid.
23324ae1 1683 */
328f5751 1684 long GetMask() const;
23324ae1
FM
1685
1686 /**
320ab87c 1687 Returns a bit field representing the state of the item.
3c4f71cc 1688
320ab87c
FM
1689 Can be any combination of:
1690 - wxLIST_STATE_DONTCARE: Don't care what the state is. Win32 only.
1691 - wxLIST_STATE_DROPHILITED: The item is highlighted to receive a drop event. Win32 only.
1692 - wxLIST_STATE_FOCUSED: The item has the focus.
1693 - wxLIST_STATE_SELECTED: The item is selected.
1694 - wxLIST_STATE_CUT: The item is in the cut state. Win32 only.
23324ae1 1695 */
328f5751 1696 long GetState() const;
23324ae1
FM
1697
1698 /**
1699 Returns the label/header text.
1700 */
320ab87c 1701 const wxString& GetText() const;
23324ae1
FM
1702
1703 /**
1704 Returns the text colour.
1705 */
328f5751 1706 wxColour GetTextColour() const;
23324ae1
FM
1707
1708 /**
1709 Meaningful only for column headers in report mode. Returns the column width.
1710 */
328f5751 1711 int GetWidth() const;
23324ae1
FM
1712
1713 /**
320ab87c 1714 Sets the alignment for the item. See also GetAlign()
23324ae1
FM
1715 */
1716 void SetAlign(wxListColumnFormat align);
1717
1718 /**
1719 Sets the background colour for the item.
1720 */
1721 void SetBackgroundColour(const wxColour& colBack);
1722
1723 /**
1724 Sets the zero-based column. Meaningful only in report mode.
1725 */
1726 void SetColumn(int col);
1727
1728 //@{
1729 /**
320ab87c
FM
1730 Sets client data for the item.
1731 Please note that client data is associated with the item and not with subitems.
23324ae1
FM
1732 */
1733 void SetData(long data);
7c913512 1734 void SetData(void* data);
23324ae1
FM
1735 //@}
1736
1737 /**
1738 Sets the font for the item.
1739 */
1740 void SetFont(const wxFont& font);
1741
1742 /**
1743 Sets the zero-based item position.
1744 */
1745 void SetId(long id);
1746
1747 /**
1748 Sets the zero-based index of the image associated with the item
1749 into the image list.
1750 */
1751 void SetImage(int image);
1752
1753 /**
1754 Sets the mask of valid fields. See GetMask().
1755 */
1756 void SetMask(long mask);
1757
1758 /**
1759 Sets the item state flags (note that the valid state flags are influenced
320ab87c
FM
1760 by the value of the state mask, see wxListItem::SetStateMask).
1761
1762 See GetState() for valid flag values.
23324ae1
FM
1763 */
1764 void SetState(long state);
1765
1766 /**
1767 Sets the bitmask that is used to determine which of the state flags
1768 are to be set. See also SetState().
1769 */
1770 void SetStateMask(long stateMask);
1771
1772 /**
1773 Sets the text label for the item.
1774 */
1775 void SetText(const wxString& text);
1776
1777 /**
1778 Sets the text colour for the item.
1779 */
1780 void SetTextColour(const wxColour& colText);
1781
1782 /**
1783 Meaningful only for column headers in report mode. Sets the column width.
1784 */
1785 void SetWidth(int width);
1786};
e54c96f1 1787