wxListCtrl — wx v2.6

Search documentation of wx

# wxListCtrl (wx v2.6)

Copy Markdown View Source

A list control presents lists in a number of formats: list view, report view, icon view and small icon view.

In any case, elements are numbered from zero. For all these modes, the items are stored in the control and must be added to it using `insertItem/4` method.

A special case of report view quite different from the other modes of the list control is a virtual control in which the items data (including text, images and attributes) is managed by the main program and is requested by the control itself only when needed which allows having controls with millions of items without consuming much memory. To use virtual list control you must use `setItemCount/2` first and override at least `wxListCtrl::OnGetItemText` (not implemented in wx) (and optionally `wxListCtrl::OnGetItemImage` (not implemented in wx) or `wxListCtrl::OnGetItemColumnImage` (not implemented in wx) and `wxListCtrl::OnGetItemAttr` (not implemented in wx)) to return the information about the items when the control requests it.

Virtual list control can be used as a normal one except that no operations which can take time proportional to the number of items in the control happen - this is required to allow having a practically infinite number of items. For example, in a multiple selection virtual list control, the selections won't be sent when many items are selected at once because this could mean iterating over all the items.

Using many of `wxListCtrl` features is shown in the corresponding sample.

To intercept events from a list control, use the event table macros described in `wxListEvent`.

`wxMac Note`: Starting with wxWidgets 2.8, `wxListCtrl` uses a native implementation for report mode, and uses a generic implementation for other modes. You can use the generic implementation for report mode as well by setting the `mac.listctrl.always_use_generic` system option (see `wxSystemOptions`) to 1.

## Styles

This class supports the following styles:

- wxLC_LIST: Multicolumn list view, with optional small icons. Columns are computed automatically, i.e. you don't set columns as in `wxLC_REPORT`. In other words, the list wraps, unlike a `wxListBox`.

- wxLC_REPORT: Single or multicolumn report view, with optional header.

- wxLC_VIRTUAL: The application provides items text on demand. May only be used with `wxLC_REPORT`.

- wxLC_ICON: Large icon view, with optional labels.

- wxLC_SMALL_ICON: Small icon view, with optional labels.

- wxLC_ALIGN_TOP: Icons align to the top. Win32 default, Win32 only.

- wxLC_ALIGN_LEFT: Icons align to the left.

- wxLC_AUTOARRANGE: Icons arrange themselves. Win32 only.

- wxLC_EDIT_LABELS: Labels are editable: the application will be notified when editing starts.

- wxLC_NO_HEADER: No header in report mode.

- wxLC_SINGLE_SEL: Single selection (default is multiple).

- wxLC_SORT_ASCENDING: Sort in ascending order. (You must still supply a comparison callback in `sortItems/2`.)

- wxLC_SORT_DESCENDING: Sort in descending order. (You must still supply a comparison callback in `sortItems/2`.)

- wxLC_HRULES: Draws light horizontal rules between rows in report mode.

- wxLC_VRULES: Draws light vertical rules between columns in report mode.

See:

- Overview listctrl

- `wxListView`

- `wxListBox`

- `wxTreeCtrl`

- `wxImageList`

- `wxListEvent`

- `wxListItem`

This class is derived, and can use functions, from:

- `wxControl`

- `wxWindow`

- `wxEvtHandler`

wxWidgets docs: wxListCtrl

## Events

Event types emitted from this class:

- `command_list_begin_drag`

- `command_list_begin_rdrag`

- `command_list_begin_label_edit`

- `command_list_end_label_edit`

- `command_list_delete_item`

- `command_list_delete_all_items`

- `command_list_item_selected`

- `command_list_item_deselected`

- `command_list_item_activated`

- `command_list_item_focused`

- `command_list_item_middle_click`

- `command_list_item_right_click`

- `command_list_key_down`

- `command_list_insert_item`

- `command_list_col_click`

- `command_list_col_right_click`

- `command_list_col_begin_drag`

- `command_list_col_dragging`

- `command_list_col_end_drag`

- `command_list_cache_hint`

## Summary

### Types

wxListCtrl()

### Functions

arrange(This)

Equivalent to `arrange(This, [])`.

arrange/2

Arranges the items in icon or small icon view.

assignImageList(This, ImageList, Which)

