]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/listctrl.h
Add richtext event types.
[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.
ce7fe42e 206 Processes a @c wxEVT_LIST_BEGIN_DRAG event type.
2e2b4d24 207 @event{EVT_LIST_BEGIN_RDRAG(id, func)}
232fdc63 208 Begin dragging with the right mouse button.
ce7fe42e 209 Processes a @c wxEVT_LIST_BEGIN_RDRAG event type.
232fdc63 210 @event{EVT_BEGIN_LABEL_EDIT(id, func)}
2e2b4d24 211 Begin editing a label. This can be prevented by calling Veto().
ce7fe42e 212 Processes a @c wxEVT_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().
ce7fe42e 215 Processes a @c wxEVT_LIST_END_LABEL_EDIT event type.
2e2b4d24
RR
216 @event{EVT_LIST_DELETE_ITEM(id, func)}
217 An item was deleted.
ce7fe42e 218 Processes a @c wxEVT_LIST_DELETE_ITEM event type.
2e2b4d24
RR
219 @event{EVT_LIST_DELETE_ALL_ITEMS(id, func)}
220 All items were deleted.
ce7fe42e 221 Processes a @c wxEVT_LIST_DELETE_ALL_ITEMS event type.
2e2b4d24
RR
222 @event{EVT_LIST_ITEM_SELECTED(id, func)}
223 The item has been selected.
ce7fe42e 224 Processes a @c wxEVT_LIST_ITEM_SELECTED event type.
2e2b4d24
RR
225 @event{EVT_LIST_ITEM_DESELECTED(id, func)}
226 The item has been deselected.
ce7fe42e 227 Processes a @c wxEVT_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).
ce7fe42e 230 Processes a @c wxEVT_LIST_ITEM_ACTIVATED event type.
2e2b4d24
RR
231 @event{EVT_LIST_ITEM_FOCUSED(id, func)}
232 The currently focused item has changed.
ce7fe42e 233 Processes a @c wxEVT_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.
ce7fe42e 237 Processes a @c wxEVT_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.
ce7fe42e 240 Processes a @c wxEVT_LIST_ITEM_RIGHT_CLICK event type.
2e2b4d24
RR
241 @event{EVT_LIST_KEY_DOWN(id, func)}
242 A key has been pressed.
ce7fe42e 243 Processes a @c wxEVT_LIST_KEY_DOWN event type.
2e2b4d24
RR
244 @event{EVT_LIST_INSERT_ITEM(id, func)}
245 An item has been inserted.
ce7fe42e 246 Processes a @c wxEVT_LIST_INSERT_ITEM event type.
2e2b4d24
RR
247 @event{EVT_LIST_COL_CLICK(id, func)}
248 A column (m_col) has been left-clicked.
ce7fe42e 249 Processes a @c wxEVT_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.
ce7fe42e 252 Processes a @c wxEVT_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.
ce7fe42e 255 Processes a @c wxEVT_LIST_COL_BEGIN_DRAG event type.
2e2b4d24
RR
256 @event{EVT_LIST_COL_DRAGGING(id, func)}
257 The divider between columns is being dragged.
ce7fe42e 258 Processes a @c wxEVT_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.
ce7fe42e 261 Processes a @c wxEVT_LIST_COL_END_DRAG event type.
2e2b4d24
RR
262 @event{EVT_LIST_CACHE_HINT(id, func)}
263 Prepare cache for a virtual list control.
ce7fe42e 264 Processes a @c wxEVT_LIST_CACHE_HINT event type.
2e2b4d24
RR
265 @endEventTable
266
267
23324ae1
FM
268 @library{wxcore}
269 @category{ctrl}
ce154616 270 @appearance{listctrl}
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 352
ce7fe42e 353 @note This sends an event of type @c wxEVT_LIST_DELETE_ALL_ITEMS
232fdc63 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
ce7fe42e 371 This function does @e not send the @c wxEVT_LIST_DELETE_ITEM
4b97af90
VZ
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
ce7fe42e 374 wxEVT_LIST_DELETE_ALL_ITEMS event if the control was not empty.
4b97af90
VZ
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 389 Deletes the specified item.
ce7fe42e 390 This function sends the @c wxEVT_LIST_DELETE_ITEM event for the
320ab87c
FM
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
0ee169da
VZ
410 /**
411 Enable alternating row background colours (also called zebra striping).
412
413 This method can only be called for the control in virtual report mode,
414 i.e. having ::wxLC_REPORT and ::wxLC_VIRTUAL styles.
415
416 When enabling alternating colours, the appropriate colour for the even
417 rows is chosen automatically depending on the default foreground and
418 background colours which are used for the odd rows.
419
420 @param enable
421 If @true, enable alternating row background colours, i.e. different
422 colours for the odd and even rows. If @false, disable this feature
423 and use the same background colour for all rows.
424
425 @since 2.9.5
426
427 @see SetAlternateRowColour()
428 */
429 void EnableAlternateRowColours(bool enable = true);
430
d34d31f6
VZ
431 /**
432 Enable or disable a beep if there is no match for the currently
433 entered text when searching for the item from keyboard.
434
435 The default is to not beep in this case except in wxMSW where the
436 beep is always generated by the native control and cannot be disabled,
437 i.e. calls to this function do nothing there.
438
439 @since 2.9.5
440 */
d01c1746 441 void EnableBellOnNoMatch(bool on = true);
d34d31f6 442
747eb0f6
VZ
443 /**
444 Finish editing the label.
445
446 This method allows to programmatically end editing a list control item
447 in place. Usually it will only be called when editing is in progress,
417b8fcc
VZ
448 i.e. if GetEditControl() returns non-NULL. In particular, do not call
449 it from EVT_LIST_BEGIN_LABEL_EDIT handler as the edit control is not
450 yet fully created by then, just veto the event in this handler instead
451 to prevent the editing from even starting.
452
453 Notice that calling this method will result in EVT_LIST_END_LABEL_EDIT
454 event being generated.
747eb0f6
VZ
455
456 Currently only implemented in wxMSW.
457
458 @param cancel If @true, discard the changes made by user, as if @c
459 Escape key was pressed. Otherwise, accept the changes as if @c
460 Return was pressed.
461 @return @true if item editing wad finished or @false if no item as
462 being edited.
463 */
464 bool EndEditLabel(bool cancel);
465
23324ae1
FM
466 /**
467 Ensures this item is visible.
468 */
469 bool EnsureVisible(long item);
470
23324ae1 471 /**
320ab87c
FM
472 Find an item whose label matches this string, starting from start or the
473 beginning if start is @c -1. The string comparison is case insensitive.
474
475 If @a partial is @true then this method will look for items which begin with @a str.
c2ebca9b
VZ
476
477 @return The next matching item if any or @c -1 (wxNOT_FOUND) otherwise.
23324ae1
FM
478 */
479 long FindItem(long start, const wxString& str,
4cc4bfaf 480 bool partial = false);
320ab87c 481
1d7c0c08 482 /**
320ab87c
FM
483 Find an item whose data matches this data, starting from start or the
484 beginning if 'start' is @c -1.
1058f652
MB
485
486 @beginWxPerlOnly
487 In wxPerl this method is implemented as FindItemData(start, data).
488 @endWxPerlOnly
c2ebca9b
VZ
489
490 @return The next matching item if any or @c -1 (wxNOT_FOUND) otherwise.
1d7c0c08 491 */
0a98423e 492 long FindItem(long start, wxUIntPtr data);
320ab87c 493
1d7c0c08
RR
494 /**
495 Find an item nearest this position in the specified direction,
496 starting from @a start or the beginning if @a start is -1.
1058f652
MB
497
498 @beginWxPerlOnly
499 In wxPerl this method is implemented as FindItemAtPos(start, pt, direction).
500 @endWxPerlOnly
c2ebca9b
VZ
501
502 @return The next matching item if any or @c -1 (wxNOT_FOUND) otherwise.
1d7c0c08 503 */
7c913512 504 long FindItem(long start, const wxPoint& pt, int direction);
23324ae1
FM
505
506 /**
320ab87c
FM
507 Gets information about this column.
508 See SetItem() for more information.
1058f652
MB
509
510 @beginWxPerlOnly
511 In wxPerl this method takes only the @a col parameter and
512 returns a @c Wx::ListItem (or @c undef).
513 @endWxPerlOnly
23324ae1 514 */
328f5751 515 bool GetColumn(int col, wxListItem& item) const;
23324ae1
FM
516
517 /**
518 Returns the number of columns.
519 */
328f5751 520 int GetColumnCount() const;
23324ae1
FM
521
522 /**
80cc5fc7
VZ
523 Gets the column index from its position in visual order.
524
525 After calling SetColumnsOrder(), the index returned by this function
526 corresponds to the value of the element number @a pos in the array
527 returned by GetColumnsOrder().
528
529 Please see SetColumnsOrder() documentation for an example and
530 additional remarks about the columns ordering.
531
532 @see GetColumnOrder()
23324ae1 533 */
80cc5fc7 534 int GetColumnIndexFromOrder(int pos) const;
23324ae1
FM
535
536 /**
80cc5fc7
VZ
537 Gets the column visual order position.
538
539 This function returns the index of the column which appears at the
540 given visual position, e.g. calling it with @a col equal to 0 returns
541 the index of the first shown column.
542
543 Please see SetColumnsOrder() documentation for an example and
544 additional remarks about the columns ordering.
545
546 @see GetColumnsOrder(), GetColumnIndexFromOrder()
23324ae1 547 */
328f5751 548 int GetColumnOrder(int col) const;
23324ae1
FM
549
550 /**
551 Gets the column width (report view only).
552 */
328f5751 553 int GetColumnWidth(int col) const;
23324ae1
FM
554
555 /**
320ab87c 556 Returns the array containing the orders of all columns.
80cc5fc7 557
320ab87c 558 On error, an empty array is returned.
80cc5fc7
VZ
559
560 Please see SetColumnsOrder() documentation for an example and
561 additional remarks about the columns ordering.
562
563 @see GetColumnOrder(), GetColumnIndexFromOrder()
23324ae1 564 */
328f5751 565 wxArrayInt GetColumnsOrder() const;
23324ae1
FM
566
567 /**
320ab87c
FM
568 Gets the number of items that can fit vertically in the visible area of
569 the list control (list or report view) or the total number of items in
570 the list control (icon or small icon view).
23324ae1 571 */
328f5751 572 int GetCountPerPage() const;
23324ae1
FM
573
574 /**
320ab87c
FM
575 Returns the edit control being currently used to edit a label.
576 Returns @NULL if no label is being edited.
577
1f1d2182 578 @note It is currently only implemented for wxMSW and the generic version,
320ab87c 579 not for the native Mac OS X version.
23324ae1 580 */
328f5751 581 wxTextCtrl* GetEditControl() const;
23324ae1
FM
582
583 /**
4cc4bfaf 584 Returns the specified image list. @a which may be one of:
1d7c0c08
RR
585 - wxIMAGE_LIST_NORMAL: The normal (large icon) image list.
586 - wxIMAGE_LIST_SMALL: The small icon image list.
587 - wxIMAGE_LIST_STATE: The user-defined state image list (unimplemented).
23324ae1 588 */
328f5751 589 wxImageList* GetImageList(int which) const;
23324ae1
FM
590
591 /**
320ab87c 592 Gets information about the item. See SetItem() for more information.
c86b476d
FM
593
594 You must call @e info.SetId() to set the ID of item you're interested in
595 before calling this method, and @e info.SetMask() with the flags indicating
596 what fields you need to retrieve from @a info.
1058f652
MB
597
598 @beginWxPerlOnly
599 In wxPerl this method takes as parameter the ID of the item
600 and (optionally) the column, and returns a Wx::ListItem object.
601 @endWxPerlOnly
23324ae1 602 */
328f5751 603 bool GetItem(wxListItem& info) const;
23324ae1
FM
604
605 /**
320ab87c
FM
606 Returns the colour for this item.
607 If the item has no specific colour, returns an invalid colour
608 (and not the default background control of the control itself).
3c4f71cc 609
4cc4bfaf 610 @see GetItemTextColour()
23324ae1 611 */
328f5751 612 wxColour GetItemBackgroundColour(long item) const;
23324ae1
FM
613
614 /**
615 Returns the number of items in the list control.
616 */
328f5751 617 int GetItemCount() const;
23324ae1
FM
618
619 /**
620 Gets the application-defined data associated with this item.
621 */
5267aefd 622 wxUIntPtr GetItemData(long item) const;
23324ae1
FM
623
624 /**
625 Returns the item's font.
626 */
328f5751 627 wxFont GetItemFont(long item) const;
23324ae1
FM
628
629 /**
630 Returns the position of the item, in icon or small icon view.
1058f652
MB
631
632 @beginWxPerlOnly
633 In wxPerl this method takes only the @a item parameter and
634 returns a @c Wx::Point (or @c undef).
635 @endWxPerlOnly
23324ae1 636 */
328f5751 637 bool GetItemPosition(long item, wxPoint& pos) const;
23324ae1
FM
638
639 /**
640 Returns the rectangle representing the item's size and position, in physical
641 coordinates.
320ab87c 642
4cc4bfaf 643 @a code is one of wxLIST_RECT_BOUNDS, wxLIST_RECT_ICON, wxLIST_RECT_LABEL.
1058f652
MB
644
645 @beginWxPerlOnly
646 In wxPerl this method takes only the @a item and @a code parameters and
647 returns a @c Wx::Rect (or @c undef).
648 @endWxPerlOnly
23324ae1
FM
649 */
650 bool GetItemRect(long item, wxRect& rect,
328f5751 651 int code = wxLIST_RECT_BOUNDS) const;
23324ae1
FM
652
653 /**
320ab87c
FM
654 Retrieves the spacing between icons in pixels: horizontal spacing is
655 returned as @c x component of the wxSize object and the vertical spacing
656 as its @c y component.
23324ae1 657 */
328f5751 658 wxSize GetItemSpacing() const;
23324ae1
FM
659
660 /**
661 Gets the item state. For a list of state flags, see SetItem().
320ab87c 662 The @a stateMask indicates which state flags are of interest.
23324ae1 663 */
328f5751 664 int GetItemState(long item, long stateMask) const;
23324ae1
FM
665
666 /**
667 Gets the item text for this item.
b6812a6f
VZ
668
669 @param item
670 Item (zero-based) index.
671 @param col
672 Item column (zero-based) index. Column 0 is the default. This
673 parameter is new in wxWidgets 2.9.1.
23324ae1 674 */
b6812a6f 675 wxString GetItemText(long item, int col = 0) const;
23324ae1
FM
676
677 /**
320ab87c
FM
678 Returns the colour for this item.
679
680 If the item has no specific colour, returns an invalid colour (and not the
681 default foreground control of the control itself as this wouldn't allow
682 distinguishing between items having the same colour as the current control
683 foreground and items with default colour which, hence, have always the
684 same colour as the control).
23324ae1 685 */
328f5751 686 wxColour GetItemTextColour(long item) const;
23324ae1
FM
687
688 /**
689 Searches for an item with the given geometry or state, starting from
320ab87c 690 @a item but excluding the @a item itself.
3c4f71cc 691
320ab87c
FM
692 If @a item is -1, the first item that matches the specified flags will be returned.
693 Returns the first item with given state following @a item or -1 if no such item found.
694 This function may be used to find all selected items in the control like this:
3c4f71cc 695
320ab87c
FM
696 @code
697 long item = -1;
698 for ( ;; )
699 {
700 item = listctrl->GetNextItem(item,
701 wxLIST_NEXT_ALL,
702 wxLIST_STATE_SELECTED);
703 if ( item == -1 )
704 break;
705
706 // this item is selected - do whatever is needed with it
707 wxLogMessage("Item %ld is selected.", item);
708 }
709 @endcode
3c4f71cc 710
320ab87c
FM
711 @a geometry can be one of:
712 - wxLIST_NEXT_ABOVE: Searches for an item above the specified item.
713 - wxLIST_NEXT_ALL: Searches for subsequent item by index.
714 - wxLIST_NEXT_BELOW: Searches for an item below the specified item.
715 - wxLIST_NEXT_LEFT: Searches for an item to the left of the specified item.
716 - wxLIST_NEXT_RIGHT: Searches for an item to the right of the specified item.
3c4f71cc 717
1f1d2182 718 @note this parameter is only supported by wxMSW currently and ignored on
320ab87c 719 other platforms.
3c4f71cc 720
320ab87c
FM
721 @a state can be a bitlist of the following:
722 - wxLIST_STATE_DONTCARE: Don't care what the state is.
723 - wxLIST_STATE_DROPHILITED: The item indicates it is a drop target.
724 - wxLIST_STATE_FOCUSED: The item has the focus.
725 - wxLIST_STATE_SELECTED: The item is selected.
726 - wxLIST_STATE_CUT: The item is selected as part of a cut and paste operation.
23324ae1
FM
727 */
728 long GetNextItem(long item, int geometry = wxLIST_NEXT_ALL,
328f5751 729 int state = wxLIST_STATE_DONTCARE) const;
23324ae1
FM
730
731 /**
732 Returns the number of selected items in the list control.
733 */
328f5751 734 int GetSelectedItemCount() const;
23324ae1
FM
735
736 /**
737 Returns the rectangle representing the size and position, in physical
4cc4bfaf 738 coordinates, of the given subitem, i.e. the part of the row @a item in the
320ab87c
FM
739 column @a subItem.
740
d13b34d3 741 This method is only meaningful when the wxListCtrl is in the report mode.
320ab87c 742 If @a subItem parameter is equal to the special value
23324ae1
FM
743 @c wxLIST_GETSUBITEMRECT_WHOLEITEM the return value is the same as
744 for GetItemRect().
320ab87c
FM
745
746 @a code can be one of @c wxLIST_RECT_BOUNDS, @c wxLIST_RECT_ICON or
747 @c wxLIST_RECT_LABEL.
3c4f71cc 748
1e24c2af 749 @since 2.7.0
23324ae1
FM
750 */
751 bool GetSubItemRect(long item, long subItem, wxRect& rect,
328f5751 752 int code = wxLIST_RECT_BOUNDS) const;
23324ae1
FM
753
754 /**
755 Gets the text colour of the list control.
756 */
328f5751 757 wxColour GetTextColour() const;
23324ae1
FM
758
759 /**
320ab87c 760 Gets the index of the topmost visible item when in list or report view.
23324ae1 761 */
328f5751 762 long GetTopItem() const;
23324ae1
FM
763
764 /**
765 Returns the rectangle taken by all items in the control. In other words, if the
766 controls client size were equal to the size of this rectangle, no scrollbars
767 would be needed and no free space would be left.
320ab87c 768
23324ae1
FM
769 Note that this function only works in the icon and small icon views, not in
770 list or report views (this is a limitation of the native Win32 control).
771 */
328f5751 772 wxRect GetViewRect() const;
23324ae1 773
0ee169da
VZ
774 /**
775 Set the alternative row background colour to a specific colour.
776
777 It is recommended to call EnableAlternateRowColours() instead of using
778 these methods as native implementations of this control might support
779 alternating row colours but not setting the exact colour to be used for
780 them.
781
782 As EnableAlternateRowColours(), this method can only be used with
783 controls having ::wxLC_REPORT and ::wxLC_VIRTUAL styles.
784
785 @param colour
786 A valid alternative row background colour to enable alternating
787 rows or invalid colour to disable them and use the same colour for
788 all rows.
789
790 @since 2.9.5
791 */
792 void SetAlternateRowColour(const wxColour& colour);
793
23324ae1 794 /**
320ab87c
FM
795 Determines which item (if any) is at the specified point, giving details
796 in @a flags. Returns index of the item or @c wxNOT_FOUND if no item is at
797 the specified point.
3c4f71cc 798
320ab87c
FM
799 @a flags will be a combination of the following flags:
800 - wxLIST_HITTEST_ABOVE: Above the client area.
801 - wxLIST_HITTEST_BELOW: Below the client area.
802 - wxLIST_HITTEST_NOWHERE: In the client area but below the last item.
803 - wxLIST_HITTEST_ONITEMICON: On the bitmap associated with an item.
804 - wxLIST_HITTEST_ONITEMLABEL: On the label (string) associated with an item.
805 - wxLIST_HITTEST_ONITEMRIGHT: In the area to the right of an item.
806 - wxLIST_HITTEST_ONITEMSTATEICON: On the state icon for a tree view item
807 that is in a user-defined state.
808 - wxLIST_HITTEST_TOLEFT: To the right of the client area.
809 - wxLIST_HITTEST_TORIGHT: To the left of the client area.
810 - wxLIST_HITTEST_ONITEM: Combination of @c wxLIST_HITTEST_ONITEMICON,
811 @c wxLIST_HITTEST_ONITEMLABEL, @c wxLIST_HITTEST_ONITEMSTATEICON.
3c4f71cc 812
4cc4bfaf 813 If @a ptrSubItem is not @NULL and the wxListCtrl is in the report
7c913512 814 mode the subitem (or column) number will also be provided.
23324ae1
FM
815 This feature is only available in version 2.7.0 or higher and is currently only
816 implemented under wxMSW and requires at least comctl32.dll of verion 4.70 on
320ab87c
FM
817 the host system or the value stored in @a ptrSubItem will be always -1.
818 To compile this feature into wxWidgets library you need to have access to
23324ae1 819 commctrl.h of version 4.70 that is provided by Microsoft.
1058f652
MB
820
821 @beginWxPerlOnly
822 In wxPerl this method only takes the @a point parameter
823 and returns a 2-element list (item, flags).
824 @endWxPerlOnly
23324ae1 825 */
5267aefd 826 long HitTest(const wxPoint& point, int& flags, long* ptrSubItem = NULL) const;
23324ae1 827
54d323d2
VZ
828 /**
829 Returns true if the control is currently using ::wxLC_REPORT style.
830 */
831 bool InReportView() const;
832
23324ae1 833 /**
0fb731b8
VZ
834 For report view mode (only), inserts a column.
835
836 For more details, see SetItem(). Also see InsertColumn(long, const
837 wxString&, int, int) overload for a usually more convenient
838 alternative to this method and the description of how the item width
839 is interpreted by this method.
23324ae1 840 */
0fb731b8 841 long InsertColumn(long col, const wxListItem& info);
320ab87c 842
1d7c0c08 843 /**
0fb731b8
VZ
844 For report view mode (only), inserts a column.
845
846 Insert a new column in the list control in report view mode at the
847 given position specifying its most common attributes.
848
849 Notice that to set the image for the column you need to use
850 Insert(long, const wxListItem&) overload and specify ::wxLIST_MASK_IMAGE
851 in the item mask.
852
853 @param col
854 The index where the column should be inserted. Valid indices are
855 from 0 up to GetColumnCount() inclusive and the latter can be used
856 to append the new column after the last existing one.
857 @param heading
858 The string specifying the column heading.
859 @param format
860 The flags specifying the control heading text alignment.
861 @param width
862 If positive, the width of the column in pixels. Otherwise it can be
863 @c wxLIST_AUTOSIZE to choose the default size for the column or @c
864 wxLIST_AUTOSIZE_USEHEADER to fit the column width to @a heading or
865 to extend to fill all the remaining space for the last column.
866 Notice that in case of @c wxLIST_AUTOSIZE fixed width is used as
867 there are no items in this column to use for determining its best
868 size yet. If you want to fit the column to its contents, use
869 SetColumnWidth() after adding the items with values in this column.
870 @return
871 The index of the inserted column or -1 if adding it failed.
1d7c0c08 872 */
7c913512
FM
873 long InsertColumn(long col, const wxString& heading,
874 int format = wxLIST_FORMAT_LEFT,
0fb731b8 875 int width = wxLIST_AUTOSIZE);
23324ae1 876
23324ae1 877 /**
320ab87c
FM
878 Inserts an item, returning the index of the new item if successful, -1 otherwise.
879
7c913512 880 @param info
4cc4bfaf 881 wxListItem object
b45506e8
VZ
882 */
883 long InsertItem(wxListItem& info);
884
885 /**
886 Insert an string item.
320ab87c 887
7c913512 888 @param index
4cc4bfaf 889 Index of the new item, supplied by the application
7c913512 890 @param label
4cc4bfaf 891 String label
1058f652
MB
892
893 @beginWxPerlOnly
894 In wxPerl this method is implemented as InsertStringItem(index, label).
895 @endWxPerlOnly
23324ae1 896 */
7c913512 897 long InsertItem(long index, const wxString& label);
320ab87c 898
b45506e8
VZ
899 /**
900 Insert an image item.
320ab87c 901
b45506e8
VZ
902 @param index
903 Index of the new item, supplied by the application
904 @param imageIndex
905 Index into the image list associated with this control and view style
1058f652
MB
906
907 @beginWxPerlOnly
908 In wxPerl this method is implemented as InsertImageItem(index, imageIndex).
909 @endWxPerlOnly
320ab87c 910 */
7c913512 911 long InsertItem(long index, int imageIndex);
320ab87c 912
b45506e8
VZ
913 /**
914 Insert an image/string item.
320ab87c 915
b45506e8
VZ
916 @param index
917 Index of the new item, supplied by the application
918 @param label
919 String label
920 @param imageIndex
921 Index into the image list associated with this control and view style
1058f652
MB
922
923 @beginWxPerlOnly
924 In wxPerl this method is implemented as InsertImageStringItem(index, label, imageIndex).
925 @endWxPerlOnly
320ab87c 926 */
7c913512
FM
927 long InsertItem(long index, const wxString& label,
928 int imageIndex);
23324ae1 929
54d323d2
VZ
930 /**
931 Returns true if the control is currently in virtual report view.
932 */
933 bool IsVirtual() const;
934
23324ae1 935 /**
320ab87c
FM
936 Redraws the given @e item.
937
938 This is only useful for the virtual list controls as without calling this
939 function the displayed value of the item doesn't change even when the
940 underlying data does change.
3c4f71cc 941
4cc4bfaf 942 @see RefreshItems()
23324ae1
FM
943 */
944 void RefreshItem(long item);
945
946 /**
320ab87c
FM
947 Redraws the items between @a itemFrom and @e itemTo.
948 The starting item must be less than or equal to the ending one.
949
950 Just as RefreshItem() this is only useful for virtual list controls.
23324ae1
FM
951 */
952 void RefreshItems(long itemFrom, long itemTo);
953
954 /**
955 Scrolls the list control. If in icon, small icon or report view mode,
4cc4bfaf
FM
956 @a dx specifies the number of pixels to scroll. If in list view mode,
957 @a dx specifies the number of columns to scroll. @a dy always specifies
23324ae1 958 the number of pixels to scroll vertically.
320ab87c 959
1f1d2182 960 @note This method is currently only implemented in the Windows version.
23324ae1
FM
961 */
962 bool ScrollList(int dx, int dy);
963
964 /**
320ab87c
FM
965 Sets the background colour.
966
967 Note that the wxWindow::GetBackgroundColour() function of wxWindow base
968 class can be used to retrieve the current background colour.
23324ae1 969 */
5267aefd 970 virtual bool SetBackgroundColour(const wxColour& col);
23324ae1
FM
971
972 /**
320ab87c
FM
973 Sets information about this column.
974 See SetItem() for more information.
23324ae1
FM
975 */
976 bool SetColumn(int col, wxListItem& item);
977
978 /**
979 Sets the column width.
320ab87c
FM
980
981 @a width can be a width in pixels or @c wxLIST_AUTOSIZE (-1) or
982 @c wxLIST_AUTOSIZE_USEHEADER (-2).
983
984 @c wxLIST_AUTOSIZE will resize the column to the length of its longest item.
985
986 @c wxLIST_AUTOSIZE_USEHEADER will resize the column to the length of the
987 header (Win32) or 80 pixels (other platforms).
988
4cc4bfaf 989 In small or normal icon view, @a col must be -1, and the column width is set
23324ae1
FM
990 for all columns.
991 */
992 bool SetColumnWidth(int col, int width);
993
994 /**
80cc5fc7
VZ
995 Changes the order in which the columns are shown.
996
997 By default, the columns of a list control appear on the screen in order
998 of their indices, i.e. the column 0 appears first, the column 1 next
999 and so on. However by using this function it is possible to arbitrarily
1000 reorder the columns visual order and the user can also rearrange the
1001 columns interactively by dragging them. In this case, the index of the
1002 column is not the same as its order and the functions GetColumnOrder()
1003 and GetColumnIndexFromOrder() should be used to translate between them.
1004 Notice that all the other functions still work with the column indices,
1005 i.e. the visual positioning of the columns on screen doesn't affect the
1006 code setting or getting their values for example.
320ab87c
FM
1007
1008 The @a orders array must have the same number elements as the number of
80cc5fc7
VZ
1009 columns and contain each position exactly once. Its n-th element
1010 contains the index of the column to be shown in n-th position, so for a
1011 control with three columns passing an array with elements 2, 0 and 1
1012 results in the third column being displayed first, the first one next
1013 and the second one last.
1014
1015 Example of using it:
1016 @code
1017 wxListCtrl *list = new wxListCtrl(...);
1018 for ( int i = 0; i < 3; i++ )
1019 list->InsertColumn(i, wxString::Format("Column %d", i));
1020
1021 wxArrayInt order(3);
1022 order[0] = 2;
1023 order[1] = 0;
1024 order[2] = 1;
1025 list->SetColumnsOrder(order);
1026
1027 // now list->GetColumnsOrder() will return order and
1028 // list->GetColumnIndexFromOrder(n) will return order[n] and
1029 // list->GetColumnOrder() will return 1, 2 and 0 for the column 0,
1030 // 1 and 2 respectively
1031 @endcode
1032
1033 Please notice that this function makes sense for report view only and
1034 currently is only implemented in wxMSW port. To avoid explicit tests
1035 for @c __WXMSW__ in your code, please use @c wxHAS_LISTCTRL_COLUMN_ORDER
1036 as this will allow it to start working under the other platforms when
1037 support for the column reordering is added there.
320ab87c 1038
80cc5fc7 1039 @see GetColumnsOrder()
23324ae1 1040 */
b5176f6d 1041 bool SetColumnsOrder(const wxArrayInt& orders);
23324ae1
FM
1042
1043 /**
320ab87c
FM
1044 Sets the image list associated with the control.
1045
1046 @a which is one of @c wxIMAGE_LIST_NORMAL, @c wxIMAGE_LIST_SMALL,
1047 @c wxIMAGE_LIST_STATE (the last is unimplemented).
1048
23324ae1
FM
1049 This method does not take ownership of the image list, you have to
1050 delete it yourself.
3c4f71cc 1051
4cc4bfaf 1052 @see AssignImageList()
23324ae1
FM
1053 */
1054 void SetImageList(wxImageList* imageList, int which);
1055
23324ae1 1056 /**
1d7c0c08 1057 Sets the data of an item.
320ab87c
FM
1058
1059 Using the wxListItem's mask and state mask, you can change only selected
1060 attributes of a wxListCtrl item.
23324ae1
FM
1061 */
1062 bool SetItem(wxListItem& info);
320ab87c 1063
1d7c0c08 1064 /**
320ab87c 1065 Sets an item string field at a particular column.
1d7c0c08 1066 */
320ab87c 1067 long SetItem(long index, int column, const wxString& label, int imageId = -1);
23324ae1
FM
1068
1069 /**
320ab87c
FM
1070 Sets the background colour for this item.
1071 This function only works in report view mode.
1072 The colour can be retrieved using GetItemBackgroundColour().
23324ae1
FM
1073 */
1074 void SetItemBackgroundColour(long item, const wxColour& col);
1075
1076 /**
320ab87c
FM
1077 Sets the image associated with the item.
1078 In report view, you can specify the column.
1079 The image is an index into the image list associated with the list control.
23324ae1
FM
1080 */
1081 bool SetItemColumnImage(long item, long column, int image);
1082
1083 /**
558a6e06
VZ
1084 This method can only be used with virtual list controls.
1085
1086 It is used to indicate to the control the number of items it contains.
1087 After calling it, the main program should be ready to handle calls to
1088 various item callbacks (such as wxListCtrl::OnGetItemText) for all
1089 items in the range from 0 to @a count.
1090
1091 Notice that the control is not necessarily redrawn after this call as
1092 it may be undesirable if an item which is not visible on the screen
1093 anyhow was added to or removed from a control displaying many items, if
1094 you do need to refresh the display you can just call Refresh() manually.
23324ae1
FM
1095 */
1096 void SetItemCount(long count);
1097
1098 /**
320ab87c
FM
1099 Associates application-defined data with this item.
1100
1101 Notice that this function cannot be used to associate pointers with the control
1102 items, use SetItemPtrData() instead.
23324ae1
FM
1103 */
1104 bool SetItemData(long item, long data);
1105
1106 /**
1d7c0c08 1107 Sets the item's font.
23324ae1
FM
1108 */
1109 void SetItemFont(long item, const wxFont& font);
1110
23324ae1 1111 /**
320ab87c
FM
1112 Sets the unselected and selected images associated with the item.
1113 The images are indices into the image list associated with the list control.
23324ae1 1114 */
5267aefd 1115 bool SetItemImage(long item, int image, int selImage = -1);
320ab87c 1116
23324ae1
FM
1117
1118 /**
1119 Sets the position of the item, in icon or small icon view. Windows only.
1120 */
1121 bool SetItemPosition(long item, const wxPoint& pos);
1122
1123 /**
320ab87c
FM
1124 Associates application-defined data with this item.
1125
1126 The @a data parameter may be either an integer or a pointer cast to the
1127 @c wxUIntPtr type which is guaranteed to be large enough to be able to
1128 contain all integer types and pointers.
3c4f71cc 1129
1e24c2af 1130 @since 2.8.4
23324ae1
FM
1131 */
1132 bool SetItemPtrData(long item, wxUIntPtr data);
1133
1134 /**
f9c2e12f
VZ
1135 Sets the item state.
1136
1137 The @a stateMask is a combination of @c wxLIST_STATE_XXX constants
1138 described in wxListItem documentation. For each of the bits specified
1139 in @a stateMask, the corresponding state is set or cleared depending on
1140 whether @a state argument contains the same bit or not.
1141
1142 So to select an item you can use
1143 @code
1144 list->SetItemState(item, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
1145 @endcode
1146 while to deselect it you should use
1147 @code
1148 list->SetItemState(item, 0, wxLIST_STATE_SELECTED);
1149 @endcode
1150
1151 Consider using wxListView if possible to avoid dealing with this
1152 error-prone and confusing method.
23324ae1
FM
1153 */
1154 bool SetItemState(long item, long state, long stateMask);
1155
1156 /**
1157 Sets the item text for this item.
1158 */
1159 void SetItemText(long item, const wxString& text);
1160
1161 /**
320ab87c
FM
1162 Sets the colour for this item.
1163 This function only works in report view.
1164 The colour can be retrieved using GetItemTextColour().
23324ae1
FM
1165 */
1166 void SetItemTextColour(long item, const wxColour& col);
1167
1168 /**
1169 Adds or removes a single window style.
1170 */
4cc4bfaf 1171 void SetSingleStyle(long style, bool add = true);
23324ae1
FM
1172
1173 /**
1174 Sets the text colour of the list control.
1175 */
1176 void SetTextColour(const wxColour& col);
1177
1178 /**
1179 Sets the whole window style, deleting all items.
1180 */
1181 void SetWindowStyleFlag(long style);
1182
1183 /**
1184 Call this function to sort the items in the list control. Sorting is done
4cc4bfaf 1185 using the specified @a fnSortCallBack function. This function must have the
23324ae1 1186 following prototype:
320ab87c 1187 @code
d3ca8487 1188 int wxCALLBACK wxListCompareFunction(wxIntPtr item1, wxIntPtr item2, wxIntPtr sortData)
320ab87c 1189 @endcode
3c4f71cc 1190
23324ae1
FM
1191 It is called each time when the two items must be compared and should return 0
1192 if the items are equal, negative value if the first item is less than the
1193 second one and positive value if the first one is greater than the second one
1194 (the same convention as used by @c qsort(3)).
3c4f71cc 1195
320ab87c
FM
1196 The parameter @e item1 is the client data associated with the first item (NOT the index).
1197 The parameter @e item2 is the client data associated with the second item (NOT the index).
1198 The parameter @e data is the value passed to SortItems() itself.
1199
1200 Notice that the control may only be sorted on client data associated with
1201 the items, so you must use SetItemData if you want to be able to sort the
1202 items in the control.
1203
1204 Please see the @ref page_samples_listctrl for an example of using this function.
1058f652
MB
1205
1206 @beginWxPerlOnly
1207 In wxPerl the comparison function must take just two parameters;
1208 however, you may use a closure to achieve an effect similar to the
1209 SortItems third parameter.
1210 @endWxPerlOnly
23324ae1 1211 */
b18e2046 1212 bool SortItems(wxListCtrlCompare fnSortCallBack, wxIntPtr data);
5e6e278d
FM
1213
1214protected:
1215
1216 /**
75504144 1217 This function may be overridden in the derived class for a control with
5e6e278d
FM
1218 @c wxLC_VIRTUAL style. It should return the attribute for the specified
1219 @c item or @NULL to use the default appearance parameters.
1220
1221 wxListCtrl will not delete the pointer or keep a reference of it.
1222 You can return the same wxListItemAttr pointer for every OnGetItemAttr() call.
1223
1224 The base class version always returns @NULL.
1225
eab1336c
VZ
1226 @see OnGetItemImage(), OnGetItemColumnImage(), OnGetItemText(),
1227 OnGetItemColumnAttr()
5e6e278d
FM
1228 */
1229 virtual wxListItemAttr* OnGetItemAttr(long item) const;
1230
eab1336c
VZ
1231 /**
1232 This function may be overridden in the derived class for a control with
1233 @c wxLC_VIRTUAL style.
1234
1235 It should return the attribute for the for the specified @a item and @a
1236 column or @NULL to use the default appearance parameters.
1237
1238 The base class version returns @c OnGetItemAttr(item).
1239
1240 @note Currently this function is only called under wxMSW, the other
1241 ports only support OnGetItemAttr()
1242
1243 @see OnGetItemAttr(), OnGetItemText(),
1244 OnGetItemImage(), OnGetItemColumnImage(),
1245 */
1246 virtual wxListItemAttr* OnGetItemColumnAttr(long item, long column) const;
1247
5e6e278d 1248 /**
75504144 1249 Override this function in the derived class for a control with
5e6e278d
FM
1250 @c wxLC_VIRTUAL and @c wxLC_REPORT styles in order to specify the image
1251 index for the given line and column.
1252
1253 The base class version always calls OnGetItemImage() for the first column, else
1254 it returns -1.
1255
eab1336c
VZ
1256 @see OnGetItemText(), OnGetItemImage(), OnGetItemAttr(),
1257 OnGetItemColumnAttr()
5e6e278d
FM
1258 */
1259 virtual int OnGetItemColumnImage(long item, long column) const;
1260
1261 /**
75504144 1262 This function must be overridden in the derived class for a control with
e2c4ccaf 1263 @c wxLC_VIRTUAL style having an "image list" (see SetImageList(); if the
75504144 1264 control doesn't have an image list, it is not necessary to override it).
5e6e278d
FM
1265 It should return the index of the items image in the controls image list
1266 or -1 for no image.
1267
1268 In a control with @c wxLC_REPORT style, OnGetItemImage() only gets called for
1269 the first column of each line.
1270
1271 The base class version always returns -1.
1272
1273 @see OnGetItemText(), OnGetItemColumnImage(), OnGetItemAttr()
1274 */
1275 virtual int OnGetItemImage(long item) const;
1276
1277 /**
75504144 1278 This function @b must be overridden in the derived class for a control with
5e6e278d
FM
1279 @c wxLC_VIRTUAL style. It should return the string containing the text of
1280 the given @a column for the specified @c item.
1281
1282 @see SetItemCount(), OnGetItemImage(), OnGetItemColumnImage(), OnGetItemAttr()
1283 */
1284 virtual wxString OnGetItemText(long item, long column) const;
23324ae1
FM
1285};
1286
1287
e54c96f1 1288
23324ae1
FM
1289/**
1290 @class wxListEvent
7c913512 1291
23324ae1 1292 A list event holds information about events associated with wxListCtrl objects.
7c913512 1293
320ab87c
FM
1294 @beginEventTable{wxListEvent}
1295 @event{EVT_LIST_BEGIN_DRAG(id, func)}
1296 Begin dragging with the left mouse button.
1297 @event{EVT_LIST_BEGIN_RDRAG(id, func)}
1298 Begin dragging with the right mouse button.
1299 @event{EVT_LIST_BEGIN_LABEL_EDIT(id, func)}
1300 Begin editing a label. This can be prevented by calling Veto().
1301 @event{EVT_LIST_END_LABEL_EDIT(id, func)}
1302 Finish editing a label. This can be prevented by calling Veto().
1303 @event{EVT_LIST_DELETE_ITEM(id, func)}
1304 Delete an item.
1305 @event{EVT_LIST_DELETE_ALL_ITEMS(id, func)}
1306 Delete all items.
1307 @event{EVT_LIST_ITEM_SELECTED(id, func)}
1308 The item has been selected.
1309 @event{EVT_LIST_ITEM_DESELECTED(id, func)}
1310 The item has been deselected.
1311 @event{EVT_LIST_ITEM_ACTIVATED(id, func)}
1312 The item has been activated (ENTER or double click).
1313 @event{EVT_LIST_ITEM_FOCUSED(id, func)}
1314 The currently focused item has changed.
1315 @event{EVT_LIST_ITEM_MIDDLE_CLICK(id, func)}
1316 The middle mouse button has been clicked on an item.
1317 @event{EVT_LIST_ITEM_RIGHT_CLICK(id, func)}
1318 The right mouse button has been clicked on an item.
1319 @event{EVT_LIST_KEY_DOWN(id, func)}
92d9d10f 1320 A key has been pressed. GetIndex() may be -1 if no item is selected.
320ab87c
FM
1321 @event{EVT_LIST_INSERT_ITEM(id, func)}
1322 An item has been inserted.
1323 @event{EVT_LIST_COL_CLICK(id, func)}
1324 A column (m_col) has been left-clicked.
1325 @event{EVT_LIST_COL_RIGHT_CLICK(id, func)}
1326 A column (m_col) (which can be -1 if the click occurred outside any column)
1327 has been right-clicked.
1328 @event{EVT_LIST_COL_BEGIN_DRAG(id, func)}
1329 The user started resizing a column - can be vetoed.
1330 @event{EVT_LIST_COL_DRAGGING(id, func)}
1331 The divider between columns is being dragged.
1332 @event{EVT_LIST_COL_END_DRAG(id, func)}
1333 A column has been resized by the user.
1334 @event{EVT_LIST_CACHE_HINT(id, func)}
1335 Prepare cache for a virtual list control
1336 @endEventTable
1337
1338
f00f01b3 1339 @library{wxcore}
23324ae1 1340 @category{events}
7c913512 1341
e54c96f1 1342 @see wxListCtrl
23324ae1
FM
1343*/
1344class wxListEvent : public wxNotifyEvent
1345{
1346public:
1347 /**
1348 Constructor.
1349 */
0a98423e 1350 wxListEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
23324ae1
FM
1351
1352 /**
1353 For @c EVT_LIST_CACHE_HINT event only: return the first item which the
1354 list control advises us to cache.
1355 */
328f5751 1356 long GetCacheFrom() const;
23324ae1
FM
1357
1358 /**
1359 For @c EVT_LIST_CACHE_HINT event only: return the last item (inclusive)
1360 which the list control advises us to cache.
1361 */
328f5751 1362 long GetCacheTo() const;
23324ae1
FM
1363
1364 /**
320ab87c
FM
1365 The column position: it is only used with @c COL events.
1366
1367 For the column dragging events, it is the column to the left of the divider
1368 being dragged, for the column click events it may be -1 if the user clicked
1369 in the list control header outside any column.
23324ae1 1370 */
328f5751 1371 int GetColumn() const;
23324ae1
FM
1372
1373 /**
1374 The data.
1375 */
328f5751 1376 long GetData() const;
23324ae1
FM
1377
1378 /**
1379 The image.
1380 */
328f5751 1381 int GetImage() const;
23324ae1
FM
1382
1383 /**
1384 The item index.
1385 */
328f5751 1386 long GetIndex() const;
23324ae1
FM
1387
1388 /**
1389 An item object, used by some events. See also wxListCtrl::SetItem.
1390 */
5267aefd 1391 const wxListItem& GetItem() const;
23324ae1
FM
1392
1393 /**
1394 Key code if the event is a keypress event.
1395 */
328f5751 1396 int GetKeyCode() const;
23324ae1
FM
1397
1398 /**
1399 The (new) item label for @c EVT_LIST_END_LABEL_EDIT event.
1400 */
5267aefd 1401 const wxString& GetLabel() const;
23324ae1
FM
1402
1403 /**
1404 The mask.
1405 */
328f5751 1406 long GetMask() const;
23324ae1
FM
1407
1408 /**
1409 The position of the mouse pointer if the event is a drag event.
1410 */
328f5751 1411 wxPoint GetPoint() const;
23324ae1
FM
1412
1413 /**
1414 The text.
1415 */
5267aefd 1416 const wxString& GetText() const;
23324ae1
FM
1417
1418 /**
320ab87c
FM
1419 This method only makes sense for @c EVT_LIST_END_LABEL_EDIT message and
1420 returns @true if it the label editing has been cancelled by the user
1421 (GetLabel() returns an empty string in this case but it doesn't allow the
1422 application to distinguish between really cancelling the edit and the
1423 admittedly rare case when the user wants to rename it to an empty string).
23324ae1 1424 */
328f5751 1425 bool IsEditCancelled() const;
23324ae1
FM
1426};
1427
1428
ce7fe42e
VZ
1429wxEventType wxEVT_LIST_BEGIN_DRAG;
1430wxEventType wxEVT_LIST_BEGIN_RDRAG;
1431wxEventType wxEVT_LIST_BEGIN_LABEL_EDIT;
1432wxEventType wxEVT_LIST_END_LABEL_EDIT;
1433wxEventType wxEVT_LIST_DELETE_ITEM;
1434wxEventType wxEVT_LIST_DELETE_ALL_ITEMS;
1435wxEventType wxEVT_LIST_ITEM_SELECTED;
1436wxEventType wxEVT_LIST_ITEM_DESELECTED;
1437wxEventType wxEVT_LIST_KEY_DOWN;
1438wxEventType wxEVT_LIST_INSERT_ITEM;
1439wxEventType wxEVT_LIST_COL_CLICK;
1440wxEventType wxEVT_LIST_ITEM_RIGHT_CLICK;
1441wxEventType wxEVT_LIST_ITEM_MIDDLE_CLICK;
1442wxEventType wxEVT_LIST_ITEM_ACTIVATED;
1443wxEventType wxEVT_LIST_CACHE_HINT;
1444wxEventType wxEVT_LIST_COL_RIGHT_CLICK;
1445wxEventType wxEVT_LIST_COL_BEGIN_DRAG;
1446wxEventType wxEVT_LIST_COL_DRAGGING;
1447wxEventType wxEVT_LIST_COL_END_DRAG;
1448wxEventType wxEVT_LIST_ITEM_FOCUSED;
0ffc1704 1449
e54c96f1 1450
23324ae1
FM
1451/**
1452 @class wxListItemAttr
7c913512 1453
320ab87c 1454 Represents the attributes (color, font, ...) of a wxListCtrl's wxListItem.
7c913512 1455
f00f01b3 1456 @library{wxcore}
3c99e2fd 1457 @category{data}
7c913512 1458
320ab87c 1459 @see @ref overview_listctrl, wxListCtrl, wxListItem
23324ae1 1460*/
7c913512 1461class wxListItemAttr
23324ae1
FM
1462{
1463public:
1d7c0c08
RR
1464 /**
1465 Default Constructor.
1466 */
1467 wxListItemAttr();
320ab87c 1468
23324ae1
FM
1469 /**
1470 Construct a wxListItemAttr with the specified foreground and
1471 background colors and font.
1472 */
0a98423e
FM
1473 wxListItemAttr(const wxColour& colText,
1474 const wxColour& colBack,
1475 const wxFont& font);
23324ae1
FM
1476
1477 /**
1478 Returns the currently set background color.
1479 */
320ab87c 1480 const wxColour& GetBackgroundColour() const;
23324ae1
FM
1481
1482 /**
1483 Returns the currently set font.
1484 */
320ab87c 1485 const wxFont& GetFont() const;
23324ae1
FM
1486
1487 /**
1488 Returns the currently set text color.
1489 */
320ab87c 1490 const wxColour& GetTextColour() const;
23324ae1
FM
1491
1492 /**
1493 Returns @true if the currently set background color is valid.
1494 */
328f5751 1495 bool HasBackgroundColour() const;
23324ae1
FM
1496
1497 /**
1498 Returns @true if the currently set font is valid.
1499 */
328f5751 1500 bool HasFont() const;
23324ae1
FM
1501
1502 /**
1503 Returns @true if the currently set text color is valid.
1504 */
328f5751 1505 bool HasTextColour() const;
23324ae1
FM
1506
1507 /**
1508 Sets a new background color.
1509 */
1510 void SetBackgroundColour(const wxColour& colour);
1511
1512 /**
1513 Sets a new font.
1514 */
1515 void SetFont(const wxFont& font);
1516
1517 /**
1518 Sets a new text color.
1519 */
1520 void SetTextColour(const wxColour& colour);
1521};
1522
1523
e54c96f1 1524
23324ae1
FM
1525/**
1526 @class wxListView
7c913512
FM
1527
1528 This class currently simply presents a simpler to use interface for the
320ab87c
FM
1529 wxListCtrl -- it can be thought of as a @e façade for that complicated class.
1530
1531 Using it is preferable to using wxListCtrl directly whenever possible because
1532 in the future some ports might implement wxListView but not the full set of
1533 wxListCtrl features.
7c913512 1534
320ab87c
FM
1535 Other than different interface, this class is identical to wxListCtrl.
1536 In particular, it uses the same events, same window styles and so on.
7c913512 1537
23324ae1
FM
1538 @library{wxcore}
1539 @category{ctrl}
ce154616 1540 @appearance{listview}
7c913512 1541
e54c96f1 1542 @see wxListView::SetColumnImage
23324ae1
FM
1543*/
1544class wxListView : public wxListCtrl
1545{
1546public:
1547 /**
1548 Resets the column image -- after calling this function, no image will be shown.
3c4f71cc 1549
7c913512 1550 @param col
4cc4bfaf 1551 the column to clear image for
3c4f71cc 1552
4cc4bfaf 1553 @see SetColumnImage()
23324ae1
FM
1554 */
1555 void ClearColumnImage(int col);
1556
1557 /**
320ab87c 1558 Sets focus to the item with the given @a index.
23324ae1
FM
1559 */
1560 void Focus(long index);
1561
1562 /**
1563 Returns the first selected item in a (presumably) multiple selection control.
320ab87c
FM
1564 Together with GetNextSelected() it can be used to iterate over all selected
1565 items in the control.
3c4f71cc 1566
d29a9a8a 1567 @return The first selected item, if any, -1 otherwise.
23324ae1 1568 */
328f5751 1569 long GetFirstSelected() const;
23324ae1
FM
1570
1571 /**
1572 Returns the currently focused item or -1 if none.
3c4f71cc 1573
4cc4bfaf 1574 @see IsSelected(), Focus()
23324ae1 1575 */
328f5751 1576 long GetFocusedItem() const;
23324ae1
FM
1577
1578 /**
320ab87c
FM
1579 Used together with GetFirstSelected() to iterate over all selected items
1580 in the control.
3c4f71cc 1581
320ab87c 1582 @return Returns the next selected item or -1 if there are no more of them.
23324ae1 1583 */
328f5751 1584 long GetNextSelected(long item) const;
23324ae1
FM
1585
1586 /**
4cc4bfaf 1587 Returns @true if the item with the given @a index is selected,
23324ae1 1588 @false otherwise.
3c4f71cc 1589
4cc4bfaf 1590 @see GetFirstSelected(), GetNextSelected()
23324ae1 1591 */
328f5751 1592 bool IsSelected(long index) const;
23324ae1
FM
1593
1594 /**
1595 Selects or unselects the given item.
3c4f71cc 1596
7c913512 1597 @param n
4cc4bfaf 1598 the item to select or unselect
7c913512 1599 @param on
4cc4bfaf 1600 if @true (default), selects the item, otherwise unselects it
3c4f71cc 1601
4cc4bfaf 1602 @see wxListCtrl::SetItemState
23324ae1 1603 */
792255cc 1604 void Select(long n, bool on = true);
23324ae1
FM
1605
1606 /**
320ab87c
FM
1607 Sets the column image for the specified column.
1608 To use the column images, the control must have a valid image list with
1609 at least one image.
3c4f71cc 1610
7c913512 1611 @param col
4cc4bfaf 1612 the column to set image for
7c913512 1613 @param image
4cc4bfaf 1614 the index of the column image in the controls image list
23324ae1
FM
1615 */
1616 void SetColumnImage(int col, int image);
1617};
1618
1619
e54c96f1 1620
23324ae1
FM
1621/**
1622 @class wxListItem
7c913512 1623
23324ae1 1624 This class stores information about a wxListCtrl item or column.
7c913512 1625
320ab87c
FM
1626 wxListItem is a class which contains informations about:
1627 - Zero based item position; see SetId() and GetId().
1628 - Zero based column index; see SetColumn() and GetColumn().
1629 - The label (or header for columns); see SetText() and GetText().
1630 - The zero based index into an image list; see GetImage() and SetImage().
1631 - Application defined data; see SetData() and GetData().
1632 - For columns only: the width of the column; see SetWidth() and GetWidth().
1633 - For columns only: the format of the column; one of @c wxLIST_FORMAT_LEFT,
1634 @c wxLIST_FORMAT_RIGHT, @c wxLIST_FORMAT_CENTRE. See SetAlign() and GetAlign().
1635 - The state of the item; see SetState() and GetState().
1636 This is a bitlist of the following flags:
1637 - @c wxLIST_STATE_FOCUSED: The item has the focus.
1638 - @c wxLIST_STATE_SELECTED: The item is selected.
1639 - @c wxLIST_STATE_DONTCARE: Don't care what the state is. Win32 only.
1640 - @c wxLIST_STATE_DROPHILITED: The item is highlighted to receive a drop event. Win32 only.
1641 - @c wxLIST_STATE_CUT: The item is in the cut state. Win32 only.
1642 - A mask indicating which state flags are valid; this is a bitlist of the
1643 flags reported above for the item state. See SetStateMask() and GetStateMask().
1644 - A mask indicating which fields of this class are valid; see SetMask() and GetMask().
1645 This is a bitlist of the following flags:
1646 - @c wxLIST_MASK_STATE: The state field is valid.
1647 - @c wxLIST_MASK_TEXT: The label field is valid.
1648 - @c wxLIST_MASK_IMAGE: The image field is valid.
1649 - @c wxLIST_MASK_DATA: The application-defined data field is valid.
1650 - @c wxLIST_MASK_WIDTH: The column width field is valid.
1651 - @c wxLIST_MASK_FORMAT: The column format field is valid.
1652
1653 The wxListItem object can also contain item-specific colour and font
1654 information: for this you need to call one of SetTextColour(), SetBackgroundColour()
1655 or SetFont() functions on it passing it the colour/font to use.
1656 If the colour/font is not specified, the default list control colour/font is used.
1657
f00f01b3 1658 @library{wxcore}
3c99e2fd 1659 @category{data}
320ab87c
FM
1660
1661 @see wxListCtrl
23324ae1
FM
1662*/
1663class wxListItem : public wxObject
1664{
1665public:
1666 /**
1667 Constructor.
1668 */
1669 wxListItem();
1670
1671 /**
1672 Resets the item state to the default.
1673 */
1674 void Clear();
1675
1676 /**
320ab87c
FM
1677 Returns the alignment for this item.
1678 Can be one of @c wxLIST_FORMAT_LEFT, @c wxLIST_FORMAT_RIGHT or @c wxLIST_FORMAT_CENTRE.
23324ae1 1679 */
328f5751 1680 wxListColumnFormat GetAlign() const;
23324ae1
FM
1681
1682 /**
1683 Returns the background colour for this item.
1684 */
328f5751 1685 wxColour GetBackgroundColour() const;
23324ae1
FM
1686
1687 /**
1688 Returns the zero-based column; meaningful only in report mode.
1689 */
328f5751 1690 int GetColumn() const;
23324ae1
FM
1691
1692 /**
320ab87c
FM
1693 Returns client data associated with the control.
1694 Please note that client data is associated with the item and not with subitems.
23324ae1 1695 */
5267aefd 1696 wxUIntPtr GetData() const;
23324ae1
FM
1697
1698 /**
1699 Returns the font used to display the item.
1700 */
328f5751 1701 wxFont GetFont() const;
23324ae1
FM
1702
1703 /**
1704 Returns the zero-based item position.
1705 */
328f5751 1706 long GetId() const;
23324ae1
FM
1707
1708 /**
320ab87c
FM
1709 Returns the zero-based index of the image associated with the item into
1710 the image list.
23324ae1 1711 */
328f5751 1712 int GetImage() const;
23324ae1
FM
1713
1714 /**
320ab87c 1715 Returns a bit mask indicating which fields of the structure are valid.
3c4f71cc 1716
320ab87c
FM
1717 Can be any combination of the following values:
1718 - wxLIST_MASK_STATE: @b GetState is valid.
1719 - wxLIST_MASK_TEXT: @b GetText is valid.
1720 - wxLIST_MASK_IMAGE: @b GetImage is valid.
1721 - wxLIST_MASK_DATA: @b GetData is valid.
1722 - wxLIST_MASK_WIDTH: @b GetWidth is valid.
1723 - wxLIST_MASK_FORMAT: @b GetFormat is valid.
23324ae1 1724 */
328f5751 1725 long GetMask() const;
23324ae1
FM
1726
1727 /**
320ab87c 1728 Returns a bit field representing the state of the item.
3c4f71cc 1729
320ab87c
FM
1730 Can be any combination of:
1731 - wxLIST_STATE_DONTCARE: Don't care what the state is. Win32 only.
1732 - wxLIST_STATE_DROPHILITED: The item is highlighted to receive a drop event. Win32 only.
1733 - wxLIST_STATE_FOCUSED: The item has the focus.
1734 - wxLIST_STATE_SELECTED: The item is selected.
1735 - wxLIST_STATE_CUT: The item is in the cut state. Win32 only.
23324ae1 1736 */
328f5751 1737 long GetState() const;
23324ae1
FM
1738
1739 /**
1740 Returns the label/header text.
1741 */
320ab87c 1742 const wxString& GetText() const;
23324ae1
FM
1743
1744 /**
1745 Returns the text colour.
1746 */
328f5751 1747 wxColour GetTextColour() const;
23324ae1
FM
1748
1749 /**
1750 Meaningful only for column headers in report mode. Returns the column width.
1751 */
328f5751 1752 int GetWidth() const;
23324ae1
FM
1753
1754 /**
320ab87c 1755 Sets the alignment for the item. See also GetAlign()
23324ae1
FM
1756 */
1757 void SetAlign(wxListColumnFormat align);
1758
1759 /**
1760 Sets the background colour for the item.
1761 */
1762 void SetBackgroundColour(const wxColour& colBack);
1763
1764 /**
1765 Sets the zero-based column. Meaningful only in report mode.
1766 */
1767 void SetColumn(int col);
1768
1769 //@{
1770 /**
320ab87c
FM
1771 Sets client data for the item.
1772 Please note that client data is associated with the item and not with subitems.
23324ae1
FM
1773 */
1774 void SetData(long data);
7c913512 1775 void SetData(void* data);
23324ae1
FM
1776 //@}
1777
1778 /**
1779 Sets the font for the item.
1780 */
1781 void SetFont(const wxFont& font);
1782
1783 /**
1784 Sets the zero-based item position.
1785 */
1786 void SetId(long id);
1787
1788 /**
1789 Sets the zero-based index of the image associated with the item
1790 into the image list.
1791 */
1792 void SetImage(int image);
1793
1794 /**
1795 Sets the mask of valid fields. See GetMask().
1796 */
1797 void SetMask(long mask);
1798
1799 /**
1800 Sets the item state flags (note that the valid state flags are influenced
320ab87c
FM
1801 by the value of the state mask, see wxListItem::SetStateMask).
1802
1803 See GetState() for valid flag values.
23324ae1
FM
1804 */
1805 void SetState(long state);
1806
1807 /**
1808 Sets the bitmask that is used to determine which of the state flags
1809 are to be set. See also SetState().
1810 */
1811 void SetStateMask(long stateMask);
1812
1813 /**
1814 Sets the text label for the item.
1815 */
1816 void SetText(const wxString& text);
1817
1818 /**
1819 Sets the text colour for the item.
1820 */
1821 void SetTextColour(const wxColour& colText);
1822
1823 /**
1824 Meaningful only for column headers in report mode. Sets the column width.
1825 */
1826 void SetWidth(int width);
1827};
e54c96f1 1828