]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/listctrl.h
Moved list of subclasses away from 'classes overview' corrected some wxGrid overview...
[wxWidgets.git] / interface / wx / listctrl.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: listctrl.h
e54c96f1 3// Purpose: interface of wxListCtrl
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10 @class wxListCtrl
7c913512 11
23324ae1
FM
12 A list control presents lists in a number of formats: list view, report view,
13 icon view and small icon view. In any case, elements are numbered from zero.
14 For all these modes, the items are stored in the control and must be added to
15 it using wxListCtrl::InsertItem method.
7c913512 16
23324ae1
FM
17 A special case of report view quite different from the other modes of the list
18 control is a virtual control in which the items data (including text, images
19 and attributes) is managed by the main program and is requested by the control
20 itself only when needed which allows to have controls with millions of items
21 without consuming much memory. To use virtual list control you must use
22 wxListCtrl::SetItemCount first and overload at least
23 wxListCtrl::OnGetItemText (and optionally
24 wxListCtrl::OnGetItemImage or wxListCtrl::OnGetItemColumnImage and
25 wxListCtrl::OnGetItemAttr) to return the information
26 about the items when the control requests it. Virtual list control can be used
27 as a normal one except that no operations which can take time proportional to
28 the number of items in the control happen -- this is required to allow having a
29 practically infinite number of items. For example, in a multiple selection
30 virtual list control, the selections won't be sent when many items are selected
31 at once because this could mean iterating over all the items.
7c913512 32
23324ae1
FM
33 Using many of wxListCtrl features is shown in the
34 @ref overview_samplelistctrl "corresponding sample".
7c913512 35
23324ae1
FM
36 To intercept events from a list control, use the event table macros described
37 in wxListEvent.
7c913512
FM
38
39 @b Mac Note: Starting with 2.8, wxListCtrl uses a native implementation for
23324ae1
FM
40 report mode, and uses a generic implementation for other modes. You can use the
41 generic implementation for report mode as well by setting the
2e2b4d24
RR
42 mac.listctrl.always_use_generic wxSystemOption() to 1.
43
44 Column reordering (only wxMSW): In report view, the control has several columns
45 which are identified by their internal indices. By default, these indices
46 correspond to their order on screen, i.e. the column 0 appears first (in the
47 left-to-right or maybe right-to-left if the current language uses this writing
48 direction), the column 1 next and so on. However it is possible to reorder the
49 columns visual order using SetColumnsOrder() method and the user can also
50 rearrange the columns interactively by dragging them. In this case, the index
51 of the column is not the same as its order and the functions GetColumnOrder() and
52 GetColumnIndexFromOrder() should be used to translate between them.
53
7c913512 54
23324ae1 55 @beginStyleTable
8c6791e4 56 @style{wxLC_LIST}
23324ae1
FM
57 Multicolumn list view, with optional small icons. Columns are
58 computed automatically, i.e. you don't set columns as in
59 wxLC_REPORT. In other words, the list wraps, unlike a wxListBox.
8c6791e4 60 @style{wxLC_REPORT}
23324ae1 61 Single or multicolumn report view, with optional header.
8c6791e4 62 @style{wxLC_VIRTUAL}
23324ae1
FM
63 The application provides items text on demand. May only be used
64 with wxLC_REPORT.
8c6791e4 65 @style{wxLC_ICON}
23324ae1 66 Large icon view, with optional labels.
8c6791e4 67 @style{wxLC_SMALL_ICON}
23324ae1 68 Small icon view, with optional labels.
8c6791e4 69 @style{wxLC_ALIGN_TOP}
23324ae1 70 Icons align to the top. Win32 default, Win32 only.
8c6791e4 71 @style{wxLC_ALIGN_LEFT}
23324ae1 72 Icons align to the left.
8c6791e4 73 @style{wxLC_AUTOARRANGE}
23324ae1 74 Icons arrange themselves. Win32 only.
8c6791e4 75 @style{wxLC_EDIT_LABELS}
23324ae1
FM
76 Labels are editable: the application will be notified when editing
77 starts.
8c6791e4 78 @style{wxLC_NO_HEADER}
23324ae1 79 No header in report mode.
8c6791e4 80 @style{wxLC_SINGLE_SEL}
23324ae1 81 Single selection (default is multiple).
8c6791e4 82 @style{wxLC_SORT_ASCENDING}
b45506e8
VZ
83 Sort in ascending order. (You must still supply a comparison callback
84 in wxListCtrl::SortItems.)
8c6791e4 85 @style{wxLC_SORT_DESCENDING}
b45506e8
VZ
86 Sort in descending order. (You must still supply a comparison callback
87 in wxListCtrl::SortItems.)
8c6791e4 88 @style{wxLC_HRULES}
23324ae1 89 Draws light horizontal rules between rows in report mode.
8c6791e4 90 @style{wxLC_VRULES}
23324ae1
FM
91 Draws light vertical rules between columns in report mode.
92 @endStyleTable
7c913512 93
2e2b4d24
RR
94
95 @beginEventTable{wxListEvent}
96 @event{EVT_LIST_BEGIN_DRAG(id, func)}
97 Begin dragging with the left mouse button.
98 @event{EVT_LIST_BEGIN_RDRAG(id, func)}
99 Begin dragging with the right mouse button..
100 @event{EVT_BEGIN_LABEL_EDIT(id, func)}
101 Begin editing a label. This can be prevented by calling Veto().
102 @event{EVT_LIST_END_LABEL_EDIT(id, func)}
103 Finish editing a label. This can be prevented by calling Veto().
104 @event{EVT_LIST_DELETE_ITEM(id, func)}
105 An item was deleted.
106 @event{EVT_LIST_DELETE_ALL_ITEMS(id, func)}
107 All items were deleted.
108 @event{EVT_LIST_ITEM_SELECTED(id, func)}
109 The item has been selected.
110 @event{EVT_LIST_ITEM_DESELECTED(id, func)}
111 The item has been deselected.
112 @event{EVT_LIST_ITEM_ACTIVATED(id, func)}
113 The item has been activated (ENTER or double click).
114 @event{EVT_LIST_ITEM_FOCUSED(id, func)}
115 The currently focused item has changed.
116 @event{EVT_LIST_ITEM_MIDDLE_CLICK(id, func)}
117 The middle mouse button has been clicked on an item.
118 @event{EVT_LIST_ITEM_RIGHT_CLICK(id, func)}
119 The right mouse button has been clicked on an item.
120 @event{EVT_LIST_KEY_DOWN(id, func)}
121 A key has been pressed.
122 @event{EVT_LIST_INSERT_ITEM(id, func)}
123 An item has been inserted.
124 @event{EVT_LIST_COL_CLICK(id, func)}
125 A column (m_col) has been left-clicked.
126 @event{EVT_LIST_COL_RIGHT_CLICK(id, func)}
127 A column (m_col) has been right-clicked.
128 @event{EVT_LIST_COL_BEGIN_DRAG(id, func)}
129 The user started resizing a column - can be vetoed.
130 @event{EVT_LIST_COL_DRAGGING(id, func)}
131 The divider between columns is being dragged.
132 @event{EVT_LIST_COL_END_DRAG(id, func)}
133 A column has been resized by the user.
134 @event{EVT_LIST_CACHE_HINT(id, func)}
135 Prepare cache for a virtual list control.
136 @endEventTable
137
138
23324ae1
FM
139 @library{wxcore}
140 @category{ctrl}
0c7fe6f2 141 <!-- @appearance{listctrl.png} -->
7c913512 142
b45506e8 143 @see @ref overview_listctrl "wxListCtrl Overview", wxListView,
d23914f8 144 wxListBox, wxTreeCtrl, wxImageList, wxListEvent, wxListItem, wxEditableListBox
23324ae1
FM
145*/
146class wxListCtrl : public wxControl
147{
148public:
b45506e8 149 /**
1d7c0c08 150 Default constructor.
b45506e8
VZ
151 */
152 wxListCtrl();
153
23324ae1
FM
154 /**
155 Constructor, creating and showing a list control.
3c4f71cc 156
7c913512 157 @param parent
4cc4bfaf 158 Parent window. Must not be @NULL.
7c913512 159 @param id
4cc4bfaf 160 Window identifier. The value wxID_ANY indicates a default value.
7c913512 161 @param pos
4cc4bfaf 162 Window position.
7c913512 163 @param size
4cc4bfaf 164 Window size. If wxDefaultSize is specified then the window is
b45506e8 165 sized appropriately.
7c913512 166 @param style
4cc4bfaf 167 Window style. See wxListCtrl.
7c913512 168 @param validator
4cc4bfaf 169 Window validator.
7c913512 170 @param name
4cc4bfaf 171 Window name.
3c4f71cc 172
4cc4bfaf 173 @see Create(), wxValidator
23324ae1 174 */
7c913512
FM
175 wxListCtrl(wxWindow* parent, wxWindowID id,
176 const wxPoint& pos = wxDefaultPosition,
177 const wxSize& size = wxDefaultSize,
178 long style = wxLC_ICON,
179 const wxValidator& validator = wxDefaultValidator,
180 const wxString& name = wxListCtrlNameStr);
23324ae1
FM
181
182 /**
183 Destructor, destroying the list control.
184 */
adaaa686 185 virtual ~wxListCtrl();
23324ae1
FM
186
187 /**
188 Arranges the items in icon or small icon view. This only has effect on Win32.
4cc4bfaf 189 @a flag is one of:
3c4f71cc 190
1d7c0c08
RR
191 - wxLIST_ALIGN_DEFAULT: Default alignment.
192 - wxLIST_ALIGN_LEFT: Align to the left side of the control.
193 - wxLIST_ALIGN_TOP: Align to the top side of the control.
194 - wxLIST_ALIGN_SNAP_TO_GRID: Snap to grid.
23324ae1
FM
195 */
196 bool Arrange(int flag = wxLIST_ALIGN_DEFAULT);
197
198 /**
199 Sets the image list associated with the control and
200 takes ownership of it (i.e. the control will, unlike when using
4cc4bfaf 201 SetImageList, delete the list when destroyed). @a which is one of
23324ae1
FM
202 wxIMAGE_LIST_NORMAL, wxIMAGE_LIST_SMALL, wxIMAGE_LIST_STATE (the last is
203 unimplemented).
3c4f71cc 204
4cc4bfaf 205 @see SetImageList()
23324ae1
FM
206 */
207 void AssignImageList(wxImageList* imageList, int which);
208
209 /**
210 Deletes all items and all columns.
211 */
212 void ClearAll();
213
214 /**
215 Creates the list control. See wxListCtrl() for further details.
216 */
217 bool Create(wxWindow* parent, wxWindowID id,
218 const wxPoint& pos = wxDefaultPosition,
219 const wxSize& size = wxDefaultSize,
220 long style = wxLC_ICON,
221 const wxValidator& validator = wxDefaultValidator,
222 const wxString& name = wxListCtrlNameStr);
223
224 /**
225 Deletes all items in the list control.
1f1d2182 226 @note This function does @e not send the
23324ae1
FM
227 @c wxEVT_COMMAND_LIST_DELETE_ITEM event because deleting many items
228 from the control would be too slow then (unlike wxListCtrl::DeleteItem).
229 */
230 bool DeleteAllItems();
231
232 /**
233 Deletes a column.
234 */
235 bool DeleteColumn(int col);
236
237 /**
238 Deletes the specified item. This function sends the
239 @c wxEVT_COMMAND_LIST_DELETE_ITEM event for the item being deleted.
23324ae1
FM
240 See also: DeleteAllItems()
241 */
242 bool DeleteItem(long item);
243
244 /**
245 Starts editing the label of the given item. This function generates a
246 EVT_LIST_BEGIN_LABEL_EDIT event which can be vetoed so that no
247 text control will appear for in-place editing.
23324ae1
FM
248 If the user changed the label (i.e. s/he does not press ESC or leave
249 the text control without changes, a EVT_LIST_END_LABEL_EDIT event
250 will be sent which can be vetoed as well.
251 */
252 void EditLabel(long item);
253
254 /**
255 Ensures this item is visible.
256 */
257 bool EnsureVisible(long item);
258
23324ae1 259 /**
1d7c0c08
RR
260 Find an item nearest this position in the specified direction,
261 starting from @a start or the beginning if @a start is -1.
23324ae1
FM
262 */
263 long FindItem(long start, const wxString& str,
4cc4bfaf 264 bool partial = false);
1d7c0c08
RR
265 /**
266 Find an item nearest this position in the specified direction,
267 starting from @a start or the beginning if @a start is -1.
268 */
7c913512 269 long FindItem(long start, long data);
1d7c0c08
RR
270 /**
271 Find an item nearest this position in the specified direction,
272 starting from @a start or the beginning if @a start is -1.
273 */
7c913512 274 long FindItem(long start, const wxPoint& pt, int direction);
23324ae1
FM
275
276 /**
277 Gets information about this column. See SetItem() for more
278 information.
279 */
328f5751 280 bool GetColumn(int col, wxListItem& item) const;
23324ae1
FM
281
282 /**
283 Returns the number of columns.
284 */
328f5751 285 int GetColumnCount() const;
23324ae1
FM
286
287 /**
288 Gets the column number by visual order index (report view only).
289 */
328f5751 290 int GetColumnIndexFromOrder(int order) const;
23324ae1
FM
291
292 /**
293 Gets the column visual order index (valid in report view only).
294 */
328f5751 295 int GetColumnOrder(int col) const;
23324ae1
FM
296
297 /**
298 Gets the column width (report view only).
299 */
328f5751 300 int GetColumnWidth(int col) const;
23324ae1
FM
301
302 /**
303 Returns the array containing the orders of all columns. On error, an empty
304 array is returned.
305 */
328f5751 306 wxArrayInt GetColumnsOrder() const;
23324ae1
FM
307
308 /**
309 Gets the number of items that can fit vertically in the
310 visible area of the list control (list or report view)
311 or the total number of items in the list control (icon
312 or small icon view).
313 */
328f5751 314 int GetCountPerPage() const;
23324ae1
FM
315
316 /**
317 Returns the edit control being currently used to edit a label. Returns @NULL
318 if no label is being edited.
1f1d2182 319 @note It is currently only implemented for wxMSW and the generic version,
23324ae1
FM
320 not for the native Mac OS X version.
321 */
328f5751 322 wxTextCtrl* GetEditControl() const;
23324ae1
FM
323
324 /**
4cc4bfaf 325 Returns the specified image list. @a which may be one of:
3c4f71cc 326
1d7c0c08
RR
327 - wxIMAGE_LIST_NORMAL: The normal (large icon) image list.
328 - wxIMAGE_LIST_SMALL: The small icon image list.
329 - wxIMAGE_LIST_STATE: The user-defined state image list (unimplemented).
23324ae1 330 */
328f5751 331 wxImageList* GetImageList(int which) const;
23324ae1
FM
332
333 /**
334 Gets information about the item. See SetItem() for more
335 information.
23324ae1
FM
336 You must call @e info.SetId() to the ID of item you're interested in
337 before calling this method.
338 */
328f5751 339 bool GetItem(wxListItem& info) const;
23324ae1
FM
340
341 /**
342 Returns the colour for this item. If the item has no specific colour, returns
343 an invalid colour (and not the default background control of the control
344 itself).
3c4f71cc 345
4cc4bfaf 346 @see GetItemTextColour()
23324ae1 347 */
328f5751 348 wxColour GetItemBackgroundColour(long item) const;
23324ae1
FM
349
350 /**
351 Returns the number of items in the list control.
352 */
328f5751 353 int GetItemCount() const;
23324ae1
FM
354
355 /**
356 Gets the application-defined data associated with this item.
357 */
328f5751 358 long GetItemData(long item) const;
23324ae1
FM
359
360 /**
361 Returns the item's font.
362 */
328f5751 363 wxFont GetItemFont(long item) const;
23324ae1
FM
364
365 /**
366 Returns the position of the item, in icon or small icon view.
367 */
328f5751 368 bool GetItemPosition(long item, wxPoint& pos) const;
23324ae1
FM
369
370 /**
371 Returns the rectangle representing the item's size and position, in physical
372 coordinates.
4cc4bfaf 373 @a code is one of wxLIST_RECT_BOUNDS, wxLIST_RECT_ICON, wxLIST_RECT_LABEL.
23324ae1
FM
374 */
375 bool GetItemRect(long item, wxRect& rect,
328f5751 376 int code = wxLIST_RECT_BOUNDS) const;
23324ae1
FM
377
378 /**
379 Retrieves the spacing between icons in pixels: horizontal spacing is returned
380 as @c x component of the wxSize object and the vertical
381 spacing as its @c y component.
382 */
328f5751 383 wxSize GetItemSpacing() const;
23324ae1
FM
384
385 /**
386 Gets the item state. For a list of state flags, see SetItem().
23324ae1
FM
387 The @b stateMask indicates which state flags are of interest.
388 */
328f5751 389 int GetItemState(long item, long stateMask) const;
23324ae1
FM
390
391 /**
392 Gets the item text for this item.
393 */
328f5751 394 wxString GetItemText(long item) const;
23324ae1
FM
395
396 /**
397 Returns the colour for this item. If the item has no specific colour, returns
398 an invalid colour (and not the default foreground control of the control itself
399 as this wouldn't allow distinguishing between items having the same colour as
400 the current control foreground and items with default colour which, hence, have
401 always the same colour as the control).
402 */
328f5751 403 wxColour GetItemTextColour(long item) const;
23324ae1
FM
404
405 /**
406 Searches for an item with the given geometry or state, starting from
4cc4bfaf 407 @a item but excluding the @a item itself. If @a item is -1,
23324ae1 408 the first item that matches the specified flags will be returned.
4cc4bfaf 409 Returns the first item with given state following @a item or -1 if
23324ae1 410 no such item found.
23324ae1 411 This function may be used to find all selected items in the control like this:
3c4f71cc 412
4cc4bfaf 413 @a geometry can be one of:
3c4f71cc 414
23324ae1 415 wxLIST_NEXT_ABOVE
3c4f71cc 416
23324ae1 417 Searches for an item above the specified item.
3c4f71cc 418
23324ae1 419 wxLIST_NEXT_ALL
3c4f71cc 420
23324ae1 421 Searches for subsequent item by index.
3c4f71cc 422
23324ae1 423 wxLIST_NEXT_BELOW
3c4f71cc 424
23324ae1 425 Searches for an item below the specified item.
3c4f71cc 426
23324ae1 427 wxLIST_NEXT_LEFT
3c4f71cc 428
23324ae1 429 Searches for an item to the left of the specified item.
3c4f71cc 430
23324ae1 431 wxLIST_NEXT_RIGHT
3c4f71cc 432
23324ae1 433 Searches for an item to the right of the specified item.
3c4f71cc 434
1f1d2182 435 @note this parameter is only supported by wxMSW currently and ignored on
23324ae1 436 other platforms.
4cc4bfaf 437 @a state can be a bitlist of the following:
3c4f71cc 438
23324ae1 439 wxLIST_STATE_DONTCARE
3c4f71cc 440
23324ae1 441 Don't care what the state is.
3c4f71cc 442
23324ae1 443 wxLIST_STATE_DROPHILITED
3c4f71cc 444
23324ae1 445 The item indicates it is a drop target.
3c4f71cc 446
23324ae1 447 wxLIST_STATE_FOCUSED
3c4f71cc 448
23324ae1 449 The item has the focus.
3c4f71cc 450
23324ae1 451 wxLIST_STATE_SELECTED
3c4f71cc 452
23324ae1 453 The item is selected.
3c4f71cc 454
23324ae1 455 wxLIST_STATE_CUT
3c4f71cc 456
23324ae1
FM
457 The item is selected as part of a cut and paste operation.
458 */
459 long GetNextItem(long item, int geometry = wxLIST_NEXT_ALL,
328f5751 460 int state = wxLIST_STATE_DONTCARE) const;
23324ae1
FM
461
462 /**
463 Returns the number of selected items in the list control.
464 */
328f5751 465 int GetSelectedItemCount() const;
23324ae1
FM
466
467 /**
468 Returns the rectangle representing the size and position, in physical
4cc4bfaf 469 coordinates, of the given subitem, i.e. the part of the row @a item in the
23324ae1 470 column @e subItem.
23324ae1 471 This method is only meaningfull when the wxListCtrl is in the report mode. If
4cc4bfaf 472 @a subItem parameter is equal to the special value
23324ae1
FM
473 @c wxLIST_GETSUBITEMRECT_WHOLEITEM the return value is the same as
474 for GetItemRect().
4cc4bfaf 475 @a code can be one of @c wxLIST_RECT_BOUNDS,
23324ae1 476 @c wxLIST_RECT_ICON or @c wxLIST_RECT_LABEL.
3c4f71cc 477
1e24c2af 478 @since 2.7.0
23324ae1
FM
479 */
480 bool GetSubItemRect(long item, long subItem, wxRect& rect,
328f5751 481 int code = wxLIST_RECT_BOUNDS) const;
23324ae1
FM
482
483 /**
484 Gets the text colour of the list control.
485 */
328f5751 486 wxColour GetTextColour() const;
23324ae1
FM
487
488 /**
489 Gets the index of the topmost visible item when in
490 list or report view.
491 */
328f5751 492 long GetTopItem() const;
23324ae1
FM
493
494 /**
495 Returns the rectangle taken by all items in the control. In other words, if the
496 controls client size were equal to the size of this rectangle, no scrollbars
497 would be needed and no free space would be left.
23324ae1
FM
498 Note that this function only works in the icon and small icon views, not in
499 list or report views (this is a limitation of the native Win32 control).
500 */
328f5751 501 wxRect GetViewRect() const;
23324ae1
FM
502
503 /**
504 Determines which item (if any) is at the specified point,
505 giving details in @e flags. Returns index of the item or @c wxNOT_FOUND
506 if no item is at the specified point.
4cc4bfaf 507 @a flags will be a combination of the following flags:
3c4f71cc 508
23324ae1 509 wxLIST_HITTEST_ABOVE
3c4f71cc 510
23324ae1 511 Above the client area.
3c4f71cc 512
23324ae1 513 wxLIST_HITTEST_BELOW
3c4f71cc 514
23324ae1 515 Below the client area.
3c4f71cc 516
23324ae1 517 wxLIST_HITTEST_NOWHERE
3c4f71cc 518
23324ae1 519 In the client area but below the last item.
3c4f71cc 520
23324ae1 521 wxLIST_HITTEST_ONITEMICON
3c4f71cc 522
23324ae1 523 On the bitmap associated with an item.
3c4f71cc 524
23324ae1 525 wxLIST_HITTEST_ONITEMLABEL
3c4f71cc 526
23324ae1 527 On the label (string) associated with an item.
3c4f71cc 528
23324ae1 529 wxLIST_HITTEST_ONITEMRIGHT
3c4f71cc 530
23324ae1 531 In the area to the right of an item.
3c4f71cc 532
23324ae1 533 wxLIST_HITTEST_ONITEMSTATEICON
3c4f71cc 534
23324ae1 535 On the state icon for a tree view item that is in a user-defined state.
3c4f71cc 536
23324ae1 537 wxLIST_HITTEST_TOLEFT
3c4f71cc 538
23324ae1 539 To the right of the client area.
3c4f71cc 540
23324ae1 541 wxLIST_HITTEST_TORIGHT
3c4f71cc 542
23324ae1 543 To the left of the client area.
3c4f71cc 544
23324ae1 545 wxLIST_HITTEST_ONITEM
3c4f71cc 546
23324ae1
FM
547 Combination of wxLIST_HITTEST_ONITEMICON, wxLIST_HITTEST_ONITEMLABEL,
548 wxLIST_HITTEST_ONITEMSTATEICON.
3c4f71cc 549
4cc4bfaf 550 If @a ptrSubItem is not @NULL and the wxListCtrl is in the report
7c913512 551 mode the subitem (or column) number will also be provided.
23324ae1
FM
552 This feature is only available in version 2.7.0 or higher and is currently only
553 implemented under wxMSW and requires at least comctl32.dll of verion 4.70 on
4cc4bfaf 554 the host system or the value stored in @a ptrSubItem will be always -1. To
23324ae1
FM
555 compile this feature into wxWidgets library you need to have access to
556 commctrl.h of version 4.70 that is provided by Microsoft.
557 */
558 long HitTest(const wxPoint& point, int& flags,
328f5751 559 long* ptrSubItem) const;
23324ae1 560
23324ae1
FM
561 /**
562 For report view mode (only), inserts a column. For more details, see SetItem().
563 */
564 long InsertColumn(long col, wxListItem& info);
1d7c0c08
RR
565 /**
566 For report view mode (only), inserts a column. For more details, see SetItem().
567 */
7c913512
FM
568 long InsertColumn(long col, const wxString& heading,
569 int format = wxLIST_FORMAT_LEFT,
570 int width = -1);
23324ae1 571
23324ae1 572 /**
b45506e8 573 Insert a wxListItem.
7c913512 574 @param info
4cc4bfaf 575 wxListItem object
b45506e8
VZ
576 */
577 long InsertItem(wxListItem& info);
578
579 /**
580 Insert an string item.
7c913512 581 @param index
4cc4bfaf 582 Index of the new item, supplied by the application
7c913512 583 @param label
4cc4bfaf 584 String label
23324ae1 585 */
7c913512 586 long InsertItem(long index, const wxString& label);
b45506e8
VZ
587
588 /**
589 Insert an image item.
590 @param index
591 Index of the new item, supplied by the application
592 @param imageIndex
593 Index into the image list associated with this control and view style
594 */
7c913512 595 long InsertItem(long index, int imageIndex);
b45506e8
VZ
596
597 /**
598 Insert an image/string item.
599 @param index
600 Index of the new item, supplied by the application
601 @param label
602 String label
603 @param imageIndex
604 Index into the image list associated with this control and view style
605 */
7c913512
FM
606 long InsertItem(long index, const wxString& label,
607 int imageIndex);
23324ae1
FM
608
609 /**
610 This function may be overloaded in the derived class for a control with
611 @c wxLC_VIRTUAL style. It should return the attribute for the
612 for the specified @c item or @NULL to use the default appearance
613 parameters.
7c913512 614 wxListCtrl will not delete the pointer or keep a reference of it. You can
23324ae1 615 return the same wxListItemAttr pointer for every OnGetItemAttr call.
23324ae1 616 The base class version always returns @NULL.
3c4f71cc 617
4cc4bfaf
FM
618 @see OnGetItemImage(), OnGetItemColumnImage(),
619 OnGetItemText()
23324ae1 620 */
328f5751 621 virtual wxListItemAttr* OnGetItemAttr(long item) const;
23324ae1
FM
622
623 /**
624 Overload this function in the derived class for a control with
625 @c wxLC_VIRTUAL and @c wxLC_REPORT styles in order to specify the image
626 index for the given line and column.
23324ae1
FM
627 The base class version always calls OnGetItemImage for the first column, else
628 it returns -1.
3c4f71cc 629
4cc4bfaf
FM
630 @see OnGetItemText(), OnGetItemImage(),
631 OnGetItemAttr()
23324ae1 632 */
328f5751 633 virtual int OnGetItemColumnImage(long item, long column) const;
23324ae1
FM
634
635 /**
636 This function must be overloaded in the derived class for a control with
b45506e8 637 @c wxLC_VIRTUAL style having an @ref SetImageList() "image list"
23324ae1
FM
638 (if the control doesn't have an image list, it is not necessary to overload
639 it). It should return the index of the items image in the controls image list
640 or -1 for no image.
641 In a control with @c wxLC_REPORT style, OnGetItemImage only gets called for
642 the first column of each line.
23324ae1 643 The base class version always returns -1.
3c4f71cc 644
4cc4bfaf
FM
645 @see OnGetItemText(), OnGetItemColumnImage(),
646 OnGetItemAttr()
23324ae1 647 */
328f5751 648 virtual int OnGetItemImage(long item) const;
23324ae1
FM
649
650 /**
651 This function @b must be overloaded in the derived class for a control with
652 @c wxLC_VIRTUAL style. It should return the string containing the text of
4cc4bfaf 653 the given @a column for the specified @c item.
3c4f71cc 654
4cc4bfaf
FM
655 @see SetItemCount(), OnGetItemImage(),
656 OnGetItemColumnImage(), OnGetItemAttr()
23324ae1 657 */
328f5751 658 virtual wxString OnGetItemText(long item, long column) const;
23324ae1
FM
659
660 /**
661 Redraws the given @e item. This is only useful for the virtual list controls
662 as without calling this function the displayed value of the item doesn't change
663 even when the underlying data does change.
3c4f71cc 664
4cc4bfaf 665 @see RefreshItems()
23324ae1
FM
666 */
667 void RefreshItem(long item);
668
669 /**
4cc4bfaf 670 Redraws the items between @a itemFrom and @e itemTo. The starting item
23324ae1 671 must be less than or equal to the ending one.
23324ae1
FM
672 Just as RefreshItem() this is only useful for
673 virtual list controls.
674 */
675 void RefreshItems(long itemFrom, long itemTo);
676
677 /**
678 Scrolls the list control. If in icon, small icon or report view mode,
4cc4bfaf
FM
679 @a dx specifies the number of pixels to scroll. If in list view mode,
680 @a dx specifies the number of columns to scroll. @a dy always specifies
23324ae1 681 the number of pixels to scroll vertically.
1f1d2182 682 @note This method is currently only implemented in the Windows version.
23324ae1
FM
683 */
684 bool ScrollList(int dx, int dy);
685
686 /**
687 Sets the background colour (GetBackgroundColour already implicit in
688 wxWindow class).
689 */
690 void SetBackgroundColour(const wxColour& col);
691
692 /**
693 Sets information about this column. See SetItem() for more
694 information.
695 */
696 bool SetColumn(int col, wxListItem& item);
697
698 /**
699 Sets the column width.
4cc4bfaf 700 @a width can be a width in pixels or wxLIST_AUTOSIZE (-1) or
23324ae1
FM
701 wxLIST_AUTOSIZE_USEHEADER (-2).
702 wxLIST_AUTOSIZE will resize the column to the length of its longest item.
703 wxLIST_AUTOSIZE_USEHEADER
704 will resize the column to the length of the header (Win32) or 80 pixels (other
705 platforms).
4cc4bfaf 706 In small or normal icon view, @a col must be -1, and the column width is set
23324ae1
FM
707 for all columns.
708 */
709 bool SetColumnWidth(int col, int width);
710
711 /**
4cc4bfaf 712 Sets the order of all columns at once. The @a orders array must have the
23324ae1
FM
713 same number elements as the number of columns and contain each position exactly
714 once.
23324ae1
FM
715 This function is valid in report view only.
716 */
328f5751 717 bool SetColumnOrder(const wxArrayInt& orders) const;
23324ae1
FM
718
719 /**
4cc4bfaf 720 Sets the image list associated with the control. @a which is one of
23324ae1
FM
721 wxIMAGE_LIST_NORMAL, wxIMAGE_LIST_SMALL, wxIMAGE_LIST_STATE (the last is
722 unimplemented).
23324ae1
FM
723 This method does not take ownership of the image list, you have to
724 delete it yourself.
3c4f71cc 725
4cc4bfaf 726 @see AssignImageList()
23324ae1
FM
727 */
728 void SetImageList(wxImageList* imageList, int which);
729
23324ae1 730 /**
1d7c0c08
RR
731 Sets the data of an item.
732
733 wxListItem is a class with the following members
734
735 - long m_mask: Indicates which fields are valid. See below.
736 - long m_itemId: Zero based item position.
737 - int m_col: Zero based column index.
738 - long m_state: The state of the item: See below for valid state flags.
739 - long m_stateMask: A mask indicating which state flags are valid. See below.
740 - wxStrign m_text: the label (or header for columns)
741 - int m_image: The zero based index into an image list
742 - long m_data: Application defined data
743 - int m_format: For columns only: Either of wxLIST_FORMAT_LEFT, wxLIST_FORMAT_RIGHT, wxLIST_FORMAT_CENTRE
744 - int m_width: For columns only: the width of the column
745
746 The @b m_mask member contains a bitlist specifying which of the other fields
747 are valid. The flags are:
748 - wxLIST_MASK_STATE: The m_state field is valid.
749 - wxLIST_MASK_TEXT: The m_text field is valid.
750 - wxLIST_MASK_IMAGE: The m_image field is valid.
751 - wxLIST_MASK_DATA: The m_data field is valid.
752 - wxLIST_MASK_WIDTH: The m_width field is valid.
753 - wxLIST_MASK_FORMAT: The m_format field is valid.
754
755 The @b m_stateMask and @b m_state members take flags from the following:
756
757 - wxLIST_STATE_DONTCARE: Don't care what the state is. Win32 only.
758 - wxLIST_STATE_DROPHILITED: The item is highlighted to receive a drop event. Win32 only.
759 - wxLIST_STATE_FOCUSED: The item has the focus.
760 - wxLIST_STATE_SELECTED: The item is selected.
761 - wxLIST_STATE_CUT: The item is in the cut state. Win32 only.
762
763 The wxListItem object can also contain item-specific colour and font
764 information: for this you need to call one of SetTextColour(),
765 SetBackgroundColour() or SetFont() functions on it passing it the colour/font
766 to use. If the colour/font is not specified, the default list control
767 colour/font is used.
23324ae1
FM
768 */
769 bool SetItem(wxListItem& info);
1d7c0c08
RR
770
771 /**
772 Sets a string field at a particular column.
773 */
b45506e8 774 long SetItem(long index, int col, const wxString& label,
7c913512 775 int imageId = -1);
23324ae1
FM
776
777 /**
1d7c0c08
RR
778 Sets the background colour for this item. This function only works
779 in report view. The colour can be retrieved using GetItemBackgroundColour().
23324ae1
FM
780 */
781 void SetItemBackgroundColour(long item, const wxColour& col);
782
783 /**
1d7c0c08
RR
784 Sets the image associated with the item. In report view, you can
785 specify the column. The image is an index into the image list
786 associated with the list control.
23324ae1
FM
787 */
788 bool SetItemColumnImage(long item, long column, int image);
789
790 /**
558a6e06
VZ
791 This method can only be used with virtual list controls.
792
793 It is used to indicate to the control the number of items it contains.
794 After calling it, the main program should be ready to handle calls to
795 various item callbacks (such as wxListCtrl::OnGetItemText) for all
796 items in the range from 0 to @a count.
797
798 Notice that the control is not necessarily redrawn after this call as
799 it may be undesirable if an item which is not visible on the screen
800 anyhow was added to or removed from a control displaying many items, if
801 you do need to refresh the display you can just call Refresh() manually.
23324ae1
FM
802 */
803 void SetItemCount(long count);
804
805 /**
7c913512 806 Associates application-defined data with this item.
7c913512
FM
807 Notice that this function cannot be used to associate pointers with the control
808 items, use SetItemPtrData() instead.
23324ae1
FM
809 */
810 bool SetItemData(long item, long data);
811
812 /**
1d7c0c08 813 Sets the item's font.
23324ae1
FM
814 */
815 void SetItemFont(long item, const wxFont& font);
816
23324ae1 817 /**
1d7c0c08
RR
818 Sets the unselected and selected images associated with the item. The
819 images are indices into the image list associated with the list control.
23324ae1
FM
820 */
821 bool SetItemImage(long item, int image);
1d7c0c08
RR
822
823 /**
824 Sets the unselected and selected images associated with the item. The
825 images are indices into the image list associated with the list control.
826 This form is deprecated: @a selImage is not used.
827 */
7c913512 828 bool SetItemImage(long item, int image, int selImage);
23324ae1
FM
829
830 /**
831 Sets the position of the item, in icon or small icon view. Windows only.
832 */
833 bool SetItemPosition(long item, const wxPoint& pos);
834
835 /**
4cc4bfaf 836 Associates application-defined data with this item. The @a data parameter may
23324ae1
FM
837 be either an integer or a pointer cast to the @c wxUIntPtr type which is
838 guaranteed to be large enough to be able to contain all integer types and
839 pointers.
3c4f71cc 840
1e24c2af 841 @since 2.8.4
23324ae1
FM
842 */
843 bool SetItemPtrData(long item, wxUIntPtr data);
844
845 /**
846 Sets the item state. For a list of state flags, see SetItem().
23324ae1
FM
847 The @b stateMask indicates which state flags are valid.
848 */
849 bool SetItemState(long item, long state, long stateMask);
850
851 /**
852 Sets the item text for this item.
853 */
854 void SetItemText(long item, const wxString& text);
855
856 /**
857 Sets the colour for this item. This function only works in report view.
23324ae1
FM
858 The colour can be retrieved using
859 GetItemTextColour().
860 */
861 void SetItemTextColour(long item, const wxColour& col);
862
863 /**
864 Adds or removes a single window style.
865 */
4cc4bfaf 866 void SetSingleStyle(long style, bool add = true);
23324ae1
FM
867
868 /**
869 Sets the text colour of the list control.
870 */
871 void SetTextColour(const wxColour& col);
872
873 /**
874 Sets the whole window style, deleting all items.
875 */
876 void SetWindowStyleFlag(long style);
877
878 /**
879 Call this function to sort the items in the list control. Sorting is done
4cc4bfaf 880 using the specified @a fnSortCallBack function. This function must have the
23324ae1 881 following prototype:
3c4f71cc 882
23324ae1
FM
883 It is called each time when the two items must be compared and should return 0
884 if the items are equal, negative value if the first item is less than the
885 second one and positive value if the first one is greater than the second one
886 (the same convention as used by @c qsort(3)).
3c4f71cc 887
7c913512 888 @param item1
4cc4bfaf 889 client data associated with the first item (NOT the index).
7c913512 890 @param item2
4cc4bfaf 891 client data associated with the second item (NOT the index).
7c913512 892 @param data
4cc4bfaf 893 the value passed to SortItems() itself.
23324ae1
FM
894 */
895 bool SortItems(wxListCtrlCompare fnSortCallBack, long data);
896};
897
898
e54c96f1 899
23324ae1
FM
900/**
901 @class wxListEvent
7c913512 902
23324ae1 903 A list event holds information about events associated with wxListCtrl objects.
7c913512 904
23324ae1
FM
905 @library{wxbase}
906 @category{events}
7c913512 907
e54c96f1 908 @see wxListCtrl
23324ae1
FM
909*/
910class wxListEvent : public wxNotifyEvent
911{
912public:
913 /**
914 Constructor.
915 */
1d497b99 916 wxListEvent(wxEventType commandType = 0, int id = 0);
23324ae1
FM
917
918 /**
919 For @c EVT_LIST_CACHE_HINT event only: return the first item which the
920 list control advises us to cache.
921 */
328f5751 922 long GetCacheFrom() const;
23324ae1
FM
923
924 /**
925 For @c EVT_LIST_CACHE_HINT event only: return the last item (inclusive)
926 which the list control advises us to cache.
927 */
328f5751 928 long GetCacheTo() const;
23324ae1
FM
929
930 /**
931 The column position: it is only used with @c COL events. For the column
932 dragging events, it is the column to the left of the divider being dragged, for
933 the column click events it may be -1 if the user clicked in the list control
934 header outside any column.
935 */
328f5751 936 int GetColumn() const;
23324ae1
FM
937
938 /**
939 The data.
940 */
328f5751 941 long GetData() const;
23324ae1
FM
942
943 /**
944 The image.
945 */
328f5751 946 int GetImage() const;
23324ae1
FM
947
948 /**
949 The item index.
950 */
328f5751 951 long GetIndex() const;
23324ae1
FM
952
953 /**
954 An item object, used by some events. See also wxListCtrl::SetItem.
955 */
328f5751 956 const wxListItem GetItem() const;
23324ae1
FM
957
958 /**
959 Key code if the event is a keypress event.
960 */
328f5751 961 int GetKeyCode() const;
23324ae1
FM
962
963 /**
964 The (new) item label for @c EVT_LIST_END_LABEL_EDIT event.
965 */
328f5751 966 const wxString GetLabel() const;
23324ae1
FM
967
968 /**
969 The mask.
970 */
328f5751 971 long GetMask() const;
23324ae1
FM
972
973 /**
974 The position of the mouse pointer if the event is a drag event.
975 */
328f5751 976 wxPoint GetPoint() const;
23324ae1
FM
977
978 /**
979 The text.
980 */
328f5751 981 const wxString GetText() const;
23324ae1
FM
982
983 /**
984 This method only makes sense for @c EVT_LIST_END_LABEL_EDIT message
985 and returns @true if it the label editing has been cancelled by the user
986 (GetLabel() returns an empty string in this case
987 but it doesn't allow the application to distinguish between really cancelling
988 the edit and
989 the admittedly rare case when the user wants to rename it to an empty string).
990 */
328f5751 991 bool IsEditCancelled() const;
23324ae1
FM
992};
993
994
e54c96f1 995
23324ae1
FM
996/**
997 @class wxListItemAttr
7c913512 998
23324ae1
FM
999 Represents the attributes (color, font, ...) of a
1000 wxListCtrl wxListItem.
7c913512 1001
23324ae1
FM
1002 @library{wxbase}
1003 @category{FIXME}
7c913512 1004
b45506e8 1005 @see @ref overview_listctrl "wxListCtrl Overview", wxListCtrl,
e54c96f1 1006 wxListItem
23324ae1 1007*/
7c913512 1008class wxListItemAttr
23324ae1
FM
1009{
1010public:
1d7c0c08
RR
1011 /**
1012 Default Constructor.
1013 */
1014 wxListItemAttr();
23324ae1
FM
1015 /**
1016 Construct a wxListItemAttr with the specified foreground and
1017 background colors and font.
1018 */
7c913512
FM
1019 wxListItemAttr(const wxColour colText,
1020 const wxColour colBack,
1021 const wxFont font);
23324ae1
FM
1022
1023 /**
1024 Returns the currently set background color.
1025 */
328f5751 1026 const wxColour GetBackgroundColour() const;
23324ae1
FM
1027
1028 /**
1029 Returns the currently set font.
1030 */
328f5751 1031 const wxFont GetFont() const;
23324ae1
FM
1032
1033 /**
1034 Returns the currently set text color.
1035 */
328f5751 1036 const wxColour GetTextColour() const;
23324ae1
FM
1037
1038 /**
1039 Returns @true if the currently set background color is valid.
1040 */
328f5751 1041 bool HasBackgroundColour() const;
23324ae1
FM
1042
1043 /**
1044 Returns @true if the currently set font is valid.
1045 */
328f5751 1046 bool HasFont() const;
23324ae1
FM
1047
1048 /**
1049 Returns @true if the currently set text color is valid.
1050 */
328f5751 1051 bool HasTextColour() const;
23324ae1
FM
1052
1053 /**
1054 Sets a new background color.
1055 */
1056 void SetBackgroundColour(const wxColour& colour);
1057
1058 /**
1059 Sets a new font.
1060 */
1061 void SetFont(const wxFont& font);
1062
1063 /**
1064 Sets a new text color.
1065 */
1066 void SetTextColour(const wxColour& colour);
1067};
1068
1069
e54c96f1 1070
23324ae1
FM
1071/**
1072 @class wxListView
7c913512
FM
1073
1074 This class currently simply presents a simpler to use interface for the
23324ae1 1075 wxListCtrl -- it can be thought of as a @e faade
7c913512 1076 for that complicated class. Using it is preferable to using
23324ae1
FM
1077 wxListCtrl directly whenever possible because in the
1078 future some ports might implement wxListView but not the full set of wxListCtrl
1079 features.
7c913512 1080
23324ae1
FM
1081 Other than different interface, this class is identical to wxListCtrl. In
1082 particular, it uses the same events, same window styles and so on.
7c913512 1083
23324ae1
FM
1084 @library{wxcore}
1085 @category{ctrl}
0c7fe6f2 1086 <!-- @appearance{listview.png} -->
7c913512 1087
e54c96f1 1088 @see wxListView::SetColumnImage
23324ae1
FM
1089*/
1090class wxListView : public wxListCtrl
1091{
1092public:
1093 /**
1094 Resets the column image -- after calling this function, no image will be shown.
3c4f71cc 1095
7c913512 1096 @param col
4cc4bfaf 1097 the column to clear image for
3c4f71cc 1098
4cc4bfaf 1099 @see SetColumnImage()
23324ae1
FM
1100 */
1101 void ClearColumnImage(int col);
1102
1103 /**
1104 Sets focus to the item with the given @e index.
1105 */
1106 void Focus(long index);
1107
1108 /**
1109 Returns the first selected item in a (presumably) multiple selection control.
1110 Together with GetNextSelected() it can be
1111 used to iterate over all selected items in the control.
3c4f71cc 1112
d29a9a8a 1113 @return The first selected item, if any, -1 otherwise.
23324ae1 1114 */
328f5751 1115 long GetFirstSelected() const;
23324ae1
FM
1116
1117 /**
1118 Returns the currently focused item or -1 if none.
3c4f71cc 1119
4cc4bfaf 1120 @see IsSelected(), Focus()
23324ae1 1121 */
328f5751 1122 long GetFocusedItem() const;
23324ae1
FM
1123
1124 /**
1125 Used together with GetFirstSelected() to
1126 iterate over all selected items in the control.
3c4f71cc 1127
d29a9a8a 1128 @return Returns the next selected item or -1 if there are no more of
4cc4bfaf 1129 them.
23324ae1 1130 */
328f5751 1131 long GetNextSelected(long item) const;
23324ae1
FM
1132
1133 /**
4cc4bfaf 1134 Returns @true if the item with the given @a index is selected,
23324ae1 1135 @false otherwise.
3c4f71cc 1136
4cc4bfaf 1137 @see GetFirstSelected(), GetNextSelected()
23324ae1 1138 */
328f5751 1139 bool IsSelected(long index) const;
23324ae1
FM
1140
1141 /**
1142 Selects or unselects the given item.
3c4f71cc 1143
7c913512 1144 @param n
4cc4bfaf 1145 the item to select or unselect
7c913512 1146 @param on
4cc4bfaf 1147 if @true (default), selects the item, otherwise unselects it
3c4f71cc 1148
4cc4bfaf 1149 @see wxListCtrl::SetItemState
23324ae1 1150 */
792255cc 1151 void Select(long n, bool on = true);
23324ae1
FM
1152
1153 /**
1154 Sets the column image for the specified column. To use the column images, the
1155 control must have a valid image list with at least one image.
3c4f71cc 1156
7c913512 1157 @param col
4cc4bfaf 1158 the column to set image for
7c913512 1159 @param image
4cc4bfaf 1160 the index of the column image in the controls image list
23324ae1
FM
1161 */
1162 void SetColumnImage(int col, int image);
1163};
1164
1165
e54c96f1 1166
23324ae1
FM
1167/**
1168 @class wxListItem
7c913512 1169
23324ae1 1170 This class stores information about a wxListCtrl item or column.
7c913512 1171
23324ae1
FM
1172 @library{wxbase}
1173 @category{FIXME}
1174*/
1175class wxListItem : public wxObject
1176{
1177public:
1178 /**
1179 Constructor.
1180 */
1181 wxListItem();
1182
1183 /**
1184 Resets the item state to the default.
1185 */
1186 void Clear();
1187
1188 /**
1189 Returns the alignment for this item. Can be one of
1190 wxLIST_FORMAT_LEFT, wxLIST_FORMAT_RIGHT or wxLIST_FORMAT_CENTRE.
1191 */
328f5751 1192 wxListColumnFormat GetAlign() const;
23324ae1
FM
1193
1194 /**
1195 Returns the background colour for this item.
1196 */
328f5751 1197 wxColour GetBackgroundColour() const;
23324ae1
FM
1198
1199 /**
1200 Returns the zero-based column; meaningful only in report mode.
1201 */
328f5751 1202 int GetColumn() const;
23324ae1
FM
1203
1204 /**
1205 Returns client data associated with the control. Please note that
1206 client data is associated with the item and not with subitems.
1207 */
328f5751 1208 long GetData() const;
23324ae1
FM
1209
1210 /**
1211 Returns the font used to display the item.
1212 */
328f5751 1213 wxFont GetFont() const;
23324ae1
FM
1214
1215 /**
1216 Returns the zero-based item position.
1217 */
328f5751 1218 long GetId() const;
23324ae1
FM
1219
1220 /**
1221 Returns the zero-based index of the image
1222 associated with the item into the image list.
1223 */
328f5751 1224 int GetImage() const;
23324ae1
FM
1225
1226 /**
1227 Returns a bit mask indicating which fields of the structure are valid;
1228 can be any combination of the following values:
3c4f71cc 1229
23324ae1 1230 wxLIST_MASK_STATE
3c4f71cc 1231
23324ae1 1232 @b GetState is valid.
3c4f71cc 1233
23324ae1 1234 wxLIST_MASK_TEXT
3c4f71cc 1235
23324ae1 1236 @b GetText is valid.
3c4f71cc 1237
23324ae1 1238 wxLIST_MASK_IMAGE
3c4f71cc 1239
23324ae1 1240 @b GetImage is valid.
3c4f71cc 1241
23324ae1 1242 wxLIST_MASK_DATA
3c4f71cc 1243
23324ae1 1244 @b GetData is valid.
3c4f71cc 1245
23324ae1 1246 wxLIST_MASK_WIDTH
3c4f71cc 1247
23324ae1 1248 @b GetWidth is valid.
3c4f71cc 1249
23324ae1 1250 wxLIST_MASK_FORMAT
3c4f71cc 1251
23324ae1
FM
1252 @b GetFormat is valid.
1253 */
328f5751 1254 long GetMask() const;
23324ae1
FM
1255
1256 /**
1257 Returns a bit field representing the state of the item. Can be any
1258 combination of:
3c4f71cc 1259
23324ae1 1260 wxLIST_STATE_DONTCARE
3c4f71cc 1261
7c913512 1262 Don't care what the state is. Win32 only.
3c4f71cc 1263
23324ae1 1264 wxLIST_STATE_DROPHILITED
3c4f71cc 1265
7c913512 1266 The item is highlighted to receive a drop event. Win32 only.
3c4f71cc 1267
23324ae1 1268 wxLIST_STATE_FOCUSED
3c4f71cc 1269
23324ae1 1270 The item has the focus.
3c4f71cc 1271
23324ae1 1272 wxLIST_STATE_SELECTED
3c4f71cc 1273
23324ae1 1274 The item is selected.
3c4f71cc 1275
23324ae1 1276 wxLIST_STATE_CUT
3c4f71cc 1277
23324ae1
FM
1278 The item is in the cut state. Win32 only.
1279 */
328f5751 1280 long GetState() const;
23324ae1
FM
1281
1282 /**
1283 Returns the label/header text.
1284 */
328f5751 1285 const wxString GetText() const;
23324ae1
FM
1286
1287 /**
1288 Returns the text colour.
1289 */
328f5751 1290 wxColour GetTextColour() const;
23324ae1
FM
1291
1292 /**
1293 Meaningful only for column headers in report mode. Returns the column width.
1294 */
328f5751 1295 int GetWidth() const;
23324ae1
FM
1296
1297 /**
1298 Sets the alignment for the item. See also
1299 GetAlign()
1300 */
1301 void SetAlign(wxListColumnFormat align);
1302
1303 /**
1304 Sets the background colour for the item.
1305 */
1306 void SetBackgroundColour(const wxColour& colBack);
1307
1308 /**
1309 Sets the zero-based column. Meaningful only in report mode.
1310 */
1311 void SetColumn(int col);
1312
1313 //@{
1314 /**
1315 Sets client data for the item. Please note that
1316 client data is associated with the item and not with subitems.
1317 */
1318 void SetData(long data);
7c913512 1319 void SetData(void* data);
23324ae1
FM
1320 //@}
1321
1322 /**
1323 Sets the font for the item.
1324 */
1325 void SetFont(const wxFont& font);
1326
1327 /**
1328 Sets the zero-based item position.
1329 */
1330 void SetId(long id);
1331
1332 /**
1333 Sets the zero-based index of the image associated with the item
1334 into the image list.
1335 */
1336 void SetImage(int image);
1337
1338 /**
1339 Sets the mask of valid fields. See GetMask().
1340 */
1341 void SetMask(long mask);
1342
1343 /**
1344 Sets the item state flags (note that the valid state flags are influenced
1345 by the value of the state mask, see
1346 wxListItem::SetStateMask).
1347 See GetState() for valid flag
1348 values.
1349 */
1350 void SetState(long state);
1351
1352 /**
1353 Sets the bitmask that is used to determine which of the state flags
1354 are to be set. See also SetState().
1355 */
1356 void SetStateMask(long stateMask);
1357
1358 /**
1359 Sets the text label for the item.
1360 */
1361 void SetText(const wxString& text);
1362
1363 /**
1364 Sets the text colour for the item.
1365 */
1366 void SetTextColour(const wxColour& colText);
1367
1368 /**
1369 Meaningful only for column headers in report mode. Sets the column width.
1370 */
1371 void SetWidth(int width);
1372};
e54c96f1 1373