Sets the image list associated with the control and takes ownership of it (i.e.

clearAll(This)

Deletes all items and all columns.

create(This, Parent)
create/3
deleteAllItems(This)

Deletes all items in the list control.

deleteColumn(This, Col)

Deletes a column.

deleteItem(This, Item)

Deletes the specified item.

destroy(This)

Destroys the object

editLabel(This, Item)

Starts editing the label of the given item.

ensureVisible(This, Item)

Ensures this item is visible.

findItem(This, Start, Str)

Equivalent to `findItem(This, Start, Str, [])`.

findItem/4

Find an item nearest this position in the specified direction, starting from `start` or the beginning if `start` is -1.

getColumn(This, Col, Item)

Gets information about this column.

getColumnCount(This)

Returns the number of columns.

getColumnWidth(This, Col)

Gets the column width (report view only).

getCountPerPage(This)

Gets the number of items that can fit vertically in the visible area of the list control (list or report view) or the total number of items in the list control (icon or small icon view).

getEditControl(This)

Returns the edit control being currently used to edit a label.

getImageList(This, Which)

Returns the specified image list.

getItem(This, Info)

Gets information about the item.

getItemBackgroundColour(This, Item)

Returns the colour for this item.

getItemCount(This)

Returns the number of items in the list control.

getItemData(This, Item)

Gets the application-defined data associated with this item.

getItemFont(This, Item)

Returns the item's font.

getItemPosition(This, Item)

Returns the position of the item, in icon or small icon view.

getItemRect(This, Item)

Equivalent to `getItemRect(This, Item, [])`.

getItemRect/3

Returns the rectangle representing the item's size and position, in physical coordinates.

getItemSpacing(This)

Retrieves the spacing between icons in pixels: horizontal spacing is returned as `x` component of the {Width,Height} object and the vertical spacing as its `y` component.

getItemState(This, Item, StateMask)

Gets the item state.

getItemText(This, Item)

Equivalent to `getItemText(This, Item, [])`.

getItemText/3

Gets the item text for this item.

getItemTextColour(This, Item)

Returns the colour for this item.

getNextItem(This, Item)

Equivalent to `getNextItem(This, Item, [])`.

getNextItem/3

Searches for an item with the given geometry or state, starting from `item` but excluding the `item` itself.

getSelectedItemCount(This)

Returns the number of selected items in the list control.

getTextColour(This)

Gets the text colour of the list control.

getTopItem(This)

Gets the index of the topmost visible item when in list or report view.

getViewRect(This)

Returns the rectangle taken by all items in the control.

hitTest(This, Point)

Determines which item (if any) is at the specified point, giving details in `flags`.

insertColumn/3

For report view mode (only), inserts a column.

insertColumn/4

For report view mode (only), inserts a column.

insertItem(This, Info)

Inserts an item, returning the index of the new item if successful, -1 otherwise.

insertItem/3

Insert a string item.

insertItem(This, Index, Label, ImageIndex)

Insert an image/string item.

new()
new(Parent)
new/2
refreshItem(This, Item)

Redraws the given `item`.

refreshItems(This, ItemFrom, ItemTo)

Redraws the items between `itemFrom` and `itemTo`.

scrollList(This, Dx, Dy)

Scrolls the list control.

setBackgroundColour(This, Col)

Sets the background colour.

setColumn(This, Col, Item)

Sets information about this column.

setColumnWidth(This, Col, Width)

Sets the column width.

setImageList(This, ImageList, Which)

Sets the image list associated with the control.

setItem(This, Info)

Sets the data of an item.

setItem(This, Index, Column, Label)

Equivalent to `setItem(This, Index, Column, Label, [])`.

setItem/5

Sets an item string field at a particular column.

setItemBackgroundColour(This, Item, Col)

Sets the background colour for this item.

setItemColumnImage(This, Item, Column, Image)

Sets the image associated with the item.

setItemCount(This, Count)

This method can only be used with virtual list controls.

setItemData(This, Item, Data)

Associates application-defined data with this item.

setItemFont(This, Item, Font)

Sets the item's font.

setItemImage(This, Item, Image)

Equivalent to `setItemImage(This, Item, Image, [])`.

setItemImage/4

Sets the unselected and selected images associated with the item.

setItemPosition(This, Item, Pos)

Sets the position of the item, in icon or small icon view.

setItemState(This, Item, State, StateMask)

Sets the item state.

setItemText(This, Item, Text)

Sets the item text for this item.

setItemTextColour(This, Item, Col)

Sets the colour for this item.

setSingleStyle(This, Style)

Equivalent to `setSingleStyle(This, Style, [])`.

setSingleStyle/3

Adds or removes a single window style.

setTextColour(This, Col)

Sets the text colour of the list control.

setWindowStyleFlag(This, Style)

Sets the whole window style, deleting all items.

sortItems(This, SortCallBack)

## Types

# wxListCtrl()

    -type wxListCtrl() :: wx:wx_object().

## Functions

# arrange(This)

    -spec arrange(This) -> boolean() when This :: wxListCtrl().

Equivalent to `arrange(This, [])`.

# arrange/2

    -spec arrange(This, [Option]) -> boolean() when This :: wxListCtrl(), Option :: {flag, integer()}.

Arranges the items in icon or small icon view.

This only has effect on Win32. `flag` is one of:

- wxLIST_ALIGN_DEFAULT: Default alignment.

- wxLIST_ALIGN_LEFT: Align to the left side of the control.

- wxLIST_ALIGN_TOP: Align to the top side of the control.

- wxLIST_ALIGN_SNAP_TO_GRID: Snap to grid.

# assignImageList(This, ImageList, Which)

    -spec assignImageList(This, ImageList, Which) -> ok
                             when
                                 This :: wxListCtrl(),
                                 ImageList :: wxImageList:wxImageList(),
                                 Which :: integer().

Sets the image list associated with the control and takes ownership of it (i.e.

the control will, unlike when using `setImageList/3`, delete the list when destroyed). `which` is one of `wxIMAGE_LIST_NORMAL`, `wxIMAGE_LIST_SMALL`, `wxIMAGE_LIST_STATE` (the last is unimplemented).

See: `setImageList/3`

# clearAll(This)

    -spec clearAll(This) -> ok when This :: wxListCtrl().

Deletes all items and all columns.

Note: This sends an event of type `wxEVT_LIST_DELETE_ALL_ITEMS` under all platforms.

# create(This, Parent)

    -spec create(This, Parent) -> boolean() when This :: wxWindow:wxWindow(), Parent :: wxWindow:wxWindow().

# create/3

    -spec create(This, Parent, [Option]) -> boolean()
                    when
                        This :: wxWindow:wxWindow(),
                        Parent :: wxWindow:wxWindow(),
                        Option ::
                            {winid, integer()} |
                            {pos, {X :: integer(), Y :: integer()}} |
                            {size, {W :: integer(), H :: integer()}} |
                            {style, integer()} |
                            {validator, wx:wx_object()} |
                            {onGetItemText, function()} |
                            {onGetItemAttr, function()} |
                            {onGetItemColumnImage, function()}.

# deleteAllItems(This)

    -spec deleteAllItems(This) -> boolean() when This :: wxListCtrl().

Deletes all items in the list control.

This function does `not` send the `wxEVT_LIST_DELETE_ITEM` event because deleting many items from the control would be too slow then (unlike `deleteItem/2`) but it does send the special `wxEVT_LIST_DELETE_ALL_ITEMS` event if the control was not empty. If it was already empty, nothing is done and no event is sent.

Return: true if the items were successfully deleted or if the control was already empty, false if an error occurred while deleting the items.

# deleteColumn(This, Col)

    -spec deleteColumn(This, Col) -> boolean() when This :: wxListCtrl(), Col :: integer().

Deletes a column.

# deleteItem(This, Item)

    -spec deleteItem(This, Item) -> boolean() when This :: wxListCtrl(), Item :: integer().

Deletes the specified item.

This function sends the `wxEVT_LIST_DELETE_ITEM` event for the item being deleted.

See: `deleteAllItems/1`

# destroy(This)

    -spec destroy(This :: wxListCtrl()) -> ok.

Destroys the object

# editLabel(This, Item)

    -spec editLabel(This, Item) -> wxTextCtrl:wxTextCtrl() when This :: wxListCtrl(), Item :: integer().

Starts editing the label of the given item.

This function generates a `EVT_LIST_BEGIN_LABEL_EDIT` event which can be vetoed so that no text control will appear for in-place editing.

If the user changed the label (i.e. s/he does not press ESC or leave the text control without changes, a `EVT_LIST_END_LABEL_EDIT` event will be sent which can be vetoed as well.

# ensureVisible(This, Item)

    -spec ensureVisible(This, Item) -> boolean() when This :: wxListCtrl(), Item :: integer().

Ensures this item is visible.

# findItem(This, Start, Str)

    -spec findItem(This, Start, Str) -> integer()
                      when This :: wxListCtrl(), Start :: integer(), Str :: unicode:chardata().

Equivalent to `findItem(This, Start, Str, [])`.

# findItem/4

    -spec findItem(This, Start, Str, [Option]) -> integer()
                      when
                          This :: wxListCtrl(),
                          Start :: integer(),
                          Str :: unicode:chardata(),
                          Option :: {partial, boolean()};
                  (This, Start, Pt, Direction) -> integer()
                      when
                          This :: wxListCtrl(),
                          Start :: integer(),
                          Pt :: {X :: integer(), Y :: integer()},
                          Direction :: integer().

Find an item nearest this position in the specified direction, starting from `start` or the beginning if `start` is -1.

Return: The next matching item if any or `-1` (wxNOT_FOUND) otherwise.

# getColumn(This, Col, Item)

    -spec getColumn(This, Col, Item) -> boolean()
                       when This :: wxListCtrl(), Col :: integer(), Item :: wxListItem:wxListItem().

Gets information about this column.

See `setItem/5` for more information.

# getColumnCount(This)

    -spec getColumnCount(This) -> integer() when This :: wxListCtrl().

Returns the number of columns.

# getColumnWidth(This, Col)

    -spec getColumnWidth(This, Col) -> integer() when This :: wxListCtrl(), Col :: integer().

Gets the column width (report view only).

# getCountPerPage(This)

    -spec getCountPerPage(This) -> integer() when This :: wxListCtrl().

Gets the number of items that can fit vertically in the visible area of the list control (list or report view) or the total number of items in the list control (icon or small icon view).

# getEditControl(This)

    -spec getEditControl(This) -> wxTextCtrl:wxTextCtrl() when This :: wxListCtrl().

Returns the edit control being currently used to edit a label.

Returns NULL if no label is being edited.

Note: It is currently only implemented for wxMSW and the generic version, not for the native macOS version.

# getImageList(This, Which)

    -spec getImageList(This, Which) -> wxImageList:wxImageList()
                          when This :: wxListCtrl(), Which :: integer().

Returns the specified image list.

`which` may be one of:

- wxIMAGE_LIST_NORMAL: The normal (large icon) image list.

- wxIMAGE_LIST_SMALL: The small icon image list.

- wxIMAGE_LIST_STATE: The user-defined state image list (unimplemented).

# getItem(This, Info)

    -spec getItem(This, Info) -> boolean() when This :: wxListCtrl(), Info :: wxListItem:wxListItem().

Gets information about the item.

See `setItem/5` for more information.

You must call `info.SetId()` to set the ID of item you're interested in before calling this method, and `info.SetMask()` with the flags indicating what fields you need to retrieve from `info`.

# getItemBackgroundColour(This, Item)

    -spec getItemBackgroundColour(This, Item) -> wx:wx_colour4()
                                     when This :: wxListCtrl(), Item :: integer().

Returns the colour for this item.

If the item has no specific colour, returns an invalid colour (and not the default background control of the control itself).

See: `getItemTextColour/2`

# getItemCount(This)

    -spec getItemCount(This) -> integer() when This :: wxListCtrl().

Returns the number of items in the list control.

# getItemData(This, Item)

    -spec getItemData(This, Item) -> integer() when This :: wxListCtrl(), Item :: integer().

Gets the application-defined data associated with this item.

# getItemFont(This, Item)

    -spec getItemFont(This, Item) -> wxFont:wxFont() when This :: wxListCtrl(), Item :: integer().

Returns the item's font.

# getItemPosition(This, Item)

    -spec getItemPosition(This, Item) -> Result
                             when
                                 Result :: {Res :: boolean(), Pos :: {X :: integer(), Y :: integer()}},
                                 This :: wxListCtrl(),
                                 Item :: integer().

Returns the position of the item, in icon or small icon view.

# getItemRect(This, Item)

    -spec getItemRect(This, Item) -> Result
                         when
                             Result ::
                                 {Res :: boolean(),
                                  Rect :: {X :: integer(), Y :: integer(), W :: integer(), H :: integer()}},
                             This :: wxListCtrl(),
                             Item :: integer().

Equivalent to `getItemRect(This, Item, [])`.

# getItemRect/3

    -spec getItemRect(This, Item, [Option]) -> Result
                         when
                             Result ::
                                 {Res :: boolean(),
                                  Rect :: {X :: integer(), Y :: integer(), W :: integer(), H :: integer()}},
                             This :: wxListCtrl(),
                             Item :: integer(),
                             Option :: {code, integer()}.

Returns the rectangle representing the item's size and position, in physical coordinates.

`code` is one of wxLIST_RECT_BOUNDS, wxLIST_RECT_ICON, wxLIST_RECT_LABEL.

# getItemSpacing(This)

    -spec getItemSpacing(This) -> {W :: integer(), H :: integer()} when This :: wxListCtrl().

Retrieves the spacing between icons in pixels: horizontal spacing is returned as `x` component of the {Width,Height} object and the vertical spacing as its `y` component.

# getItemState(This, Item, StateMask)

    -spec getItemState(This, Item, StateMask) -> integer()
                          when This :: wxListCtrl(), Item :: integer(), StateMask :: integer().

Gets the item state.

For a list of state flags, see `setItem/5`. The `stateMask` indicates which state flags are of interest.

# getItemText(This, Item)

    -spec getItemText(This, Item) -> unicode:charlist() when This :: wxListCtrl(), Item :: integer().

Equivalent to `getItemText(This, Item, [])`.

# getItemText/3

    -spec getItemText(This, Item, [Option]) -> unicode:charlist()
                         when This :: wxListCtrl(), Item :: integer(), Option :: {col, integer()}.

Gets the item text for this item.

# getItemTextColour(This, Item)

    -spec getItemTextColour(This, Item) -> wx:wx_colour4() when This :: wxListCtrl(), Item :: integer().

Returns the colour for this item.

If the item has no specific colour, returns an invalid colour (and not the default foreground control of the control itself as this wouldn't allow distinguishing between items having the same colour as the current control foreground and items with default colour which, hence, have always the same colour as the control).

# getNextItem(This, Item)

    -spec getNextItem(This, Item) -> integer() when This :: wxListCtrl(), Item :: integer().

Equivalent to `getNextItem(This, Item, [])`.

# getNextItem/3

    -spec getNextItem(This, Item, [Option]) -> integer()
                         when
                             This :: wxListCtrl(),
                             Item :: integer(),
                             Option :: {geometry, integer()} | {state, integer()}.

Searches for an item with the given geometry or state, starting from `item` but excluding the `item` itself.

If `item` is -1, the first item that matches the specified flags will be returned. Returns the first item with given state following `item` or -1 if no such item found. This function may be used to find all selected items in the control like this:

`geometry` can be one of:

- wxLIST_NEXT_ABOVE: Searches for an item above the specified item.

- wxLIST_NEXT_ALL: Searches for subsequent item by index.

- wxLIST_NEXT_BELOW: Searches for an item below the specified item.

- wxLIST_NEXT_LEFT: Searches for an item to the left of the specified item.

- wxLIST_NEXT_RIGHT: Searches for an item to the right of the specified item.

Note: this parameter is only supported by wxMSW currently and ignored on other platforms.

`state` can be a bitlist of the following:

- wxLIST_STATE_DONTCARE: Don't care what the state is.

- wxLIST_STATE_DROPHILITED: The item indicates it is a drop target.

- wxLIST_STATE_FOCUSED: The item has the focus.

- wxLIST_STATE_SELECTED: The item is selected.

- wxLIST_STATE_CUT: The item is selected as part of a cut and paste operation.

# getSelectedItemCount(This)

    -spec getSelectedItemCount(This) -> integer() when This :: wxListCtrl().

Returns the number of selected items in the list control.

# getTextColour(This)

    -spec getTextColour(This) -> wx:wx_colour4() when This :: wxListCtrl().

Gets the text colour of the list control.

# getTopItem(This)

    -spec getTopItem(This) -> integer() when This :: wxListCtrl().

Gets the index of the topmost visible item when in list or report view.

# getViewRect(This)

    -spec getViewRect(This) -> {X :: integer(), Y :: integer(), W :: integer(), H :: integer()}
                         when This :: wxListCtrl().

Returns the rectangle taken by all items in the control.

In other words, if the controls client size were equal to the size of this rectangle, no scrollbars would be needed and no free space would be left.

Note that this function only works in the icon and small icon views, not in list or report views (this is a limitation of the native Win32 control).

# hitTest(This, Point)

    -spec hitTest(This, Point) -> Result
                     when
                         Result :: {Res :: integer(), Flags :: integer(), PtrSubItem :: integer()},
                         This :: wxListCtrl(),
                         Point :: {X :: integer(), Y :: integer()}.

Determines which item (if any) is at the specified point, giving details in `flags`.

Returns index of the item or `wxNOT_FOUND` if no item is at the specified point.

`flags` will be a combination of the following flags:

- wxLIST_HITTEST_ABOVE: Above the control's client area.

- wxLIST_HITTEST_BELOW: Below the control's client area.

- wxLIST_HITTEST_TOLEFT: To the left of the control's client area.

- wxLIST_HITTEST_TORIGHT: To the right of the control's client area.

- wxLIST_HITTEST_NOWHERE: Inside the control's client area but not over an item.

- wxLIST_HITTEST_ONITEMICON: Over an item's icon.

- wxLIST_HITTEST_ONITEMLABEL: Over an item's text.

- wxLIST_HITTEST_ONITEMSTATEICON: Over the checkbox of an item.

- wxLIST_HITTEST_ONITEM: Combination of `wxLIST_HITTEST_ONITEMICON`, `wxLIST_HITTEST_ONITEMLABEL`, `wxLIST_HITTEST_ONITEMSTATEICON`.

If `ptrSubItem` is not NULL and the `wxListCtrl` is in the report mode the subitem (or column) number will also be provided. This feature is only available in version 2.7.0 or higher and is currently only implemented under wxMSW and requires at least comctl32.dll of version 4.70 on the host system or the value stored in `ptrSubItem` will be always -1. To compile this feature into wxWidgets library you need to have access to commctrl.h of version 4.70 that is provided by Microsoft.

# insertColumn/3

    -spec insertColumn(This, Col, Heading) -> integer()
                          when This :: wxListCtrl(), Col :: integer(), Heading :: unicode:chardata();
                      (This, Col, Info) -> integer()
                          when This :: wxListCtrl(), Col :: integer(), Info :: wxListItem:wxListItem().

For report view mode (only), inserts a column.

For more details, see `setItem/5`. Also see `insertColumn/4` overload for a usually more convenient alternative to this method and the description of how the item width is interpreted by this method.

# insertColumn/4

    -spec insertColumn(This, Col, Heading, [Option]) -> integer()
                          when
                              This :: wxListCtrl(),
                              Col :: integer(),
                              Heading :: unicode:chardata(),
                              Option :: {format, integer()} | {width, integer()}.

For report view mode (only), inserts a column.

Insert a new column in the list control in report view mode at the given position specifying its most common attributes.

Notice that to set the image for the column you need to use `insertColumn/4` overload and specify ?wxLIST_MASK_IMAGE in the item mask.

Return: The index of the inserted column or -1 if adding it failed.

# insertItem(This, Info)

    -spec insertItem(This, Info) -> integer() when This :: wxListCtrl(), Info :: wxListItem:wxListItem().

Inserts an item, returning the index of the new item if successful, -1 otherwise.

# insertItem/3

    -spec insertItem(This, Index, ImageIndex) -> integer()
                        when This :: wxListCtrl(), Index :: integer(), ImageIndex :: integer();
                    (This, Index, Label) -> integer()
                        when This :: wxListCtrl(), Index :: integer(), Label :: unicode:chardata().

Insert a string item.

# insertItem(This, Index, Label, ImageIndex)

    -spec insertItem(This, Index, Label, ImageIndex) -> integer()
                        when
                            This :: wxListCtrl(),
                            Index :: integer(),
                            Label :: unicode:chardata(),
                            ImageIndex :: integer().

Insert an image/string item.

# new()

    -spec new() -> wxListCtrl().

# new(Parent)

    -spec new(Parent) -> wxListCtrl() when Parent :: wxWindow:wxWindow().

# new/2

    -spec new(Parent, [Option]) -> wxListCtrl()
                 when
                     Parent :: wxWindow:wxWindow(),
                     Option ::
                         {winid, integer()} |
                         {pos, {X :: integer(), Y :: integer()}} |
                         {size, {W :: integer(), H :: integer()}} |
                         {style, integer()} |
                         {validator, wx:wx_object()} |
                         {onGetItemText, function()} |
                         {onGetItemAttr, function()} |
                         {onGetItemColumnImage, function()}.

# refreshItem(This, Item)

    -spec refreshItem(This, Item) -> ok when This :: wxListCtrl(), Item :: integer().

Redraws the given `item`.

This is only useful for the virtual list controls as without calling this function the displayed value of the item doesn't change even when the underlying data does change.

See: `refreshItems/3`

# refreshItems(This, ItemFrom, ItemTo)

    -spec refreshItems(This, ItemFrom, ItemTo) -> ok
                          when This :: wxListCtrl(), ItemFrom :: integer(), ItemTo :: integer().

Redraws the items between `itemFrom` and `itemTo`.

The starting item must be less than or equal to the ending one.

Just as `refreshItem/2` this is only useful for virtual list controls.

# scrollList(This, Dx, Dy)

    -spec scrollList(This, Dx, Dy) -> boolean() when This :: wxListCtrl(), Dx :: integer(), Dy :: integer().

Scrolls the list control.

If in icon, small icon or report view mode, `dx` specifies the number of pixels to scroll. If in list view mode, `dx` specifies the number of columns to scroll. `dy` always specifies the number of pixels to scroll vertically.

Note: This method is currently only implemented in the Windows version.

# setBackgroundColour(This, Col)

    -spec setBackgroundColour(This, Col) -> boolean() when This :: wxListCtrl(), Col :: wx:wx_colour().

Sets the background colour.

Note that the `wxWindow:getBackgroundColour/1` function of `wxWindow` base class can be used to retrieve the current background colour.

# setColumn(This, Col, Item)

    -spec setColumn(This, Col, Item) -> boolean()
                       when This :: wxListCtrl(), Col :: integer(), Item :: wxListItem:wxListItem().

Sets information about this column.

See `setItem/5` for more information.

# setColumnWidth(This, Col, Width)

    -spec setColumnWidth(This, Col, Width) -> boolean()
                            when This :: wxListCtrl(), Col :: integer(), Width :: integer().

Sets the column width.

`width` can be a width in pixels or `wxLIST_AUTOSIZE` (-1) or `wxLIST_AUTOSIZE_USEHEADER` (-2).

`wxLIST_AUTOSIZE` will resize the column to the length of its longest item.

`wxLIST_AUTOSIZE_USEHEADER` will resize the column to the length of the header (Win32) or 80 pixels (other platforms).

In small or normal icon view, `col` must be -1, and the column width is set for all columns.

# setImageList(This, ImageList, Which)

    -spec setImageList(This, ImageList, Which) -> ok
                          when
                              This :: wxListCtrl(),
                              ImageList :: wxImageList:wxImageList(),
                              Which :: integer().

Sets the image list associated with the control.

`which` is one of `wxIMAGE_LIST_NORMAL`, `wxIMAGE_LIST_SMALL`, `wxIMAGE_LIST_STATE` (the last is unimplemented).

This method does not take ownership of the image list, you have to delete it yourself.

See: `assignImageList/3`

# setItem(This, Info)

    -spec setItem(This, Info) -> boolean() when This :: wxListCtrl(), Info :: wxListItem:wxListItem().

Sets the data of an item.

Using the `wxListItem`'s mask and state mask, you can change only selected attributes of a `wxListCtrl` item.

Return: true if the item was successfully updated or false if the update failed for some reason (e.g. an invalid item index).

# setItem(This, Index, Column, Label)

    -spec setItem(This, Index, Column, Label) -> boolean()
                     when
                         This :: wxListCtrl(),
                         Index :: integer(),
                         Column :: integer(),
                         Label :: unicode:chardata().

Equivalent to `setItem(This, Index, Column, Label, [])`.

# setItem/5

    -spec setItem(This, Index, Column, Label, [Option]) -> boolean()
                     when
                         This :: wxListCtrl(),
                         Index :: integer(),
                         Column :: integer(),
                         Label :: unicode:chardata(),
                         Option :: {imageId, integer()}.

Sets an item string field at a particular column.

Return: true if the item was successfully updated or false if the update failed for some reason (e.g. an invalid item index).

# setItemBackgroundColour(This, Item, Col)

    -spec setItemBackgroundColour(This, Item, Col) -> ok
                                     when This :: wxListCtrl(), Item :: integer(), Col :: wx:wx_colour().

Sets the background colour for this item.

This function only works in report view mode. The colour can be retrieved using `getItemBackgroundColour/2`.

# setItemColumnImage(This, Item, Column, Image)

    -spec setItemColumnImage(This, Item, Column, Image) -> boolean()
                                when
                                    This :: wxListCtrl(),
                                    Item :: integer(),
                                    Column :: integer(),
                                    Image :: integer().

Sets the image associated with the item.

In report view, you can specify the column. The image is an index into the image list associated with the list control.

# setItemCount(This, Count)

    -spec setItemCount(This, Count) -> ok when This :: wxListCtrl(), Count :: integer().

This method can only be used with virtual list controls.

It is used to indicate to the control the number of items it contains. After calling it, the main program should be ready to handle calls to various item callbacks (such as `wxListCtrl::OnGetItemText` (not implemented in wx)) for all items in the range from 0 to `count`.

Notice that the control is not necessarily redrawn after this call as it may be undesirable if an item which is not visible on the screen anyhow was added to or removed from a control displaying many items, if you do need to refresh the display you can just call `wxWindow:refresh/2` manually.

# setItemData(This, Item, Data)

    -spec setItemData(This, Item, Data) -> boolean()
                         when This :: wxListCtrl(), Item :: integer(), Data :: integer().

Associates application-defined data with this item.

Notice that this function cannot be used to associate pointers with the control items, use `SetItemPtrData()` (not implemented in wx) instead.

# setItemFont(This, Item, Font)

    -spec setItemFont(This, Item, Font) -> ok
                         when This :: wxListCtrl(), Item :: integer(), Font :: wxFont:wxFont().

Sets the item's font.

# setItemImage(This, Item, Image)

    -spec setItemImage(This, Item, Image) -> boolean()
                          when This :: wxListCtrl(), Item :: integer(), Image :: integer().

Equivalent to `setItemImage(This, Item, Image, [])`.

# setItemImage/4

    -spec setItemImage(This, Item, Image, [Option]) -> boolean()
                          when
                              This :: wxListCtrl(),
                              Item :: integer(),
                              Image :: integer(),
                              Option :: {selImage, integer()}.

Sets the unselected and selected images associated with the item.

The images are indices into the image list associated with the list control.

# setItemPosition(This, Item, Pos)

    -spec setItemPosition(This, Item, Pos) -> boolean()
                             when
                                 This :: wxListCtrl(),
                                 Item :: integer(),
                                 Pos :: {X :: integer(), Y :: integer()}.

Sets the position of the item, in icon or small icon view.

Windows only.

# setItemState(This, Item, State, StateMask)

    -spec setItemState(This, Item, State, StateMask) -> boolean()
                          when
                              This :: wxListCtrl(),
                              Item :: integer(),
                              State :: integer(),
                              StateMask :: integer().

Sets the item state.

The `stateMask` is a combination of `wxLIST_STATE_XXX` constants described in `wxListItem` documentation. For each of the bits specified in `stateMask`, the corresponding state is set or cleared depending on whether `state` argument contains the same bit or not.

So to select an item you can use while to deselect it you should use

Consider using `wxListView` if possible to avoid dealing with this error-prone and confusing method.

Also notice that contrary to the usual rule that only user actions generate events, this method does generate wxEVT_LIST_ITEM_SELECTED event when it is used to select an item.

# setItemText(This, Item, Text)

    -spec setItemText(This, Item, Text) -> ok
                         when This :: wxListCtrl(), Item :: integer(), Text :: unicode:chardata().

Sets the item text for this item.

# setItemTextColour(This, Item, Col)

    -spec setItemTextColour(This, Item, Col) -> ok
                               when This :: wxListCtrl(), Item :: integer(), Col :: wx:wx_colour().

Sets the colour for this item.

This function only works in report view. The colour can be retrieved using `getItemTextColour/2`.

# setSingleStyle(This, Style)

    -spec setSingleStyle(This, Style) -> ok when This :: wxListCtrl(), Style :: integer().

Equivalent to `setSingleStyle(This, Style, [])`.

# setSingleStyle/3

    -spec setSingleStyle(This, Style, [Option]) -> ok
                            when This :: wxListCtrl(), Style :: integer(), Option :: {add, boolean()}.

Adds or removes a single window style.

# setTextColour(This, Col)

    -spec setTextColour(This, Col) -> ok when This :: wxListCtrl(), Col :: wx:wx_colour().

Sets the text colour of the list control.

# setWindowStyleFlag(This, Style)

    -spec setWindowStyleFlag(This, Style) -> ok when This :: wxListCtrl(), Style :: integer().

Sets the whole window style, deleting all items.

# sortItems(This, SortCallBack)

    -spec sortItems(This :: wxListCtrl(), SortCallBack) -> boolean()
                       when SortCallBack :: fun((integer(), integer()) -> integer()).