1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: documentation for wxListCtrl class
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
13 A list control presents lists in a number of formats: list view, report view,
14 icon view and small icon view. In any case, elements are numbered from zero.
15 For all these modes, the items are stored in the control and must be added to
16 it using wxListCtrl::InsertItem method.
18 A special case of report view quite different from the other modes of the list
19 control is a virtual control in which the items data (including text, images
20 and attributes) is managed by the main program and is requested by the control
21 itself only when needed which allows to have controls with millions of items
22 without consuming much memory. To use virtual list control you must use
23 wxListCtrl::SetItemCount first and overload at least
24 wxListCtrl::OnGetItemText (and optionally
25 wxListCtrl::OnGetItemImage or wxListCtrl::OnGetItemColumnImage and
26 wxListCtrl::OnGetItemAttr) to return the information
27 about the items when the control requests it. Virtual list control can be used
28 as a normal one except that no operations which can take time proportional to
29 the number of items in the control happen -- this is required to allow having a
30 practically infinite number of items. For example, in a multiple selection
31 virtual list control, the selections won't be sent when many items are selected
32 at once because this could mean iterating over all the items.
34 Using many of wxListCtrl features is shown in the
35 @ref overview_samplelistctrl "corresponding sample".
37 To intercept events from a list control, use the event table macros described
40 @b Mac Note: Starting with 2.8, wxListCtrl uses a native implementation for
41 report mode, and uses a generic implementation for other modes. You can use the
42 generic implementation for report mode as well by setting the
43 mac.listctrl.always_use_generic wxSystemOption to
48 Multicolumn list view, with optional small icons. Columns are
49 computed automatically, i.e. you don't set columns as in
50 wxLC_REPORT. In other words, the list wraps, unlike a wxListBox.
52 Single or multicolumn report view, with optional header.
54 The application provides items text on demand. May only be used
57 Large icon view, with optional labels.
58 @style{wxLC_SMALL_ICON}:
59 Small icon view, with optional labels.
60 @style{wxLC_ALIGN_TOP}:
61 Icons align to the top. Win32 default, Win32 only.
62 @style{wxLC_ALIGN_LEFT}:
63 Icons align to the left.
64 @style{wxLC_AUTOARRANGE}:
65 Icons arrange themselves. Win32 only.
66 @style{wxLC_EDIT_LABELS}:
67 Labels are editable: the application will be notified when editing
69 @style{wxLC_NO_HEADER}:
70 No header in report mode.
71 @style{wxLC_SINGLE_SEL}:
72 Single selection (default is multiple).
73 @style{wxLC_SORT_ASCENDING}:
74 Sort in ascending order (must still supply a comparison callback in
76 @style{wxLC_SORT_DESCENDING}:
77 Sort in descending order (must still supply a comparison callback
80 Draws light horizontal rules between rows in report mode.
82 Draws light vertical rules between columns in report mode.
87 @appearance{listctrl.png}
90 @ref overview_wxlistctrloverview "wxListCtrl overview", wxListView, wxListBox,
91 wxTreeCtrl, wxImageList, wxListEvent, wxListItem
93 class wxListCtrl
: public wxControl
98 Constructor, creating and showing a list control.
101 Parent window. Must not be @NULL.
104 Window identifier. The value wxID_ANY indicates a default value.
110 Window size. If wxDefaultSize is specified then the window is sized
114 Window style. See wxListCtrl.
122 @sa Create(), wxValidator
125 wxListCtrl(wxWindow
* parent
, wxWindowID id
,
126 const wxPoint
& pos
= wxDefaultPosition
,
127 const wxSize
& size
= wxDefaultSize
,
128 long style
= wxLC_ICON
,
129 const wxValidator
& validator
= wxDefaultValidator
,
130 const wxString
& name
= wxListCtrlNameStr
);
134 Destructor, destroying the list control.
139 Arranges the items in icon or small icon view. This only has effect on Win32.
151 Align to the left side of the control.
156 Align to the top side of the control.
158 wxLIST_ALIGN_SNAP_TO_GRID
163 bool Arrange(int flag
= wxLIST_ALIGN_DEFAULT
);
166 Sets the image list associated with the control and
167 takes ownership of it (i.e. the control will, unlike when using
168 SetImageList, delete the list when destroyed). @e which is one of
169 wxIMAGE_LIST_NORMAL, wxIMAGE_LIST_SMALL, wxIMAGE_LIST_STATE (the last is
174 void AssignImageList(wxImageList
* imageList
, int which
);
177 Deletes all items and all columns.
182 Creates the list control. See wxListCtrl() for further details.
184 bool Create(wxWindow
* parent
, wxWindowID id
,
185 const wxPoint
& pos
= wxDefaultPosition
,
186 const wxSize
& size
= wxDefaultSize
,
187 long style
= wxLC_ICON
,
188 const wxValidator
& validator
= wxDefaultValidator
,
189 const wxString
& name
= wxListCtrlNameStr
);
192 Deletes all items in the list control.
194 @b NB: This function does @e not send the
195 @c wxEVT_COMMAND_LIST_DELETE_ITEM event because deleting many items
196 from the control would be too slow then (unlike wxListCtrl::DeleteItem).
198 bool DeleteAllItems();
203 bool DeleteColumn(int col
);
206 Deletes the specified item. This function sends the
207 @c wxEVT_COMMAND_LIST_DELETE_ITEM event for the item being deleted.
209 See also: DeleteAllItems()
211 bool DeleteItem(long item
);
214 Starts editing the label of the given item. This function generates a
215 EVT_LIST_BEGIN_LABEL_EDIT event which can be vetoed so that no
216 text control will appear for in-place editing.
218 If the user changed the label (i.e. s/he does not press ESC or leave
219 the text control without changes, a EVT_LIST_END_LABEL_EDIT event
220 will be sent which can be vetoed as well.
222 void EditLabel(long item
);
225 Ensures this item is visible.
227 bool EnsureVisible(long item
);
231 Find an item nearest this position in the specified direction, starting from
232 @e start or the beginning if @e start is -1.
236 @b FindItem( start, str, partial = @false )
240 @b FindItemData( start, data )
244 @b FindItemAtPos( start, point, direction )
246 long FindItem(long start
, const wxString
& str
,
247 bool partial
= @
false);
248 long FindItem(long start
, long data
);
249 long FindItem(long start
, const wxPoint
& pt
, int direction
);
253 Gets information about this column. See SetItem() for more
256 bool GetColumn(int col
, wxListItem
& item
);
259 Returns the number of columns.
261 int GetColumnCount();
264 Gets the column number by visual order index (report view only).
266 int GetColumnIndexFromOrder(int order
);
269 Gets the column visual order index (valid in report view only).
271 int GetColumnOrder(int col
);
274 Gets the column width (report view only).
276 int GetColumnWidth(int col
);
279 Returns the array containing the orders of all columns. On error, an empty
282 wxArrayInt
GetColumnsOrder();
285 Gets the number of items that can fit vertically in the
286 visible area of the list control (list or report view)
287 or the total number of items in the list control (icon
290 int GetCountPerPage();
293 Returns the edit control being currently used to edit a label. Returns @NULL
294 if no label is being edited.
296 @b NB: It is currently only implemented for wxMSW and the generic version,
297 not for the native Mac OS X version.
299 wxTextCtrl
* GetEditControl();
302 Returns the specified image list. @e which may be one of:
305 @b wxIMAGE_LIST_NORMAL
308 The normal (large icon) image list.
310 @b wxIMAGE_LIST_SMALL
313 The small icon image list.
315 @b wxIMAGE_LIST_STATE
318 The user-defined state image list (unimplemented).
320 wxImageList
* GetImageList(int which
);
323 Gets information about the item. See SetItem() for more
326 You must call @e info.SetId() to the ID of item you're interested in
327 before calling this method.
329 bool GetItem(wxListItem
& info
);
332 Returns the colour for this item. If the item has no specific colour, returns
333 an invalid colour (and not the default background control of the control
336 @sa GetItemTextColour()
338 wxColour
GetItemBackgroundColour(long item
);
341 Returns the number of items in the list control.
346 Gets the application-defined data associated with this item.
348 long GetItemData(long item
);
351 Returns the item's font.
353 wxFont
GetItemFont(long item
);
356 Returns the position of the item, in icon or small icon view.
358 bool GetItemPosition(long item
, wxPoint
& pos
);
361 Returns the rectangle representing the item's size and position, in physical
364 @e code is one of wxLIST_RECT_BOUNDS, wxLIST_RECT_ICON, wxLIST_RECT_LABEL.
366 bool GetItemRect(long item
, wxRect
& rect
,
367 int code
= wxLIST_RECT_BOUNDS
);
370 Retrieves the spacing between icons in pixels: horizontal spacing is returned
371 as @c x component of the wxSize object and the vertical
372 spacing as its @c y component.
374 wxSize
GetItemSpacing();
377 Gets the item state. For a list of state flags, see SetItem().
379 The @b stateMask indicates which state flags are of interest.
381 int GetItemState(long item
, long stateMask
);
384 Gets the item text for this item.
386 wxString
GetItemText(long item
);
389 Returns the colour for this item. If the item has no specific colour, returns
390 an invalid colour (and not the default foreground control of the control itself
391 as this wouldn't allow distinguishing between items having the same colour as
392 the current control foreground and items with default colour which, hence, have
393 always the same colour as the control).
395 wxColour
GetItemTextColour(long item
);
398 Searches for an item with the given geometry or state, starting from
399 @e item but excluding the @e item itself. If @e item is -1,
400 the first item that matches the specified flags will be returned.
402 Returns the first item with given state following @e item or -1 if
405 This function may be used to find all selected items in the control like this:
406 @e geometry can be one of:
412 Searches for an item above the specified item.
417 Searches for subsequent item by index.
422 Searches for an item below the specified item.
427 Searches for an item to the left of the specified item.
432 Searches for an item to the right of the specified item.
434 @b NB: this parameter is only supported by wxMSW currently and ignored on
437 @e state can be a bitlist of the following:
440 wxLIST_STATE_DONTCARE
443 Don't care what the state is.
445 wxLIST_STATE_DROPHILITED
448 The item indicates it is a drop target.
453 The item has the focus.
455 wxLIST_STATE_SELECTED
458 The item is selected.
463 The item is selected as part of a cut and paste operation.
465 long GetNextItem(long item
, int geometry
= wxLIST_NEXT_ALL
,
466 int state
= wxLIST_STATE_DONTCARE
);
469 Returns the number of selected items in the list control.
471 int GetSelectedItemCount();
474 Returns the rectangle representing the size and position, in physical
475 coordinates, of the given subitem, i.e. the part of the row @e item in the
478 This method is only meaningfull when the wxListCtrl is in the report mode. If
479 @e subItem parameter is equal to the special value
480 @c wxLIST_GETSUBITEMRECT_WHOLEITEM the return value is the same as
483 @e code can be one of @c wxLIST_RECT_BOUNDS,
484 @c wxLIST_RECT_ICON or @c wxLIST_RECT_LABEL.
486 This function is new since wxWidgets version 2.7.0
488 bool GetSubItemRect(long item
, long subItem
, wxRect
& rect
,
489 int code
= wxLIST_RECT_BOUNDS
);
492 Gets the text colour of the list control.
494 wxColour
GetTextColour();
497 Gets the index of the topmost visible item when in
503 Returns the rectangle taken by all items in the control. In other words, if the
504 controls client size were equal to the size of this rectangle, no scrollbars
505 would be needed and no free space would be left.
507 Note that this function only works in the icon and small icon views, not in
508 list or report views (this is a limitation of the native Win32 control).
510 wxRect
GetViewRect();
513 Determines which item (if any) is at the specified point,
514 giving details in @e flags. Returns index of the item or @c wxNOT_FOUND
515 if no item is at the specified point.
516 @e flags will be a combination of the following flags:
522 Above the client area.
527 Below the client area.
529 wxLIST_HITTEST_NOWHERE
532 In the client area but below the last item.
534 wxLIST_HITTEST_ONITEMICON
537 On the bitmap associated with an item.
539 wxLIST_HITTEST_ONITEMLABEL
542 On the label (string) associated with an item.
544 wxLIST_HITTEST_ONITEMRIGHT
547 In the area to the right of an item.
549 wxLIST_HITTEST_ONITEMSTATEICON
552 On the state icon for a tree view item that is in a user-defined state.
554 wxLIST_HITTEST_TOLEFT
557 To the right of the client area.
559 wxLIST_HITTEST_TORIGHT
562 To the left of the client area.
564 wxLIST_HITTEST_ONITEM
567 Combination of wxLIST_HITTEST_ONITEMICON, wxLIST_HITTEST_ONITEMLABEL,
568 wxLIST_HITTEST_ONITEMSTATEICON.
570 If @e ptrSubItem is not @NULL and the wxListCtrl is in the report
571 mode the subitem (or column) number will also be provided.
572 This feature is only available in version 2.7.0 or higher and is currently only
573 implemented under wxMSW and requires at least comctl32.dll of verion 4.70 on
574 the host system or the value stored in @e ptrSubItem will be always -1. To
575 compile this feature into wxWidgets library you need to have access to
576 commctrl.h of version 4.70 that is provided by Microsoft.
578 long HitTest(const wxPoint
& point
, int& flags
,
583 For report view mode (only), inserts a column. For more details, see SetItem().
585 long InsertColumn(long col
, wxListItem
& info
);
586 long InsertColumn(long col
, const wxString
& heading
,
587 int format
= wxLIST_FORMAT_LEFT
,
593 Insert an image/string item.
599 Index of the new item, supplied by the application
605 index into the image list associated with this control and view style
607 long InsertItem(wxListItem
& info
);
608 long InsertItem(long index
, const wxString
& label
);
609 long InsertItem(long index
, int imageIndex
);
610 long InsertItem(long index
, const wxString
& label
,
615 This function may be overloaded in the derived class for a control with
616 @c wxLC_VIRTUAL style. It should return the attribute for the
617 for the specified @c item or @NULL to use the default appearance
620 wxListCtrl will not delete the pointer or keep a reference of it. You can
621 return the same wxListItemAttr pointer for every OnGetItemAttr call.
623 The base class version always returns @NULL.
625 @sa OnGetItemImage(), OnGetItemColumnImage(),
628 virtual wxListItemAttr
* OnGetItemAttr(long item
);
631 Overload this function in the derived class for a control with
632 @c wxLC_VIRTUAL and @c wxLC_REPORT styles in order to specify the image
633 index for the given line and column.
635 The base class version always calls OnGetItemImage for the first column, else
638 @sa OnGetItemText(), OnGetItemImage(),
641 virtual int OnGetItemColumnImage(long item
, long column
);
644 This function must be overloaded in the derived class for a control with
645 @c wxLC_VIRTUAL style having an @ref setimagelist() "image list"
646 (if the control doesn't have an image list, it is not necessary to overload
647 it). It should return the index of the items image in the controls image list
649 In a control with @c wxLC_REPORT style, OnGetItemImage only gets called for
650 the first column of each line.
652 The base class version always returns -1.
654 @sa OnGetItemText(), OnGetItemColumnImage(),
657 virtual int OnGetItemImage(long item
);
660 This function @b must be overloaded in the derived class for a control with
661 @c wxLC_VIRTUAL style. It should return the string containing the text of
662 the given @e column for the specified @c item.
664 @sa SetItemCount(), OnGetItemImage(),
665 OnGetItemColumnImage(), OnGetItemAttr()
667 virtual wxString
OnGetItemText(long item
, long column
);
670 Redraws the given @e item. This is only useful for the virtual list controls
671 as without calling this function the displayed value of the item doesn't change
672 even when the underlying data does change.
676 void RefreshItem(long item
);
679 Redraws the items between @e itemFrom and @e itemTo. The starting item
680 must be less than or equal to the ending one.
682 Just as RefreshItem() this is only useful for
683 virtual list controls.
685 void RefreshItems(long itemFrom
, long itemTo
);
688 Scrolls the list control. If in icon, small icon or report view mode,
689 @e dx specifies the number of pixels to scroll. If in list view mode,
690 @e dx specifies the number of columns to scroll. @e dy always specifies
691 the number of pixels to scroll vertically.
693 @b NB: This method is currently only implemented in the Windows version.
695 bool ScrollList(int dx
, int dy
);
698 Sets the background colour (GetBackgroundColour already implicit in
701 void SetBackgroundColour(const wxColour
& col
);
704 Sets information about this column. See SetItem() for more
707 bool SetColumn(int col
, wxListItem
& item
);
710 Sets the column width.
712 @e width can be a width in pixels or wxLIST_AUTOSIZE (-1) or
713 wxLIST_AUTOSIZE_USEHEADER (-2).
714 wxLIST_AUTOSIZE will resize the column to the length of its longest item.
715 wxLIST_AUTOSIZE_USEHEADER
716 will resize the column to the length of the header (Win32) or 80 pixels (other
719 In small or normal icon view, @e col must be -1, and the column width is set
722 bool SetColumnWidth(int col
, int width
);
725 Sets the order of all columns at once. The @e orders array must have the
726 same number elements as the number of columns and contain each position exactly
729 This function is valid in report view only.
731 bool SetColumnOrder(const wxArrayInt
& orders
);
734 Sets the image list associated with the control. @e which is one of
735 wxIMAGE_LIST_NORMAL, wxIMAGE_LIST_SMALL, wxIMAGE_LIST_STATE (the last is
738 This method does not take ownership of the image list, you have to
741 @sa AssignImageList()
743 void SetImageList(wxImageList
* imageList
, int which
);
747 Sets a string field at a particular column.
749 bool SetItem(wxListItem
& info
);
750 long SetItem(long index
, int col
, const wxStringamp
; label
,
752 m_mask m_state field is valid
.
763 The m_text field is valid
.
774 The m_image field is valid
.
785 The m_data field is valid
.
796 The m_width field is valid
.
807 The m_format field is valid
.
813 The m_stateMask
and m_state members take flags from the following
:
821 wxLIST_STATE_DONTCARE
826 Don
't care what the state is. Win32 only.
832 wxLIST_STATE_DROPHILITED
837 The item is highlighted to receive a drop event. Win32 only.
848 The item has the focus.
854 wxLIST_STATE_SELECTED
859 The item is selected.
870 The item is in the cut state. Win32 only.
876 The wxListItem object can also contain item-specific colour and font
877 information: for this you need to call one of SetTextColour(),
878 SetBackgroundColour() or SetFont() functions on it passing it the colour/font
879 to use. If the colour/font is not specified, the default list control
881 long SetItem(long index, int col, const wxString& label,
886 Sets the background colour for this item. This function only works in report
889 The colour can be retrieved using
890 GetItemBackgroundColour().
892 void SetItemBackgroundColour(long item, const wxColour& col);
895 Sets the image associated with the item. In report view, you can specify the
897 The image is an index into the image list associated with the list control.
899 bool SetItemColumnImage(long item, long column, int image);
902 This method can only be used with virtual list controls. It is used to indicate
903 to the control the number of items it contains. After calling it, the main
904 program should be ready to handle calls to various item callbacks (such as
905 wxListCtrl::OnGetItemText) for all items in the range
908 void SetItemCount(long count);
911 Associates application-defined data with this item.
913 Notice that this function cannot be used to associate pointers with the control
914 items, use SetItemPtrData() instead.
916 bool SetItemData(long item, long data);
919 Sets the item's font
.
921 void SetItemFont(long item
, const wxFont
& font
);
925 Sets the unselected and selected images associated with the item. The images
927 image list associated with the list control. This form is deprecated: @e
931 bool SetItemImage(long item
, int image
);
932 bool SetItemImage(long item
, int image
, int selImage
);
936 Sets the position of the item, in icon or small icon view. Windows only.
938 bool SetItemPosition(long item
, const wxPoint
& pos
);
941 Associates application-defined data with this item. The @e data parameter may
942 be either an integer or a pointer cast to the @c wxUIntPtr type which is
943 guaranteed to be large enough to be able to contain all integer types and
946 This function is new since wxWidgets version 2.8.4
948 bool SetItemPtrData(long item
, wxUIntPtr data
);
951 Sets the item state. For a list of state flags, see SetItem().
953 The @b stateMask indicates which state flags are valid.
955 bool SetItemState(long item
, long state
, long stateMask
);
958 Sets the item text for this item.
960 void SetItemText(long item
, const wxString
& text
);
963 Sets the colour for this item. This function only works in report view.
965 The colour can be retrieved using
968 void SetItemTextColour(long item
, const wxColour
& col
);
971 Adds or removes a single window style.
973 void SetSingleStyle(long style
, bool add
= @
true);
976 Sets the text colour of the list control.
978 void SetTextColour(const wxColour
& col
);
981 Sets the whole window style, deleting all items.
983 void SetWindowStyleFlag(long style
);
986 Call this function to sort the items in the list control. Sorting is done
987 using the specified @e fnSortCallBack function. This function must have the
989 It is called each time when the two items must be compared and should return 0
990 if the items are equal, negative value if the first item is less than the
991 second one and positive value if the first one is greater than the second one
992 (the same convention as used by @c qsort(3)).
995 client data associated with the first item (NOT the index).
998 client data associated with the second item (NOT the index).
1001 the value passed to SortItems() itself.
1003 bool SortItems(wxListCtrlCompare fnSortCallBack
, long data
);
1009 @wxheader{listctrl.h}
1011 A list event holds information about events associated with wxListCtrl objects.
1019 class wxListEvent
: public wxNotifyEvent
1025 wxListEvent(WXTYPE commandType
= 0, int id
= 0);
1028 For @c EVT_LIST_CACHE_HINT event only: return the first item which the
1029 list control advises us to cache.
1031 long GetCacheFrom();
1034 For @c EVT_LIST_CACHE_HINT event only: return the last item (inclusive)
1035 which the list control advises us to cache.
1040 The column position: it is only used with @c COL events. For the column
1041 dragging events, it is the column to the left of the divider being dragged, for
1042 the column click events it may be -1 if the user clicked in the list control
1043 header outside any column.
1063 An item object, used by some events. See also wxListCtrl::SetItem.
1065 const wxListItem
GetItem();
1068 Key code if the event is a keypress event.
1073 The (new) item label for @c EVT_LIST_END_LABEL_EDIT event.
1075 const wxString
GetLabel();
1083 The position of the mouse pointer if the event is a drag event.
1090 const wxString
GetText();
1093 This method only makes sense for @c EVT_LIST_END_LABEL_EDIT message
1094 and returns @true if it the label editing has been cancelled by the user
1095 (GetLabel() returns an empty string in this case
1096 but it doesn't allow the application to distinguish between really cancelling
1098 the admittedly rare case when the user wants to rename it to an empty string).
1100 bool IsEditCancelled();
1105 @class wxListItemAttr
1106 @wxheader{listctrl.h}
1108 Represents the attributes (color, font, ...) of a
1109 wxListCtrl wxListItem.
1115 @ref overview_wxlistctrloverview "wxListCtrl overview", wxListCtrl, wxListItem
1117 class wxListItemAttr
1122 Construct a wxListItemAttr with the specified foreground and
1123 background colors and font.
1126 wxListItemAttr(const wxColour colText
,
1127 const wxColour colBack
,
1132 Returns the currently set background color.
1134 const wxColour
GetBackgroundColour();
1137 Returns the currently set font.
1139 const wxFont
GetFont();
1142 Returns the currently set text color.
1144 const wxColour
GetTextColour();
1147 Returns @true if the currently set background color is valid.
1149 bool HasBackgroundColour();
1152 Returns @true if the currently set font is valid.
1157 Returns @true if the currently set text color is valid.
1159 bool HasTextColour();
1162 Sets a new background color.
1164 void SetBackgroundColour(const wxColour
& colour
);
1169 void SetFont(const wxFont
& font
);
1172 Sets a new text color.
1174 void SetTextColour(const wxColour
& colour
);
1180 @wxheader{listctrl.h}
1182 This class currently simply presents a simpler to use interface for the
1183 wxListCtrl -- it can be thought of as a @e faade
1184 for that complicated class. Using it is preferable to using
1185 wxListCtrl directly whenever possible because in the
1186 future some ports might implement wxListView but not the full set of wxListCtrl
1189 Other than different interface, this class is identical to wxListCtrl. In
1190 particular, it uses the same events, same window styles and so on.
1194 @appearance{listview.png}
1197 wxListView::SetColumnImage
1199 class wxListView
: public wxListCtrl
1203 Resets the column image -- after calling this function, no image will be shown.
1206 the column to clear image for
1208 @sa SetColumnImage()
1210 void ClearColumnImage(int col
);
1213 Sets focus to the item with the given @e index.
1215 void Focus(long index
);
1218 Returns the first selected item in a (presumably) multiple selection control.
1219 Together with GetNextSelected() it can be
1220 used to iterate over all selected items in the control.
1222 @returns The first selected item, if any, -1 otherwise.
1224 long GetFirstSelected();
1227 Returns the currently focused item or -1 if none.
1229 @sa IsSelected(), Focus()
1231 long GetFocusedItem();
1234 Used together with GetFirstSelected() to
1235 iterate over all selected items in the control.
1237 @returns Returns the next selected item or -1 if there are no more of
1240 long GetNextSelected(long item
);
1243 Returns @true if the item with the given @e index is selected,
1246 @sa GetFirstSelected(), GetNextSelected()
1248 bool IsSelected(long index
);
1251 Selects or unselects the given item.
1254 the item to select or unselect
1257 if @true (default), selects the item, otherwise unselects it
1259 @sa wxListCtrl::SetItemState
1261 void Select(bool on
= @
true);
1264 Sets the column image for the specified column. To use the column images, the
1265 control must have a valid image list with at least one image.
1268 the column to set image for
1271 the index of the column image in the controls image list
1273 void SetColumnImage(int col
, int image
);
1279 @wxheader{listctrl.h}
1281 This class stores information about a wxListCtrl item or column.
1286 class wxListItem
: public wxObject
1295 Resets the item state to the default.
1300 Returns the alignment for this item. Can be one of
1301 wxLIST_FORMAT_LEFT, wxLIST_FORMAT_RIGHT or wxLIST_FORMAT_CENTRE.
1303 wxListColumnFormat
GetAlign();
1306 Returns the background colour for this item.
1308 wxColour
GetBackgroundColour();
1311 Returns the zero-based column; meaningful only in report mode.
1316 Returns client data associated with the control. Please note that
1317 client data is associated with the item and not with subitems.
1322 Returns the font used to display the item.
1327 Returns the zero-based item position.
1332 Returns the zero-based index of the image
1333 associated with the item into the image list.
1338 Returns a bit mask indicating which fields of the structure are valid;
1339 can be any combination of the following values:
1345 @b GetState is valid.
1350 @b GetText is valid.
1355 @b GetImage is valid.
1360 @b GetData is valid.
1365 @b GetWidth is valid.
1370 @b GetFormat is valid.
1375 Returns a bit field representing the state of the item. Can be any
1379 wxLIST_STATE_DONTCARE
1382 Don't care what the state is. Win32 only.
1384 wxLIST_STATE_DROPHILITED
1387 The item is highlighted to receive a drop event. Win32 only.
1389 wxLIST_STATE_FOCUSED
1392 The item has the focus.
1394 wxLIST_STATE_SELECTED
1397 The item is selected.
1402 The item is in the cut state. Win32 only.
1407 Returns the label/header text.
1409 const wxString
GetText();
1412 Returns the text colour.
1414 wxColour
GetTextColour();
1417 Meaningful only for column headers in report mode. Returns the column width.
1422 Sets the alignment for the item. See also
1425 void SetAlign(wxListColumnFormat align
);
1428 Sets the background colour for the item.
1430 void SetBackgroundColour(const wxColour
& colBack
);
1433 Sets the zero-based column. Meaningful only in report mode.
1435 void SetColumn(int col
);
1439 Sets client data for the item. Please note that
1440 client data is associated with the item and not with subitems.
1442 void SetData(long data
);
1443 void SetData(void* data
);
1447 Sets the font for the item.
1449 void SetFont(const wxFont
& font
);
1452 Sets the zero-based item position.
1454 void SetId(long id
);
1457 Sets the zero-based index of the image associated with the item
1458 into the image list.
1460 void SetImage(int image
);
1463 Sets the mask of valid fields. See GetMask().
1465 void SetMask(long mask
);
1468 Sets the item state flags (note that the valid state flags are influenced
1469 by the value of the state mask, see
1470 wxListItem::SetStateMask).
1471 See GetState() for valid flag
1474 void SetState(long state
);
1477 Sets the bitmask that is used to determine which of the state flags
1478 are to be set. See also SetState().
1480 void SetStateMask(long stateMask
);
1483 Sets the text label for the item.
1485 void SetText(const wxString
& text
);
1488 Sets the text colour for the item.
1490 void SetTextColour(const wxColour
& colText
);
1493 Meaningful only for column headers in report mode. Sets the column width.
1495 void SetWidth(int width
);