2008-03-08 13:52:38 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2008-11-26 19:11:22 +00:00
|
|
|
// Name: wx/listctrl.h
|
2008-03-10 15:24:38 +00:00
|
|
|
// Purpose: interface of wxListCtrl
|
2008-03-08 13:52:38 +00:00
|
|
|
// Author: wxWidgets team
|
2010-07-13 13:29:13 +00:00
|
|
|
// Licence: wxWindows licence
|
2008-03-08 13:52:38 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2012-03-27 17:28:56 +00:00
|
|
|
/// style flags
|
|
|
|
#define wxLC_VRULES 0x0001
|
|
|
|
#define wxLC_HRULES 0x0002
|
|
|
|
|
|
|
|
#define wxLC_ICON 0x0004
|
|
|
|
#define wxLC_SMALL_ICON 0x0008
|
|
|
|
#define wxLC_LIST 0x0010
|
|
|
|
#define wxLC_REPORT 0x0020
|
|
|
|
|
|
|
|
#define wxLC_ALIGN_TOP 0x0040
|
|
|
|
#define wxLC_ALIGN_LEFT 0x0080
|
|
|
|
#define wxLC_AUTOARRANGE 0x0100
|
|
|
|
#define wxLC_VIRTUAL 0x0200
|
|
|
|
#define wxLC_EDIT_LABELS 0x0400
|
|
|
|
#define wxLC_NO_HEADER 0x0800
|
|
|
|
#define wxLC_NO_SORT_HEADER 0x1000
|
|
|
|
#define wxLC_SINGLE_SEL 0x2000
|
|
|
|
#define wxLC_SORT_ASCENDING 0x4000
|
|
|
|
#define wxLC_SORT_DESCENDING 0x8000
|
|
|
|
|
|
|
|
#define wxLC_MASK_TYPE (wxLC_ICON | wxLC_SMALL_ICON | wxLC_LIST | wxLC_REPORT)
|
|
|
|
#define wxLC_MASK_ALIGN (wxLC_ALIGN_TOP | wxLC_ALIGN_LEFT)
|
|
|
|
#define wxLC_MASK_SORT (wxLC_SORT_ASCENDING | wxLC_SORT_DESCENDING)
|
|
|
|
|
|
|
|
|
|
|
|
/// Mask flags to tell app/GUI what fields of wxListItem are valid
|
|
|
|
#define wxLIST_MASK_STATE 0x0001
|
|
|
|
#define wxLIST_MASK_TEXT 0x0002
|
|
|
|
#define wxLIST_MASK_IMAGE 0x0004
|
|
|
|
#define wxLIST_MASK_DATA 0x0008
|
|
|
|
#define wxLIST_SET_ITEM 0x0010
|
|
|
|
#define wxLIST_MASK_WIDTH 0x0020
|
|
|
|
#define wxLIST_MASK_FORMAT 0x0040
|
|
|
|
|
|
|
|
/// State flags for indicating the state of an item
|
|
|
|
#define wxLIST_STATE_DONTCARE 0x0000
|
|
|
|
#define wxLIST_STATE_DROPHILITED 0x0001 // MSW only
|
|
|
|
#define wxLIST_STATE_FOCUSED 0x0002
|
|
|
|
#define wxLIST_STATE_SELECTED 0x0004
|
|
|
|
#define wxLIST_STATE_CUT 0x0008 // MSW only
|
|
|
|
#define wxLIST_STATE_DISABLED 0x0010 // OS2 only
|
|
|
|
#define wxLIST_STATE_FILTERED 0x0020 // OS2 only
|
|
|
|
#define wxLIST_STATE_INUSE 0x0040 // OS2 only
|
|
|
|
#define wxLIST_STATE_PICKED 0x0080 // OS2 only
|
|
|
|
#define wxLIST_STATE_SOURCE 0x0100 // OS2 only
|
|
|
|
|
|
|
|
/// Hit test flags, used in HitTest
|
|
|
|
#define wxLIST_HITTEST_ABOVE 0x0001 // Above the client area.
|
|
|
|
#define wxLIST_HITTEST_BELOW 0x0002 // Below the client area.
|
|
|
|
#define wxLIST_HITTEST_NOWHERE 0x0004 // In the client area but below the last item.
|
|
|
|
#define wxLIST_HITTEST_ONITEMICON 0x0020 // On the bitmap associated with an item.
|
|
|
|
#define wxLIST_HITTEST_ONITEMLABEL 0x0080 // On the label (string) associated with an item.
|
|
|
|
#define wxLIST_HITTEST_ONITEMRIGHT 0x0100 // In the area to the right of an item.
|
|
|
|
#define wxLIST_HITTEST_ONITEMSTATEICON 0x0200 // On the state icon for a tree view item that is in a user-defined state.
|
|
|
|
#define wxLIST_HITTEST_TOLEFT 0x0400 // To the left of the client area.
|
|
|
|
#define wxLIST_HITTEST_TORIGHT 0x0800 // To the right of the client area.
|
|
|
|
|
|
|
|
#define wxLIST_HITTEST_ONITEM (wxLIST_HITTEST_ONITEMICON | wxLIST_HITTEST_ONITEMLABEL | wxLIST_HITTEST_ONITEMSTATEICON)
|
|
|
|
|
|
|
|
/// GetSubItemRect constants
|
|
|
|
#define wxLIST_GETSUBITEMRECT_WHOLEITEM -1l
|
|
|
|
|
|
|
|
/// Flags for GetNextItem (MSW only except wxLIST_NEXT_ALL)
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
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
|
|
|
|
};
|
|
|
|
|
|
|
|
/// Alignment flags for Arrange (MSW only except wxLIST_ALIGN_LEFT)
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
wxLIST_ALIGN_DEFAULT,
|
|
|
|
wxLIST_ALIGN_LEFT,
|
|
|
|
wxLIST_ALIGN_TOP,
|
|
|
|
wxLIST_ALIGN_SNAP_TO_GRID
|
|
|
|
};
|
|
|
|
|
|
|
|
/// Column format (MSW only except wxLIST_FORMAT_LEFT)
|
|
|
|
enum wxListColumnFormat
|
|
|
|
{
|
|
|
|
wxLIST_FORMAT_LEFT,
|
|
|
|
wxLIST_FORMAT_RIGHT,
|
|
|
|
wxLIST_FORMAT_CENTRE,
|
|
|
|
wxLIST_FORMAT_CENTER = wxLIST_FORMAT_CENTRE
|
|
|
|
};
|
|
|
|
|
|
|
|
/// Autosize values for SetColumnWidth
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
wxLIST_AUTOSIZE = -1,
|
|
|
|
wxLIST_AUTOSIZE_USEHEADER = -2 // partly supported by generic version
|
|
|
|
};
|
|
|
|
|
|
|
|
/// Flag values for GetItemRect
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
wxLIST_RECT_BOUNDS,
|
|
|
|
wxLIST_RECT_ICON,
|
|
|
|
wxLIST_RECT_LABEL
|
|
|
|
};
|
|
|
|
|
|
|
|
/// Flag values for FindItem (MSW only)
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
wxLIST_FIND_UP,
|
|
|
|
wxLIST_FIND_DOWN,
|
|
|
|
wxLIST_FIND_LEFT,
|
|
|
|
wxLIST_FIND_RIGHT
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
/**
|
|
|
|
@class wxListCtrl
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
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 wxListCtrl::InsertItem method.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
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 to have controls with millions of items
|
|
|
|
without consuming much memory. To use virtual list control you must use
|
2010-04-16 12:47:31 +00:00
|
|
|
wxListCtrl::SetItemCount first and override at least wxListCtrl::OnGetItemText
|
2008-10-19 12:49:07 +00:00
|
|
|
(and optionally wxListCtrl::OnGetItemImage or wxListCtrl::OnGetItemColumnImage and
|
|
|
|
wxListCtrl::OnGetItemAttr) to return the information about the items when the
|
|
|
|
control requests it.
|
2009-01-28 00:36:55 +00:00
|
|
|
|
2008-10-19 12:49:07 +00:00
|
|
|
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.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
Using many of wxListCtrl features is shown in the
|
2008-10-19 12:49:07 +00:00
|
|
|
@ref page_samples_listctrl "corresponding sample".
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
To intercept events from a list control, use the event table macros described
|
|
|
|
in wxListEvent.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-10-19 12:49:07 +00:00
|
|
|
<b>wxMac Note</b>: 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
|
2009-01-28 00:36:55 +00:00
|
|
|
the @c mac.listctrl.always_use_generic system option (see wxSystemOptions) to 1.
|
2008-09-01 14:35:36 +00:00
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@beginStyleTable
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxLC_LIST}
|
2008-03-08 13:52:38 +00:00
|
|
|
Multicolumn list view, with optional small icons. Columns are
|
|
|
|
computed automatically, i.e. you don't set columns as in
|
2009-01-28 00:36:55 +00:00
|
|
|
@c wxLC_REPORT. In other words, the list wraps, unlike a wxListBox.
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxLC_REPORT}
|
2008-03-08 13:52:38 +00:00
|
|
|
Single or multicolumn report view, with optional header.
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxLC_VIRTUAL}
|
2008-03-08 13:52:38 +00:00
|
|
|
The application provides items text on demand. May only be used
|
2009-01-28 00:36:55 +00:00
|
|
|
with @c wxLC_REPORT.
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxLC_ICON}
|
2008-03-08 13:52:38 +00:00
|
|
|
Large icon view, with optional labels.
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxLC_SMALL_ICON}
|
2008-03-08 13:52:38 +00:00
|
|
|
Small icon view, with optional labels.
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxLC_ALIGN_TOP}
|
2008-03-08 13:52:38 +00:00
|
|
|
Icons align to the top. Win32 default, Win32 only.
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxLC_ALIGN_LEFT}
|
2008-03-08 13:52:38 +00:00
|
|
|
Icons align to the left.
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxLC_AUTOARRANGE}
|
2008-03-08 13:52:38 +00:00
|
|
|
Icons arrange themselves. Win32 only.
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxLC_EDIT_LABELS}
|
2008-03-08 13:52:38 +00:00
|
|
|
Labels are editable: the application will be notified when editing
|
|
|
|
starts.
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxLC_NO_HEADER}
|
2008-03-08 13:52:38 +00:00
|
|
|
No header in report mode.
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxLC_SINGLE_SEL}
|
2008-03-08 13:52:38 +00:00
|
|
|
Single selection (default is multiple).
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxLC_SORT_ASCENDING}
|
2008-06-14 14:04:26 +00:00
|
|
|
Sort in ascending order. (You must still supply a comparison callback
|
|
|
|
in wxListCtrl::SortItems.)
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxLC_SORT_DESCENDING}
|
2008-06-14 14:04:26 +00:00
|
|
|
Sort in descending order. (You must still supply a comparison callback
|
|
|
|
in wxListCtrl::SortItems.)
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxLC_HRULES}
|
2008-03-08 13:52:38 +00:00
|
|
|
Draws light horizontal rules between rows in report mode.
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxLC_VRULES}
|
2008-03-08 13:52:38 +00:00
|
|
|
Draws light vertical rules between columns in report mode.
|
|
|
|
@endStyleTable
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-09-01 14:35:36 +00:00
|
|
|
|
2009-02-18 17:58:51 +00:00
|
|
|
@beginEventEmissionTable{wxListEvent}
|
2008-09-01 14:35:36 +00:00
|
|
|
@event{EVT_LIST_BEGIN_DRAG(id, func)}
|
|
|
|
Begin dragging with the left mouse button.
|
2013-04-25 10:11:03 +00:00
|
|
|
Processes a @c wxEVT_LIST_BEGIN_DRAG event type.
|
2008-09-01 14:35:36 +00:00
|
|
|
@event{EVT_LIST_BEGIN_RDRAG(id, func)}
|
2010-08-22 22:16:05 +00:00
|
|
|
Begin dragging with the right mouse button.
|
2013-04-25 10:11:03 +00:00
|
|
|
Processes a @c wxEVT_LIST_BEGIN_RDRAG event type.
|
2010-08-22 22:16:05 +00:00
|
|
|
@event{EVT_BEGIN_LABEL_EDIT(id, func)}
|
2008-09-01 14:35:36 +00:00
|
|
|
Begin editing a label. This can be prevented by calling Veto().
|
2013-04-25 10:11:03 +00:00
|
|
|
Processes a @c wxEVT_LIST_BEGIN_LABEL_EDIT event type.
|
2008-09-01 14:35:36 +00:00
|
|
|
@event{EVT_LIST_END_LABEL_EDIT(id, func)}
|
|
|
|
Finish editing a label. This can be prevented by calling Veto().
|
2013-04-25 10:11:03 +00:00
|
|
|
Processes a @c wxEVT_LIST_END_LABEL_EDIT event type.
|
2008-09-01 14:35:36 +00:00
|
|
|
@event{EVT_LIST_DELETE_ITEM(id, func)}
|
|
|
|
An item was deleted.
|
2013-04-25 10:11:03 +00:00
|
|
|
Processes a @c wxEVT_LIST_DELETE_ITEM event type.
|
2008-09-01 14:35:36 +00:00
|
|
|
@event{EVT_LIST_DELETE_ALL_ITEMS(id, func)}
|
|
|
|
All items were deleted.
|
2013-04-25 10:11:03 +00:00
|
|
|
Processes a @c wxEVT_LIST_DELETE_ALL_ITEMS event type.
|
2008-09-01 14:35:36 +00:00
|
|
|
@event{EVT_LIST_ITEM_SELECTED(id, func)}
|
|
|
|
The item has been selected.
|
2013-04-25 10:11:03 +00:00
|
|
|
Processes a @c wxEVT_LIST_ITEM_SELECTED event type.
|
2008-09-01 14:35:36 +00:00
|
|
|
@event{EVT_LIST_ITEM_DESELECTED(id, func)}
|
|
|
|
The item has been deselected.
|
2013-04-25 10:11:03 +00:00
|
|
|
Processes a @c wxEVT_LIST_ITEM_DESELECTED event type.
|
2008-09-01 14:35:36 +00:00
|
|
|
@event{EVT_LIST_ITEM_ACTIVATED(id, func)}
|
|
|
|
The item has been activated (ENTER or double click).
|
2013-04-25 10:11:03 +00:00
|
|
|
Processes a @c wxEVT_LIST_ITEM_ACTIVATED event type.
|
2008-09-01 14:35:36 +00:00
|
|
|
@event{EVT_LIST_ITEM_FOCUSED(id, func)}
|
|
|
|
The currently focused item has changed.
|
2013-04-25 10:11:03 +00:00
|
|
|
Processes a @c wxEVT_LIST_ITEM_FOCUSED event type.
|
2008-09-01 14:35:36 +00:00
|
|
|
@event{EVT_LIST_ITEM_MIDDLE_CLICK(id, func)}
|
2010-08-22 22:16:05 +00:00
|
|
|
The middle mouse button has been clicked on an item. This is
|
|
|
|
only supported by the generic control.
|
2013-04-25 10:11:03 +00:00
|
|
|
Processes a @c wxEVT_LIST_ITEM_MIDDLE_CLICK event type.
|
2008-09-01 14:35:36 +00:00
|
|
|
@event{EVT_LIST_ITEM_RIGHT_CLICK(id, func)}
|
2008-10-19 12:49:07 +00:00
|
|
|
The right mouse button has been clicked on an item.
|
2013-04-25 10:11:03 +00:00
|
|
|
Processes a @c wxEVT_LIST_ITEM_RIGHT_CLICK event type.
|
2008-09-01 14:35:36 +00:00
|
|
|
@event{EVT_LIST_KEY_DOWN(id, func)}
|
|
|
|
A key has been pressed.
|
2013-04-25 10:11:03 +00:00
|
|
|
Processes a @c wxEVT_LIST_KEY_DOWN event type.
|
2008-09-01 14:35:36 +00:00
|
|
|
@event{EVT_LIST_INSERT_ITEM(id, func)}
|
|
|
|
An item has been inserted.
|
2013-04-25 10:11:03 +00:00
|
|
|
Processes a @c wxEVT_LIST_INSERT_ITEM event type.
|
2008-09-01 14:35:36 +00:00
|
|
|
@event{EVT_LIST_COL_CLICK(id, func)}
|
|
|
|
A column (m_col) has been left-clicked.
|
2013-04-25 10:11:03 +00:00
|
|
|
Processes a @c wxEVT_LIST_COL_CLICK event type.
|
2008-09-01 14:35:36 +00:00
|
|
|
@event{EVT_LIST_COL_RIGHT_CLICK(id, func)}
|
|
|
|
A column (m_col) has been right-clicked.
|
2013-04-25 10:11:03 +00:00
|
|
|
Processes a @c wxEVT_LIST_COL_RIGHT_CLICK event type.
|
2008-09-01 14:35:36 +00:00
|
|
|
@event{EVT_LIST_COL_BEGIN_DRAG(id, func)}
|
|
|
|
The user started resizing a column - can be vetoed.
|
2013-04-25 10:11:03 +00:00
|
|
|
Processes a @c wxEVT_LIST_COL_BEGIN_DRAG event type.
|
2008-09-01 14:35:36 +00:00
|
|
|
@event{EVT_LIST_COL_DRAGGING(id, func)}
|
|
|
|
The divider between columns is being dragged.
|
2013-04-25 10:11:03 +00:00
|
|
|
Processes a @c wxEVT_LIST_COL_DRAGGING event type.
|
2008-09-01 14:35:36 +00:00
|
|
|
@event{EVT_LIST_COL_END_DRAG(id, func)}
|
|
|
|
A column has been resized by the user.
|
2013-04-25 10:11:03 +00:00
|
|
|
Processes a @c wxEVT_LIST_COL_END_DRAG event type.
|
2008-09-01 14:35:36 +00:00
|
|
|
@event{EVT_LIST_CACHE_HINT(id, func)}
|
|
|
|
Prepare cache for a virtual list control.
|
2013-04-25 10:11:03 +00:00
|
|
|
Processes a @c wxEVT_LIST_CACHE_HINT event type.
|
2008-09-01 14:35:36 +00:00
|
|
|
@endEventTable
|
|
|
|
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@library{wxcore}
|
|
|
|
@category{ctrl}
|
2012-11-03 18:32:50 +00:00
|
|
|
@appearance{listctrl}
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-10-19 12:49:07 +00:00
|
|
|
@see @ref overview_listctrl, wxListView, wxListBox, wxTreeCtrl, wxImageList,
|
|
|
|
wxListEvent, wxListItem, wxEditableListBox
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
class wxListCtrl : public wxControl
|
|
|
|
{
|
|
|
|
public:
|
2008-06-14 14:04:26 +00:00
|
|
|
/**
|
2008-08-31 08:05:29 +00:00
|
|
|
Default constructor.
|
2008-06-14 14:04:26 +00:00
|
|
|
*/
|
|
|
|
wxListCtrl();
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
/**
|
|
|
|
Constructor, creating and showing a list control.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param parent
|
2008-03-09 12:33:59 +00:00
|
|
|
Parent window. Must not be @NULL.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param id
|
2008-03-09 12:33:59 +00:00
|
|
|
Window identifier. The value wxID_ANY indicates a default value.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param pos
|
2008-03-09 12:33:59 +00:00
|
|
|
Window position.
|
2009-04-21 11:21:36 +00:00
|
|
|
If ::wxDefaultPosition is specified then a default position is chosen.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param size
|
2008-10-19 12:49:07 +00:00
|
|
|
Window size.
|
2009-04-21 11:21:36 +00:00
|
|
|
If ::wxDefaultSize is specified then the window is sized appropriately.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param style
|
2008-03-09 12:33:59 +00:00
|
|
|
Window style. See wxListCtrl.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param validator
|
2008-03-09 12:33:59 +00:00
|
|
|
Window validator.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param name
|
2008-03-09 12:33:59 +00:00
|
|
|
Window name.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
@see Create(), wxValidator
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-08 14:43:31 +00:00
|
|
|
wxListCtrl(wxWindow* parent, wxWindowID id,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxLC_ICON,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxListCtrlNameStr);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Destructor, destroying the list control.
|
|
|
|
*/
|
2008-09-27 11:21:10 +00:00
|
|
|
virtual ~wxListCtrl();
|
2008-03-08 13:52:38 +00:00
|
|
|
|
2012-01-07 15:09:47 +00:00
|
|
|
/**
|
|
|
|
Adds a new column to the list control in report view mode.
|
|
|
|
|
|
|
|
This is just a convenient wrapper for InsertColumn() which adds the new
|
|
|
|
column after all the existing ones without having to specify its
|
|
|
|
position explicitly.
|
|
|
|
|
|
|
|
@since 2.9.4
|
|
|
|
*/
|
|
|
|
long AppendColumn(const wxString& heading,
|
2013-06-29 12:52:11 +00:00
|
|
|
wxListColumnFormat format = wxLIST_FORMAT_LEFT,
|
2012-01-07 15:09:47 +00:00
|
|
|
int width = -1);
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
Arranges the items in icon or small icon view.
|
|
|
|
This only has effect on Win32. @a flag is one of:
|
2008-08-31 08:05:29 +00:00
|
|
|
- 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.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
bool Arrange(int flag = wxLIST_ALIGN_DEFAULT);
|
|
|
|
|
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
Sets the image list associated with the control and takes ownership of it
|
|
|
|
(i.e. the control will, unlike when using SetImageList(), delete the list
|
|
|
|
when destroyed). @a which is one of @c wxIMAGE_LIST_NORMAL, @c wxIMAGE_LIST_SMALL,
|
|
|
|
@c wxIMAGE_LIST_STATE (the last is unimplemented).
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
@see SetImageList()
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
void AssignImageList(wxImageList* imageList, int which);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Deletes all items and all columns.
|
2010-08-22 22:16:05 +00:00
|
|
|
|
2013-04-25 10:11:03 +00:00
|
|
|
@note This sends an event of type @c wxEVT_LIST_DELETE_ALL_ITEMS
|
2010-08-22 22:16:05 +00:00
|
|
|
under all platforms.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
void ClearAll();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Creates the list control. See wxListCtrl() for further details.
|
|
|
|
*/
|
|
|
|
bool Create(wxWindow* parent, wxWindowID id,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxLC_ICON,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxListCtrlNameStr);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Deletes all items in the list control.
|
2008-10-19 12:49:07 +00:00
|
|
|
|
2013-04-25 10:11:03 +00:00
|
|
|
This function does @e not send the @c wxEVT_LIST_DELETE_ITEM
|
2010-08-22 22:15:17 +00:00
|
|
|
event because deleting many items from the control would be too slow
|
|
|
|
then (unlike wxListCtrl::DeleteItem) but it does send the special @c
|
2013-04-25 10:11:03 +00:00
|
|
|
wxEVT_LIST_DELETE_ALL_ITEMS event if the control was not empty.
|
2010-08-22 22:15:17 +00:00
|
|
|
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.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
bool DeleteAllItems();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Deletes a column.
|
|
|
|
*/
|
|
|
|
bool DeleteColumn(int col);
|
|
|
|
|
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
Deletes the specified item.
|
2013-04-25 10:11:03 +00:00
|
|
|
This function sends the @c wxEVT_LIST_DELETE_ITEM event for the
|
2008-10-19 12:49:07 +00:00
|
|
|
item being deleted.
|
|
|
|
|
|
|
|
@see DeleteAllItems()
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
bool DeleteItem(long item);
|
|
|
|
|
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
Starts editing the label of the given item.
|
|
|
|
|
|
|
|
This function generates a @c EVT_LIST_BEGIN_LABEL_EDIT event which can be
|
|
|
|
vetoed so that no text control will appear for in-place editing.
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
If the user changed the label (i.e. s/he does not press ESC or leave
|
2008-10-19 12:49:07 +00:00
|
|
|
the text control without changes, a @c EVT_LIST_END_LABEL_EDIT event
|
2008-03-08 13:52:38 +00:00
|
|
|
will be sent which can be vetoed as well.
|
|
|
|
*/
|
2008-10-29 15:34:31 +00:00
|
|
|
wxTextCtrl* EditLabel(long item,
|
2010-06-09 13:55:48 +00:00
|
|
|
wxClassInfo* textControlClass = wxCLASSINFO(wxTextCtrl));
|
2008-03-08 13:52:38 +00:00
|
|
|
|
2012-12-22 02:33:23 +00:00
|
|
|
/**
|
|
|
|
Enable alternating row background colours (also called zebra striping).
|
|
|
|
|
|
|
|
This method can only be called for the control in virtual report mode,
|
|
|
|
i.e. having ::wxLC_REPORT and ::wxLC_VIRTUAL styles.
|
|
|
|
|
|
|
|
When enabling alternating colours, the appropriate colour for the even
|
|
|
|
rows is chosen automatically depending on the default foreground and
|
|
|
|
background colours which are used for the odd rows.
|
|
|
|
|
|
|
|
@param enable
|
|
|
|
If @true, enable alternating row background colours, i.e. different
|
|
|
|
colours for the odd and even rows. If @false, disable this feature
|
|
|
|
and use the same background colour for all rows.
|
|
|
|
|
|
|
|
@since 2.9.5
|
|
|
|
|
|
|
|
@see SetAlternateRowColour()
|
|
|
|
*/
|
|
|
|
void EnableAlternateRowColours(bool enable = true);
|
|
|
|
|
2012-10-07 22:42:27 +00:00
|
|
|
/**
|
|
|
|
Enable or disable a beep if there is no match for the currently
|
|
|
|
entered text when searching for the item from keyboard.
|
|
|
|
|
|
|
|
The default is to not beep in this case except in wxMSW where the
|
|
|
|
beep is always generated by the native control and cannot be disabled,
|
|
|
|
i.e. calls to this function do nothing there.
|
|
|
|
|
|
|
|
@since 2.9.5
|
|
|
|
*/
|
2012-10-11 22:29:35 +00:00
|
|
|
void EnableBellOnNoMatch(bool on = true);
|
2012-10-07 22:42:27 +00:00
|
|
|
|
2010-05-20 22:04:03 +00:00
|
|
|
/**
|
|
|
|
Finish editing the label.
|
|
|
|
|
|
|
|
This method allows to programmatically end editing a list control item
|
|
|
|
in place. Usually it will only be called when editing is in progress,
|
2010-05-21 13:17:25 +00:00
|
|
|
i.e. if GetEditControl() returns non-NULL. In particular, do not call
|
|
|
|
it from EVT_LIST_BEGIN_LABEL_EDIT handler as the edit control is not
|
|
|
|
yet fully created by then, just veto the event in this handler instead
|
|
|
|
to prevent the editing from even starting.
|
|
|
|
|
|
|
|
Notice that calling this method will result in EVT_LIST_END_LABEL_EDIT
|
|
|
|
event being generated.
|
2010-05-20 22:04:03 +00:00
|
|
|
|
|
|
|
Currently only implemented in wxMSW.
|
|
|
|
|
|
|
|
@param cancel If @true, discard the changes made by user, as if @c
|
|
|
|
Escape key was pressed. Otherwise, accept the changes as if @c
|
|
|
|
Return was pressed.
|
|
|
|
@return @true if item editing wad finished or @false if no item as
|
|
|
|
being edited.
|
|
|
|
*/
|
|
|
|
bool EndEditLabel(bool cancel);
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
/**
|
|
|
|
Ensures this item is visible.
|
|
|
|
*/
|
|
|
|
bool EnsureVisible(long item);
|
|
|
|
|
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
Find an item whose label matches this string, starting from start or the
|
|
|
|
beginning if start is @c -1. The string comparison is case insensitive.
|
|
|
|
|
|
|
|
If @a partial is @true then this method will look for items which begin with @a str.
|
2009-12-07 15:26:31 +00:00
|
|
|
|
|
|
|
@return The next matching item if any or @c -1 (wxNOT_FOUND) otherwise.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
long FindItem(long start, const wxString& str,
|
2008-03-09 12:33:59 +00:00
|
|
|
bool partial = false);
|
2008-10-19 12:49:07 +00:00
|
|
|
|
2008-08-31 08:05:29 +00:00
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
Find an item whose data matches this data, starting from start or the
|
|
|
|
beginning if 'start' is @c -1.
|
2009-10-18 17:47:01 +00:00
|
|
|
|
|
|
|
@beginWxPerlOnly
|
|
|
|
In wxPerl this method is implemented as FindItemData(start, data).
|
|
|
|
@endWxPerlOnly
|
2009-12-07 15:26:31 +00:00
|
|
|
|
|
|
|
@return The next matching item if any or @c -1 (wxNOT_FOUND) otherwise.
|
2008-08-31 08:05:29 +00:00
|
|
|
*/
|
2008-11-10 21:33:25 +00:00
|
|
|
long FindItem(long start, wxUIntPtr data);
|
2008-10-19 12:49:07 +00:00
|
|
|
|
2008-08-31 08:05:29 +00:00
|
|
|
/**
|
|
|
|
Find an item nearest this position in the specified direction,
|
|
|
|
starting from @a start or the beginning if @a start is -1.
|
2009-10-18 17:47:01 +00:00
|
|
|
|
|
|
|
@beginWxPerlOnly
|
|
|
|
In wxPerl this method is implemented as FindItemAtPos(start, pt, direction).
|
|
|
|
@endWxPerlOnly
|
2009-12-07 15:26:31 +00:00
|
|
|
|
|
|
|
@return The next matching item if any or @c -1 (wxNOT_FOUND) otherwise.
|
2008-08-31 08:05:29 +00:00
|
|
|
*/
|
2008-03-08 14:43:31 +00:00
|
|
|
long FindItem(long start, const wxPoint& pt, int direction);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
Gets information about this column.
|
|
|
|
See SetItem() for more information.
|
2009-10-18 17:47:01 +00:00
|
|
|
|
|
|
|
@beginWxPerlOnly
|
|
|
|
In wxPerl this method takes only the @a col parameter and
|
|
|
|
returns a @c Wx::ListItem (or @c undef).
|
|
|
|
@endWxPerlOnly
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool GetColumn(int col, wxListItem& item) const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the number of columns.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
int GetColumnCount() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-11-26 19:11:22 +00:00
|
|
|
Gets the column index from its position in visual order.
|
|
|
|
|
|
|
|
After calling SetColumnsOrder(), the index returned by this function
|
|
|
|
corresponds to the value of the element number @a pos in the array
|
|
|
|
returned by GetColumnsOrder().
|
|
|
|
|
|
|
|
Please see SetColumnsOrder() documentation for an example and
|
|
|
|
additional remarks about the columns ordering.
|
|
|
|
|
|
|
|
@see GetColumnOrder()
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-11-26 19:11:22 +00:00
|
|
|
int GetColumnIndexFromOrder(int pos) const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-11-26 19:11:22 +00:00
|
|
|
Gets the column visual order position.
|
|
|
|
|
|
|
|
This function returns the index of the column which appears at the
|
|
|
|
given visual position, e.g. calling it with @a col equal to 0 returns
|
|
|
|
the index of the first shown column.
|
|
|
|
|
|
|
|
Please see SetColumnsOrder() documentation for an example and
|
|
|
|
additional remarks about the columns ordering.
|
|
|
|
|
|
|
|
@see GetColumnsOrder(), GetColumnIndexFromOrder()
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
int GetColumnOrder(int col) const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Gets the column width (report view only).
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
int GetColumnWidth(int col) const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
Returns the array containing the orders of all columns.
|
2008-11-26 19:11:22 +00:00
|
|
|
|
2008-10-19 12:49:07 +00:00
|
|
|
On error, an empty array is returned.
|
2008-11-26 19:11:22 +00:00
|
|
|
|
|
|
|
Please see SetColumnsOrder() documentation for an example and
|
|
|
|
additional remarks about the columns ordering.
|
|
|
|
|
|
|
|
@see GetColumnOrder(), GetColumnIndexFromOrder()
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
wxArrayInt GetColumnsOrder() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
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).
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
int GetCountPerPage() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
Returns the edit control being currently used to edit a label.
|
|
|
|
Returns @NULL if no label is being edited.
|
|
|
|
|
2008-03-28 16:19:12 +00:00
|
|
|
@note It is currently only implemented for wxMSW and the generic version,
|
2008-10-19 12:49:07 +00:00
|
|
|
not for the native Mac OS X version.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
wxTextCtrl* GetEditControl() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-03-09 12:33:59 +00:00
|
|
|
Returns the specified image list. @a which may be one of:
|
2008-08-31 08:05:29 +00:00
|
|
|
- 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).
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
wxImageList* GetImageList(int which) const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
Gets information about the item. See SetItem() for more information.
|
2008-11-22 13:42:42 +00:00
|
|
|
|
|
|
|
You must call @e info.SetId() to set the ID of item you're interested in
|
|
|
|
before calling this method, and @e info.SetMask() with the flags indicating
|
|
|
|
what fields you need to retrieve from @a info.
|
2009-10-18 17:47:01 +00:00
|
|
|
|
|
|
|
@beginWxPerlOnly
|
|
|
|
In wxPerl this method takes as parameter the ID of the item
|
|
|
|
and (optionally) the column, and returns a Wx::ListItem object.
|
|
|
|
@endWxPerlOnly
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool GetItem(wxListItem& info) const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
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).
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
@see GetItemTextColour()
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
wxColour GetItemBackgroundColour(long item) const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the number of items in the list control.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
int GetItemCount() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Gets the application-defined data associated with this item.
|
|
|
|
*/
|
2008-10-29 15:34:31 +00:00
|
|
|
wxUIntPtr GetItemData(long item) const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the item's font.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
wxFont GetItemFont(long item) const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the position of the item, in icon or small icon view.
|
2009-10-18 17:47:01 +00:00
|
|
|
|
|
|
|
@beginWxPerlOnly
|
|
|
|
In wxPerl this method takes only the @a item parameter and
|
|
|
|
returns a @c Wx::Point (or @c undef).
|
|
|
|
@endWxPerlOnly
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool GetItemPosition(long item, wxPoint& pos) const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the rectangle representing the item's size and position, in physical
|
|
|
|
coordinates.
|
2008-10-19 12:49:07 +00:00
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
@a code is one of wxLIST_RECT_BOUNDS, wxLIST_RECT_ICON, wxLIST_RECT_LABEL.
|
2009-10-18 17:47:01 +00:00
|
|
|
|
|
|
|
@beginWxPerlOnly
|
|
|
|
In wxPerl this method takes only the @a item and @a code parameters and
|
|
|
|
returns a @c Wx::Rect (or @c undef).
|
|
|
|
@endWxPerlOnly
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
bool GetItemRect(long item, wxRect& rect,
|
2008-03-09 16:24:26 +00:00
|
|
|
int code = wxLIST_RECT_BOUNDS) const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
Retrieves the spacing between icons in pixels: horizontal spacing is
|
|
|
|
returned as @c x component of the wxSize object and the vertical spacing
|
|
|
|
as its @c y component.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
wxSize GetItemSpacing() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Gets the item state. For a list of state flags, see SetItem().
|
2008-10-19 12:49:07 +00:00
|
|
|
The @a stateMask indicates which state flags are of interest.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
int GetItemState(long item, long stateMask) const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Gets the item text for this item.
|
2010-05-10 21:22:16 +00:00
|
|
|
|
|
|
|
@param item
|
|
|
|
Item (zero-based) index.
|
|
|
|
@param col
|
|
|
|
Item column (zero-based) index. Column 0 is the default. This
|
|
|
|
parameter is new in wxWidgets 2.9.1.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2010-05-10 21:22:16 +00:00
|
|
|
wxString GetItemText(long item, int col = 0) const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
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).
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
wxColour GetItemTextColour(long item) const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Searches for an item with the given geometry or state, starting from
|
2008-10-19 12:49:07 +00:00
|
|
|
@a item but excluding the @a item itself.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-10-19 12:49:07 +00:00
|
|
|
If @a item is -1, the first item that matches the specified flags will be returned.
|
|
|
|
Returns the first item with given state following @a item or -1 if no such item found.
|
|
|
|
This function may be used to find all selected items in the control like this:
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-10-19 12:49:07 +00:00
|
|
|
@code
|
|
|
|
long item = -1;
|
|
|
|
for ( ;; )
|
|
|
|
{
|
|
|
|
item = listctrl->GetNextItem(item,
|
|
|
|
wxLIST_NEXT_ALL,
|
|
|
|
wxLIST_STATE_SELECTED);
|
|
|
|
if ( item == -1 )
|
|
|
|
break;
|
|
|
|
|
|
|
|
// this item is selected - do whatever is needed with it
|
|
|
|
wxLogMessage("Item %ld is selected.", item);
|
|
|
|
}
|
|
|
|
@endcode
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-10-19 12:49:07 +00:00
|
|
|
@a 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.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-28 16:19:12 +00:00
|
|
|
@note this parameter is only supported by wxMSW currently and ignored on
|
2008-10-19 12:49:07 +00:00
|
|
|
other platforms.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-10-19 12:49:07 +00:00
|
|
|
@a 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.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
long GetNextItem(long item, int geometry = wxLIST_NEXT_ALL,
|
2008-03-09 16:24:26 +00:00
|
|
|
int state = wxLIST_STATE_DONTCARE) const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the number of selected items in the list control.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
int GetSelectedItemCount() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the rectangle representing the size and position, in physical
|
2008-03-09 12:33:59 +00:00
|
|
|
coordinates, of the given subitem, i.e. the part of the row @a item in the
|
2008-10-19 12:49:07 +00:00
|
|
|
column @a subItem.
|
|
|
|
|
2011-04-03 20:31:32 +00:00
|
|
|
This method is only meaningful when the wxListCtrl is in the report mode.
|
2008-10-19 12:49:07 +00:00
|
|
|
If @a subItem parameter is equal to the special value
|
2008-03-08 13:52:38 +00:00
|
|
|
@c wxLIST_GETSUBITEMRECT_WHOLEITEM the return value is the same as
|
|
|
|
for GetItemRect().
|
2008-10-19 12:49:07 +00:00
|
|
|
|
|
|
|
@a code can be one of @c wxLIST_RECT_BOUNDS, @c wxLIST_RECT_ICON or
|
|
|
|
@c wxLIST_RECT_LABEL.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-04-21 10:34:23 +00:00
|
|
|
@since 2.7.0
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
bool GetSubItemRect(long item, long subItem, wxRect& rect,
|
2008-03-09 16:24:26 +00:00
|
|
|
int code = wxLIST_RECT_BOUNDS) const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Gets the text colour of the list control.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
wxColour GetTextColour() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
Gets the index of the topmost visible item when in list or report view.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
long GetTopItem() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
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.
|
2008-10-19 12:49:07 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
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).
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
wxRect GetViewRect() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
2012-12-22 02:33:23 +00:00
|
|
|
/**
|
|
|
|
Set the alternative row background colour to a specific colour.
|
|
|
|
|
|
|
|
It is recommended to call EnableAlternateRowColours() instead of using
|
|
|
|
these methods as native implementations of this control might support
|
|
|
|
alternating row colours but not setting the exact colour to be used for
|
|
|
|
them.
|
|
|
|
|
|
|
|
As EnableAlternateRowColours(), this method can only be used with
|
|
|
|
controls having ::wxLC_REPORT and ::wxLC_VIRTUAL styles.
|
|
|
|
|
|
|
|
@param colour
|
|
|
|
A valid alternative row background colour to enable alternating
|
|
|
|
rows or invalid colour to disable them and use the same colour for
|
|
|
|
all rows.
|
|
|
|
|
|
|
|
@since 2.9.5
|
|
|
|
*/
|
|
|
|
void SetAlternateRowColour(const wxColour& colour);
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
Determines which item (if any) is at the specified point, giving details
|
|
|
|
in @a flags. Returns index of the item or @c wxNOT_FOUND if no item is at
|
|
|
|
the specified point.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-10-19 12:49:07 +00:00
|
|
|
@a flags will be a combination of the following flags:
|
|
|
|
- wxLIST_HITTEST_ABOVE: Above the client area.
|
|
|
|
- wxLIST_HITTEST_BELOW: Below the client area.
|
|
|
|
- wxLIST_HITTEST_NOWHERE: In the client area but below the last item.
|
|
|
|
- wxLIST_HITTEST_ONITEMICON: On the bitmap associated with an item.
|
|
|
|
- wxLIST_HITTEST_ONITEMLABEL: On the label (string) associated with an item.
|
|
|
|
- wxLIST_HITTEST_ONITEMRIGHT: In the area to the right of an item.
|
|
|
|
- wxLIST_HITTEST_ONITEMSTATEICON: On the state icon for a tree view item
|
|
|
|
that is in a user-defined state.
|
|
|
|
- wxLIST_HITTEST_TOLEFT: To the right of the client area.
|
|
|
|
- wxLIST_HITTEST_TORIGHT: To the left of the client area.
|
|
|
|
- wxLIST_HITTEST_ONITEM: Combination of @c wxLIST_HITTEST_ONITEMICON,
|
|
|
|
@c wxLIST_HITTEST_ONITEMLABEL, @c wxLIST_HITTEST_ONITEMSTATEICON.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
If @a ptrSubItem is not @NULL and the wxListCtrl is in the report
|
2008-03-08 14:43:31 +00:00
|
|
|
mode the subitem (or column) number will also be provided.
|
2008-03-08 13:52:38 +00:00
|
|
|
This feature is only available in version 2.7.0 or higher and is currently only
|
2013-10-26 18:51:16 +00:00
|
|
|
implemented under wxMSW and requires at least comctl32.dll of version 4.70 on
|
2008-10-19 12:49:07 +00:00
|
|
|
the host system or the value stored in @a ptrSubItem will be always -1.
|
|
|
|
To compile this feature into wxWidgets library you need to have access to
|
2008-03-08 13:52:38 +00:00
|
|
|
commctrl.h of version 4.70 that is provided by Microsoft.
|
2009-10-18 17:47:01 +00:00
|
|
|
|
|
|
|
@beginWxPerlOnly
|
|
|
|
In wxPerl this method only takes the @a point parameter
|
|
|
|
and returns a 2-element list (item, flags).
|
|
|
|
@endWxPerlOnly
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-10-29 15:34:31 +00:00
|
|
|
long HitTest(const wxPoint& point, int& flags, long* ptrSubItem = NULL) const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
2011-12-21 13:07:18 +00:00
|
|
|
/**
|
|
|
|
Returns true if the control is currently using ::wxLC_REPORT style.
|
|
|
|
*/
|
|
|
|
bool InReportView() const;
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
/**
|
2012-01-07 15:09:51 +00:00
|
|
|
For report view mode (only), inserts a column.
|
|
|
|
|
|
|
|
For more details, see SetItem(). Also see InsertColumn(long, const
|
|
|
|
wxString&, int, int) overload for a usually more convenient
|
|
|
|
alternative to this method and the description of how the item width
|
|
|
|
is interpreted by this method.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2012-01-07 15:09:51 +00:00
|
|
|
long InsertColumn(long col, const wxListItem& info);
|
2008-10-19 12:49:07 +00:00
|
|
|
|
2008-08-31 08:05:29 +00:00
|
|
|
/**
|
2012-01-07 15:09:51 +00:00
|
|
|
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
|
|
|
|
Insert(long, const wxListItem&) overload and specify ::wxLIST_MASK_IMAGE
|
|
|
|
in the item mask.
|
|
|
|
|
|
|
|
@param col
|
|
|
|
The index where the column should be inserted. Valid indices are
|
|
|
|
from 0 up to GetColumnCount() inclusive and the latter can be used
|
|
|
|
to append the new column after the last existing one.
|
|
|
|
@param heading
|
|
|
|
The string specifying the column heading.
|
|
|
|
@param format
|
|
|
|
The flags specifying the control heading text alignment.
|
|
|
|
@param width
|
|
|
|
If positive, the width of the column in pixels. Otherwise it can be
|
|
|
|
@c wxLIST_AUTOSIZE to choose the default size for the column or @c
|
|
|
|
wxLIST_AUTOSIZE_USEHEADER to fit the column width to @a heading or
|
|
|
|
to extend to fill all the remaining space for the last column.
|
|
|
|
Notice that in case of @c wxLIST_AUTOSIZE fixed width is used as
|
|
|
|
there are no items in this column to use for determining its best
|
|
|
|
size yet. If you want to fit the column to its contents, use
|
|
|
|
SetColumnWidth() after adding the items with values in this column.
|
|
|
|
@return
|
|
|
|
The index of the inserted column or -1 if adding it failed.
|
2008-08-31 08:05:29 +00:00
|
|
|
*/
|
2008-03-08 14:43:31 +00:00
|
|
|
long InsertColumn(long col, const wxString& heading,
|
|
|
|
int format = wxLIST_FORMAT_LEFT,
|
2012-01-07 15:09:51 +00:00
|
|
|
int width = wxLIST_AUTOSIZE);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
Inserts an item, returning the index of the new item if successful, -1 otherwise.
|
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param info
|
2008-03-09 12:33:59 +00:00
|
|
|
wxListItem object
|
2008-06-14 14:04:26 +00:00
|
|
|
*/
|
|
|
|
long InsertItem(wxListItem& info);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Insert an string item.
|
2008-10-19 12:49:07 +00:00
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param index
|
2008-03-09 12:33:59 +00:00
|
|
|
Index of the new item, supplied by the application
|
2008-03-08 14:43:31 +00:00
|
|
|
@param label
|
2008-03-09 12:33:59 +00:00
|
|
|
String label
|
2009-10-18 17:47:01 +00:00
|
|
|
|
|
|
|
@beginWxPerlOnly
|
|
|
|
In wxPerl this method is implemented as InsertStringItem(index, label).
|
|
|
|
@endWxPerlOnly
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-08 14:43:31 +00:00
|
|
|
long InsertItem(long index, const wxString& label);
|
2008-10-19 12:49:07 +00:00
|
|
|
|
2008-06-14 14:04:26 +00:00
|
|
|
/**
|
|
|
|
Insert an image item.
|
2008-10-19 12:49:07 +00:00
|
|
|
|
2008-06-14 14:04:26 +00:00
|
|
|
@param index
|
|
|
|
Index of the new item, supplied by the application
|
|
|
|
@param imageIndex
|
|
|
|
Index into the image list associated with this control and view style
|
2009-10-18 17:47:01 +00:00
|
|
|
|
|
|
|
@beginWxPerlOnly
|
|
|
|
In wxPerl this method is implemented as InsertImageItem(index, imageIndex).
|
|
|
|
@endWxPerlOnly
|
2008-10-19 12:49:07 +00:00
|
|
|
*/
|
2008-03-08 14:43:31 +00:00
|
|
|
long InsertItem(long index, int imageIndex);
|
2008-10-19 12:49:07 +00:00
|
|
|
|
2008-06-14 14:04:26 +00:00
|
|
|
/**
|
|
|
|
Insert an image/string item.
|
2008-10-19 12:49:07 +00:00
|
|
|
|
2008-06-14 14:04:26 +00:00
|
|
|
@param index
|
|
|
|
Index of the new item, supplied by the application
|
|
|
|
@param label
|
|
|
|
String label
|
|
|
|
@param imageIndex
|
|
|
|
Index into the image list associated with this control and view style
|
2009-10-18 17:47:01 +00:00
|
|
|
|
|
|
|
@beginWxPerlOnly
|
|
|
|
In wxPerl this method is implemented as InsertImageStringItem(index, label, imageIndex).
|
|
|
|
@endWxPerlOnly
|
2008-10-19 12:49:07 +00:00
|
|
|
*/
|
2008-03-08 14:43:31 +00:00
|
|
|
long InsertItem(long index, const wxString& label,
|
|
|
|
int imageIndex);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
2011-12-21 13:07:18 +00:00
|
|
|
/**
|
|
|
|
Returns true if the control is currently in virtual report view.
|
|
|
|
*/
|
|
|
|
bool IsVirtual() const;
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
Redraws the given @e 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.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
@see RefreshItems()
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
void RefreshItem(long item);
|
|
|
|
|
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
Redraws the items between @a itemFrom and @e itemTo.
|
|
|
|
The starting item must be less than or equal to the ending one.
|
|
|
|
|
|
|
|
Just as RefreshItem() this is only useful for virtual list controls.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
void RefreshItems(long itemFrom, long itemTo);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Scrolls the list control. If in icon, small icon or report view mode,
|
2008-03-09 12:33:59 +00:00
|
|
|
@a dx specifies the number of pixels to scroll. If in list view mode,
|
|
|
|
@a dx specifies the number of columns to scroll. @a dy always specifies
|
2008-03-08 13:52:38 +00:00
|
|
|
the number of pixels to scroll vertically.
|
2008-10-19 12:49:07 +00:00
|
|
|
|
2008-03-28 16:19:12 +00:00
|
|
|
@note This method is currently only implemented in the Windows version.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
bool ScrollList(int dx, int dy);
|
|
|
|
|
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
Sets the background colour.
|
|
|
|
|
|
|
|
Note that the wxWindow::GetBackgroundColour() function of wxWindow base
|
|
|
|
class can be used to retrieve the current background colour.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-10-29 15:34:31 +00:00
|
|
|
virtual bool SetBackgroundColour(const wxColour& col);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
Sets information about this column.
|
|
|
|
See SetItem() for more information.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
bool SetColumn(int col, wxListItem& item);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the column width.
|
2008-10-19 12:49:07 +00:00
|
|
|
|
|
|
|
@a width can be a width in pixels or @c wxLIST_AUTOSIZE (-1) or
|
|
|
|
@c wxLIST_AUTOSIZE_USEHEADER (-2).
|
|
|
|
|
|
|
|
@c wxLIST_AUTOSIZE will resize the column to the length of its longest item.
|
|
|
|
|
|
|
|
@c wxLIST_AUTOSIZE_USEHEADER will resize the column to the length of the
|
|
|
|
header (Win32) or 80 pixels (other platforms).
|
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
In small or normal icon view, @a col must be -1, and the column width is set
|
2008-03-08 13:52:38 +00:00
|
|
|
for all columns.
|
|
|
|
*/
|
|
|
|
bool SetColumnWidth(int col, int width);
|
|
|
|
|
|
|
|
/**
|
2008-11-26 19:11:22 +00:00
|
|
|
Changes the order in which the columns are shown.
|
|
|
|
|
|
|
|
By default, the columns of a list control appear on the screen in order
|
|
|
|
of their indices, i.e. the column 0 appears first, the column 1 next
|
|
|
|
and so on. However by using this function it is possible to arbitrarily
|
|
|
|
reorder the columns visual order and the user can also rearrange the
|
|
|
|
columns interactively by dragging them. In this case, the index of the
|
|
|
|
column is not the same as its order and the functions GetColumnOrder()
|
|
|
|
and GetColumnIndexFromOrder() should be used to translate between them.
|
|
|
|
Notice that all the other functions still work with the column indices,
|
|
|
|
i.e. the visual positioning of the columns on screen doesn't affect the
|
|
|
|
code setting or getting their values for example.
|
2008-10-19 12:49:07 +00:00
|
|
|
|
|
|
|
The @a orders array must have the same number elements as the number of
|
2008-11-26 19:11:22 +00:00
|
|
|
columns and contain each position exactly once. Its n-th element
|
|
|
|
contains the index of the column to be shown in n-th position, so for a
|
|
|
|
control with three columns passing an array with elements 2, 0 and 1
|
|
|
|
results in the third column being displayed first, the first one next
|
|
|
|
and the second one last.
|
|
|
|
|
|
|
|
Example of using it:
|
|
|
|
@code
|
|
|
|
wxListCtrl *list = new wxListCtrl(...);
|
|
|
|
for ( int i = 0; i < 3; i++ )
|
|
|
|
list->InsertColumn(i, wxString::Format("Column %d", i));
|
|
|
|
|
|
|
|
wxArrayInt order(3);
|
|
|
|
order[0] = 2;
|
|
|
|
order[1] = 0;
|
|
|
|
order[2] = 1;
|
|
|
|
list->SetColumnsOrder(order);
|
|
|
|
|
|
|
|
// now list->GetColumnsOrder() will return order and
|
|
|
|
// list->GetColumnIndexFromOrder(n) will return order[n] and
|
|
|
|
// list->GetColumnOrder() will return 1, 2 and 0 for the column 0,
|
|
|
|
// 1 and 2 respectively
|
|
|
|
@endcode
|
|
|
|
|
|
|
|
Please notice that this function makes sense for report view only and
|
|
|
|
currently is only implemented in wxMSW port. To avoid explicit tests
|
|
|
|
for @c __WXMSW__ in your code, please use @c wxHAS_LISTCTRL_COLUMN_ORDER
|
|
|
|
as this will allow it to start working under the other platforms when
|
|
|
|
support for the column reordering is added there.
|
2008-10-19 12:49:07 +00:00
|
|
|
|
2008-11-26 19:11:22 +00:00
|
|
|
@see GetColumnsOrder()
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2012-02-15 00:35:58 +00:00
|
|
|
bool SetColumnsOrder(const wxArrayInt& orders);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
Sets the image list associated with the control.
|
|
|
|
|
|
|
|
@a which is one of @c wxIMAGE_LIST_NORMAL, @c wxIMAGE_LIST_SMALL,
|
|
|
|
@c wxIMAGE_LIST_STATE (the last is unimplemented).
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
This method does not take ownership of the image list, you have to
|
|
|
|
delete it yourself.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
@see AssignImageList()
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
void SetImageList(wxImageList* imageList, int which);
|
|
|
|
|
|
|
|
/**
|
2008-08-31 08:05:29 +00:00
|
|
|
Sets the data of an item.
|
2008-10-19 12:49:07 +00:00
|
|
|
|
|
|
|
Using the wxListItem's mask and state mask, you can change only selected
|
|
|
|
attributes of a wxListCtrl item.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
bool SetItem(wxListItem& info);
|
2008-10-19 12:49:07 +00:00
|
|
|
|
2008-08-31 08:05:29 +00:00
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
Sets an item string field at a particular column.
|
2008-08-31 08:05:29 +00:00
|
|
|
*/
|
2008-10-19 12:49:07 +00:00
|
|
|
long SetItem(long index, int column, const wxString& label, int imageId = -1);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
Sets the background colour for this item.
|
|
|
|
This function only works in report view mode.
|
|
|
|
The colour can be retrieved using GetItemBackgroundColour().
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
void SetItemBackgroundColour(long item, const wxColour& col);
|
|
|
|
|
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
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.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
bool SetItemColumnImage(long item, long column, int image);
|
|
|
|
|
|
|
|
/**
|
2008-05-30 01:07:29 +00:00
|
|
|
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) for all
|
|
|
|
items in the range from 0 to @a 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 Refresh() manually.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
void SetItemCount(long count);
|
|
|
|
|
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
Associates application-defined data with this item.
|
|
|
|
|
|
|
|
Notice that this function cannot be used to associate pointers with the control
|
|
|
|
items, use SetItemPtrData() instead.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
bool SetItemData(long item, long data);
|
|
|
|
|
|
|
|
/**
|
2008-08-31 08:05:29 +00:00
|
|
|
Sets the item's font.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
void SetItemFont(long item, const wxFont& font);
|
|
|
|
|
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
Sets the unselected and selected images associated with the item.
|
|
|
|
The images are indices into the image list associated with the list control.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-10-29 15:34:31 +00:00
|
|
|
bool SetItemImage(long item, int image, int selImage = -1);
|
2008-10-19 12:49:07 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the position of the item, in icon or small icon view. Windows only.
|
|
|
|
*/
|
|
|
|
bool SetItemPosition(long item, const wxPoint& pos);
|
|
|
|
|
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
Associates application-defined data with this item.
|
|
|
|
|
|
|
|
The @a data parameter may be either an integer or a pointer cast to the
|
|
|
|
@c wxUIntPtr type which is guaranteed to be large enough to be able to
|
|
|
|
contain all integer types and pointers.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-04-21 10:34:23 +00:00
|
|
|
@since 2.8.4
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
bool SetItemPtrData(long item, wxUIntPtr data);
|
|
|
|
|
|
|
|
/**
|
2012-03-15 23:24:41 +00:00
|
|
|
Sets the item state.
|
|
|
|
|
|
|
|
The @a stateMask is a combination of @c wxLIST_STATE_XXX constants
|
|
|
|
described in wxListItem documentation. For each of the bits specified
|
|
|
|
in @a stateMask, the corresponding state is set or cleared depending on
|
|
|
|
whether @a state argument contains the same bit or not.
|
|
|
|
|
|
|
|
So to select an item you can use
|
|
|
|
@code
|
|
|
|
list->SetItemState(item, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
|
|
|
|
@endcode
|
|
|
|
while to deselect it you should use
|
|
|
|
@code
|
|
|
|
list->SetItemState(item, 0, wxLIST_STATE_SELECTED);
|
|
|
|
@endcode
|
|
|
|
|
|
|
|
Consider using wxListView if possible to avoid dealing with this
|
|
|
|
error-prone and confusing method.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
bool SetItemState(long item, long state, long stateMask);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the item text for this item.
|
|
|
|
*/
|
|
|
|
void SetItemText(long item, const wxString& text);
|
|
|
|
|
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
Sets the colour for this item.
|
|
|
|
This function only works in report view.
|
|
|
|
The colour can be retrieved using GetItemTextColour().
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
void SetItemTextColour(long item, const wxColour& col);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Adds or removes a single window style.
|
|
|
|
*/
|
2008-03-09 12:33:59 +00:00
|
|
|
void SetSingleStyle(long style, bool add = true);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the text colour of the list control.
|
|
|
|
*/
|
|
|
|
void SetTextColour(const wxColour& col);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the whole window style, deleting all items.
|
|
|
|
*/
|
|
|
|
void SetWindowStyleFlag(long style);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Call this function to sort the items in the list control. Sorting is done
|
2008-03-09 12:33:59 +00:00
|
|
|
using the specified @a fnSortCallBack function. This function must have the
|
2008-03-08 13:52:38 +00:00
|
|
|
following prototype:
|
2008-10-19 12:49:07 +00:00
|
|
|
@code
|
2011-05-13 13:30:03 +00:00
|
|
|
int wxCALLBACK wxListCompareFunction(wxIntPtr item1, wxIntPtr item2, wxIntPtr sortData)
|
2008-10-19 12:49:07 +00:00
|
|
|
@endcode
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
It is called each time when the two items must be compared and should return 0
|
|
|
|
if the items are equal, negative value if the first item is less than the
|
|
|
|
second one and positive value if the first one is greater than the second one
|
|
|
|
(the same convention as used by @c qsort(3)).
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-10-19 12:49:07 +00:00
|
|
|
The parameter @e item1 is the client data associated with the first item (NOT the index).
|
|
|
|
The parameter @e item2 is the client data associated with the second item (NOT the index).
|
|
|
|
The parameter @e data is the value passed to SortItems() itself.
|
|
|
|
|
|
|
|
Notice that the control may only be sorted on client data associated with
|
|
|
|
the items, so you must use SetItemData if you want to be able to sort the
|
|
|
|
items in the control.
|
|
|
|
|
|
|
|
Please see the @ref page_samples_listctrl for an example of using this function.
|
2009-10-18 17:47:01 +00:00
|
|
|
|
|
|
|
@beginWxPerlOnly
|
|
|
|
In wxPerl the comparison function must take just two parameters;
|
|
|
|
however, you may use a closure to achieve an effect similar to the
|
|
|
|
SortItems third parameter.
|
|
|
|
@endWxPerlOnly
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2009-04-16 13:00:40 +00:00
|
|
|
bool SortItems(wxListCtrlCompare fnSortCallBack, wxIntPtr data);
|
2008-10-29 18:55:57 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
/**
|
2010-04-16 12:47:31 +00:00
|
|
|
This function may be overridden in the derived class for a control with
|
2008-10-29 18:55:57 +00:00
|
|
|
@c wxLC_VIRTUAL style. It should return the attribute for the specified
|
|
|
|
@c item or @NULL to use the default appearance parameters.
|
|
|
|
|
|
|
|
wxListCtrl will not delete the pointer or keep a reference of it.
|
|
|
|
You can return the same wxListItemAttr pointer for every OnGetItemAttr() call.
|
|
|
|
|
|
|
|
The base class version always returns @NULL.
|
|
|
|
|
2009-01-25 13:27:48 +00:00
|
|
|
@see OnGetItemImage(), OnGetItemColumnImage(), OnGetItemText(),
|
|
|
|
OnGetItemColumnAttr()
|
2008-10-29 18:55:57 +00:00
|
|
|
*/
|
|
|
|
virtual wxListItemAttr* OnGetItemAttr(long item) const;
|
|
|
|
|
2009-01-25 13:27:48 +00:00
|
|
|
/**
|
|
|
|
This function may be overridden in the derived class for a control with
|
|
|
|
@c wxLC_VIRTUAL style.
|
|
|
|
|
|
|
|
It should return the attribute for the for the specified @a item and @a
|
|
|
|
column or @NULL to use the default appearance parameters.
|
|
|
|
|
|
|
|
The base class version returns @c OnGetItemAttr(item).
|
|
|
|
|
|
|
|
@note Currently this function is only called under wxMSW, the other
|
|
|
|
ports only support OnGetItemAttr()
|
|
|
|
|
|
|
|
@see OnGetItemAttr(), OnGetItemText(),
|
|
|
|
OnGetItemImage(), OnGetItemColumnImage(),
|
|
|
|
*/
|
|
|
|
virtual wxListItemAttr* OnGetItemColumnAttr(long item, long column) const;
|
|
|
|
|
2008-10-29 18:55:57 +00:00
|
|
|
/**
|
2010-04-16 12:47:31 +00:00
|
|
|
Override this function in the derived class for a control with
|
2008-10-29 18:55:57 +00:00
|
|
|
@c wxLC_VIRTUAL and @c wxLC_REPORT styles in order to specify the image
|
|
|
|
index for the given line and column.
|
|
|
|
|
|
|
|
The base class version always calls OnGetItemImage() for the first column, else
|
|
|
|
it returns -1.
|
|
|
|
|
2009-01-25 13:27:48 +00:00
|
|
|
@see OnGetItemText(), OnGetItemImage(), OnGetItemAttr(),
|
|
|
|
OnGetItemColumnAttr()
|
2008-10-29 18:55:57 +00:00
|
|
|
*/
|
|
|
|
virtual int OnGetItemColumnImage(long item, long column) const;
|
|
|
|
|
|
|
|
/**
|
2010-04-16 12:47:31 +00:00
|
|
|
This function must be overridden in the derived class for a control with
|
2008-12-12 16:10:08 +00:00
|
|
|
@c wxLC_VIRTUAL style having an "image list" (see SetImageList(); if the
|
2010-04-16 12:47:31 +00:00
|
|
|
control doesn't have an image list, it is not necessary to override it).
|
2008-10-29 18:55:57 +00:00
|
|
|
It should return the index of the items image in the controls image list
|
|
|
|
or -1 for no image.
|
|
|
|
|
|
|
|
In a control with @c wxLC_REPORT style, OnGetItemImage() only gets called for
|
|
|
|
the first column of each line.
|
|
|
|
|
|
|
|
The base class version always returns -1.
|
|
|
|
|
|
|
|
@see OnGetItemText(), OnGetItemColumnImage(), OnGetItemAttr()
|
|
|
|
*/
|
|
|
|
virtual int OnGetItemImage(long item) const;
|
|
|
|
|
|
|
|
/**
|
2010-04-16 12:47:31 +00:00
|
|
|
This function @b must be overridden in the derived class for a control with
|
2008-10-29 18:55:57 +00:00
|
|
|
@c wxLC_VIRTUAL style. It should return the string containing the text of
|
|
|
|
the given @a column for the specified @c item.
|
|
|
|
|
|
|
|
@see SetItemCount(), OnGetItemImage(), OnGetItemColumnImage(), OnGetItemAttr()
|
|
|
|
*/
|
|
|
|
virtual wxString OnGetItemText(long item, long column) const;
|
2008-03-08 13:52:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-10 15:24:38 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
/**
|
|
|
|
@class wxListEvent
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
A list event holds information about events associated with wxListCtrl objects.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-10-19 12:49:07 +00:00
|
|
|
@beginEventTable{wxListEvent}
|
|
|
|
@event{EVT_LIST_BEGIN_DRAG(id, func)}
|
|
|
|
Begin dragging with the left mouse button.
|
|
|
|
@event{EVT_LIST_BEGIN_RDRAG(id, func)}
|
|
|
|
Begin dragging with the right mouse button.
|
|
|
|
@event{EVT_LIST_BEGIN_LABEL_EDIT(id, func)}
|
|
|
|
Begin editing a label. This can be prevented by calling Veto().
|
|
|
|
@event{EVT_LIST_END_LABEL_EDIT(id, func)}
|
|
|
|
Finish editing a label. This can be prevented by calling Veto().
|
|
|
|
@event{EVT_LIST_DELETE_ITEM(id, func)}
|
|
|
|
Delete an item.
|
|
|
|
@event{EVT_LIST_DELETE_ALL_ITEMS(id, func)}
|
|
|
|
Delete all items.
|
|
|
|
@event{EVT_LIST_ITEM_SELECTED(id, func)}
|
|
|
|
The item has been selected.
|
|
|
|
@event{EVT_LIST_ITEM_DESELECTED(id, func)}
|
|
|
|
The item has been deselected.
|
|
|
|
@event{EVT_LIST_ITEM_ACTIVATED(id, func)}
|
|
|
|
The item has been activated (ENTER or double click).
|
|
|
|
@event{EVT_LIST_ITEM_FOCUSED(id, func)}
|
|
|
|
The currently focused item has changed.
|
|
|
|
@event{EVT_LIST_ITEM_MIDDLE_CLICK(id, func)}
|
|
|
|
The middle mouse button has been clicked on an item.
|
|
|
|
@event{EVT_LIST_ITEM_RIGHT_CLICK(id, func)}
|
|
|
|
The right mouse button has been clicked on an item.
|
|
|
|
@event{EVT_LIST_KEY_DOWN(id, func)}
|
2010-09-22 08:48:15 +00:00
|
|
|
A key has been pressed. GetIndex() may be -1 if no item is selected.
|
2008-10-19 12:49:07 +00:00
|
|
|
@event{EVT_LIST_INSERT_ITEM(id, func)}
|
|
|
|
An item has been inserted.
|
|
|
|
@event{EVT_LIST_COL_CLICK(id, func)}
|
|
|
|
A column (m_col) has been left-clicked.
|
|
|
|
@event{EVT_LIST_COL_RIGHT_CLICK(id, func)}
|
|
|
|
A column (m_col) (which can be -1 if the click occurred outside any column)
|
|
|
|
has been right-clicked.
|
|
|
|
@event{EVT_LIST_COL_BEGIN_DRAG(id, func)}
|
|
|
|
The user started resizing a column - can be vetoed.
|
|
|
|
@event{EVT_LIST_COL_DRAGGING(id, func)}
|
|
|
|
The divider between columns is being dragged.
|
|
|
|
@event{EVT_LIST_COL_END_DRAG(id, func)}
|
|
|
|
A column has been resized by the user.
|
|
|
|
@event{EVT_LIST_CACHE_HINT(id, func)}
|
|
|
|
Prepare cache for a virtual list control
|
|
|
|
@endEventTable
|
|
|
|
|
|
|
|
|
2012-10-15 01:17:21 +00:00
|
|
|
@library{wxcore}
|
2008-03-08 13:52:38 +00:00
|
|
|
@category{events}
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-10 15:24:38 +00:00
|
|
|
@see wxListCtrl
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
class wxListEvent : public wxNotifyEvent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Constructor.
|
|
|
|
*/
|
2008-11-10 21:33:25 +00:00
|
|
|
wxListEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
For @c EVT_LIST_CACHE_HINT event only: return the first item which the
|
|
|
|
list control advises us to cache.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
long GetCacheFrom() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
For @c EVT_LIST_CACHE_HINT event only: return the last item (inclusive)
|
|
|
|
which the list control advises us to cache.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
long GetCacheTo() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
The column position: it is only used with @c COL events.
|
|
|
|
|
|
|
|
For the column dragging events, it is the column to the left of the divider
|
|
|
|
being dragged, for the column click events it may be -1 if the user clicked
|
|
|
|
in the list control header outside any column.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
int GetColumn() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
The data.
|
|
|
|
*/
|
2013-11-12 18:06:37 +00:00
|
|
|
wxUIntPtr GetData() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
The image.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
int GetImage() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
The item index.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
long GetIndex() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
An item object, used by some events. See also wxListCtrl::SetItem.
|
|
|
|
*/
|
2008-10-29 15:34:31 +00:00
|
|
|
const wxListItem& GetItem() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Key code if the event is a keypress event.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
int GetKeyCode() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
The (new) item label for @c EVT_LIST_END_LABEL_EDIT event.
|
|
|
|
*/
|
2008-10-29 15:34:31 +00:00
|
|
|
const wxString& GetLabel() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
The mask.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
long GetMask() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
The position of the mouse pointer if the event is a drag event.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
wxPoint GetPoint() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
The text.
|
|
|
|
*/
|
2008-10-29 15:34:31 +00:00
|
|
|
const wxString& GetText() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
This method only makes sense for @c EVT_LIST_END_LABEL_EDIT message and
|
|
|
|
returns @true if it the label editing has been cancelled by the user
|
|
|
|
(GetLabel() returns an empty string in this case but it doesn't allow the
|
|
|
|
application to distinguish between really cancelling the edit and the
|
|
|
|
admittedly rare case when the user wants to rename it to an empty string).
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool IsEditCancelled() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-04-25 10:11:03 +00:00
|
|
|
wxEventType wxEVT_LIST_BEGIN_DRAG;
|
|
|
|
wxEventType wxEVT_LIST_BEGIN_RDRAG;
|
|
|
|
wxEventType wxEVT_LIST_BEGIN_LABEL_EDIT;
|
|
|
|
wxEventType wxEVT_LIST_END_LABEL_EDIT;
|
|
|
|
wxEventType wxEVT_LIST_DELETE_ITEM;
|
|
|
|
wxEventType wxEVT_LIST_DELETE_ALL_ITEMS;
|
|
|
|
wxEventType wxEVT_LIST_ITEM_SELECTED;
|
|
|
|
wxEventType wxEVT_LIST_ITEM_DESELECTED;
|
|
|
|
wxEventType wxEVT_LIST_KEY_DOWN;
|
|
|
|
wxEventType wxEVT_LIST_INSERT_ITEM;
|
|
|
|
wxEventType wxEVT_LIST_COL_CLICK;
|
|
|
|
wxEventType wxEVT_LIST_ITEM_RIGHT_CLICK;
|
|
|
|
wxEventType wxEVT_LIST_ITEM_MIDDLE_CLICK;
|
|
|
|
wxEventType wxEVT_LIST_ITEM_ACTIVATED;
|
|
|
|
wxEventType wxEVT_LIST_CACHE_HINT;
|
|
|
|
wxEventType wxEVT_LIST_COL_RIGHT_CLICK;
|
|
|
|
wxEventType wxEVT_LIST_COL_BEGIN_DRAG;
|
|
|
|
wxEventType wxEVT_LIST_COL_DRAGGING;
|
|
|
|
wxEventType wxEVT_LIST_COL_END_DRAG;
|
|
|
|
wxEventType wxEVT_LIST_ITEM_FOCUSED;
|
2012-03-27 17:28:56 +00:00
|
|
|
|
2008-03-10 15:24:38 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
/**
|
|
|
|
@class wxListItemAttr
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-10-19 12:49:07 +00:00
|
|
|
Represents the attributes (color, font, ...) of a wxListCtrl's wxListItem.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2012-10-15 01:17:21 +00:00
|
|
|
@library{wxcore}
|
2009-02-20 11:34:52 +00:00
|
|
|
@category{data}
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-10-19 12:49:07 +00:00
|
|
|
@see @ref overview_listctrl, wxListCtrl, wxListItem
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-08 14:43:31 +00:00
|
|
|
class wxListItemAttr
|
2008-03-08 13:52:38 +00:00
|
|
|
{
|
|
|
|
public:
|
2008-08-31 08:05:29 +00:00
|
|
|
/**
|
|
|
|
Default Constructor.
|
|
|
|
*/
|
|
|
|
wxListItemAttr();
|
2008-10-19 12:49:07 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
/**
|
|
|
|
Construct a wxListItemAttr with the specified foreground and
|
|
|
|
background colors and font.
|
|
|
|
*/
|
2008-11-10 21:33:25 +00:00
|
|
|
wxListItemAttr(const wxColour& colText,
|
|
|
|
const wxColour& colBack,
|
|
|
|
const wxFont& font);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the currently set background color.
|
|
|
|
*/
|
2008-10-19 12:49:07 +00:00
|
|
|
const wxColour& GetBackgroundColour() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the currently set font.
|
|
|
|
*/
|
2008-10-19 12:49:07 +00:00
|
|
|
const wxFont& GetFont() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the currently set text color.
|
|
|
|
*/
|
2008-10-19 12:49:07 +00:00
|
|
|
const wxColour& GetTextColour() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the currently set background color is valid.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool HasBackgroundColour() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the currently set font is valid.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool HasFont() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the currently set text color is valid.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool HasTextColour() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets a new background color.
|
|
|
|
*/
|
|
|
|
void SetBackgroundColour(const wxColour& colour);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets a new font.
|
|
|
|
*/
|
|
|
|
void SetFont(const wxFont& font);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets a new text color.
|
|
|
|
*/
|
|
|
|
void SetTextColour(const wxColour& colour);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-10 15:24:38 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
/**
|
|
|
|
@class wxListView
|
2008-03-08 14:43:31 +00:00
|
|
|
|
|
|
|
This class currently simply presents a simpler to use interface for the
|
2008-10-19 12:49:07 +00:00
|
|
|
wxListCtrl -- it can be thought of as a @e façade for that complicated class.
|
|
|
|
|
|
|
|
Using it is preferable to using wxListCtrl directly whenever possible because
|
|
|
|
in the future some ports might implement wxListView but not the full set of
|
|
|
|
wxListCtrl features.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-10-19 12:49:07 +00:00
|
|
|
Other than different interface, this class is identical to wxListCtrl.
|
|
|
|
In particular, it uses the same events, same window styles and so on.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@library{wxcore}
|
|
|
|
@category{ctrl}
|
2013-10-01 13:03:20 +00:00
|
|
|
@appearance{listctrl}
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-10 15:24:38 +00:00
|
|
|
@see wxListView::SetColumnImage
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
class wxListView : public wxListCtrl
|
|
|
|
{
|
|
|
|
public:
|
2013-12-29 03:22:33 +00:00
|
|
|
/**
|
|
|
|
Default constructor.
|
|
|
|
*/
|
|
|
|
wxListView();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Constructor, creating and showing a listview control.
|
|
|
|
|
|
|
|
@param parent
|
|
|
|
Parent window. Must not be @NULL.
|
|
|
|
@param id
|
|
|
|
Window identifier. The value wxID_ANY indicates a default value.
|
|
|
|
@param pos
|
|
|
|
Window position.
|
|
|
|
If ::wxDefaultPosition is specified then a default position is chosen.
|
|
|
|
@param size
|
|
|
|
Window size.
|
|
|
|
If ::wxDefaultSize is specified then the window is sized appropriately.
|
|
|
|
@param style
|
|
|
|
Window style. See wxListCtrl.
|
|
|
|
@param validator
|
|
|
|
Window validator.
|
|
|
|
@param name
|
|
|
|
Window name.
|
|
|
|
|
|
|
|
@see Create(), wxValidator
|
|
|
|
*/
|
|
|
|
wxListView(wxWindow* parent, wxWindowID id,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxLC_ICON,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxListCtrlNameStr);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Destructor, destroying the listview control.
|
|
|
|
*/
|
|
|
|
virtual ~wxListView();
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
/**
|
|
|
|
Resets the column image -- after calling this function, no image will be shown.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param col
|
2008-03-09 12:33:59 +00:00
|
|
|
the column to clear image for
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
@see SetColumnImage()
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
void ClearColumnImage(int col);
|
|
|
|
|
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
Sets focus to the item with the given @a index.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
void Focus(long index);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the first selected item in a (presumably) multiple selection control.
|
2008-10-19 12:49:07 +00:00
|
|
|
Together with GetNextSelected() it can be used to iterate over all selected
|
|
|
|
items in the control.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-05-11 01:38:53 +00:00
|
|
|
@return The first selected item, if any, -1 otherwise.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
long GetFirstSelected() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the currently focused item or -1 if none.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
@see IsSelected(), Focus()
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
long GetFocusedItem() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
Used together with GetFirstSelected() to iterate over all selected items
|
|
|
|
in the control.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-10-19 12:49:07 +00:00
|
|
|
@return Returns the next selected item or -1 if there are no more of them.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
long GetNextSelected(long item) const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-03-09 12:33:59 +00:00
|
|
|
Returns @true if the item with the given @a index is selected,
|
2008-03-08 13:52:38 +00:00
|
|
|
@false otherwise.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
@see GetFirstSelected(), GetNextSelected()
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool IsSelected(long index) const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Selects or unselects the given item.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param n
|
2008-03-09 12:33:59 +00:00
|
|
|
the item to select or unselect
|
2008-03-08 14:43:31 +00:00
|
|
|
@param on
|
2008-03-09 12:33:59 +00:00
|
|
|
if @true (default), selects the item, otherwise unselects it
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
@see wxListCtrl::SetItemState
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-08-30 12:44:43 +00:00
|
|
|
void Select(long n, bool on = true);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
Sets the column image for the specified column.
|
|
|
|
To use the column images, the control must have a valid image list with
|
|
|
|
at least one image.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param col
|
2008-03-09 12:33:59 +00:00
|
|
|
the column to set image for
|
2008-03-08 14:43:31 +00:00
|
|
|
@param image
|
2008-03-09 12:33:59 +00:00
|
|
|
the index of the column image in the controls image list
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
void SetColumnImage(int col, int image);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-10 15:24:38 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
/**
|
|
|
|
@class wxListItem
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
This class stores information about a wxListCtrl item or column.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2013-10-26 18:51:16 +00:00
|
|
|
wxListItem is a class which contains information about:
|
2008-10-19 12:49:07 +00:00
|
|
|
- Zero based item position; see SetId() and GetId().
|
|
|
|
- Zero based column index; see SetColumn() and GetColumn().
|
|
|
|
- The label (or header for columns); see SetText() and GetText().
|
|
|
|
- The zero based index into an image list; see GetImage() and SetImage().
|
|
|
|
- Application defined data; see SetData() and GetData().
|
|
|
|
- For columns only: the width of the column; see SetWidth() and GetWidth().
|
|
|
|
- For columns only: the format of the column; one of @c wxLIST_FORMAT_LEFT,
|
|
|
|
@c wxLIST_FORMAT_RIGHT, @c wxLIST_FORMAT_CENTRE. See SetAlign() and GetAlign().
|
|
|
|
- The state of the item; see SetState() and GetState().
|
|
|
|
This is a bitlist of the following flags:
|
|
|
|
- @c wxLIST_STATE_FOCUSED: The item has the focus.
|
|
|
|
- @c wxLIST_STATE_SELECTED: The item is selected.
|
|
|
|
- @c wxLIST_STATE_DONTCARE: Don't care what the state is. Win32 only.
|
|
|
|
- @c wxLIST_STATE_DROPHILITED: The item is highlighted to receive a drop event. Win32 only.
|
|
|
|
- @c wxLIST_STATE_CUT: The item is in the cut state. Win32 only.
|
|
|
|
- A mask indicating which state flags are valid; this is a bitlist of the
|
|
|
|
flags reported above for the item state. See SetStateMask() and GetStateMask().
|
|
|
|
- A mask indicating which fields of this class are valid; see SetMask() and GetMask().
|
|
|
|
This is a bitlist of the following flags:
|
|
|
|
- @c wxLIST_MASK_STATE: The state field is valid.
|
|
|
|
- @c wxLIST_MASK_TEXT: The label field is valid.
|
|
|
|
- @c wxLIST_MASK_IMAGE: The image field is valid.
|
|
|
|
- @c wxLIST_MASK_DATA: The application-defined data field is valid.
|
|
|
|
- @c wxLIST_MASK_WIDTH: The column width field is valid.
|
|
|
|
- @c wxLIST_MASK_FORMAT: The column format field is valid.
|
|
|
|
|
|
|
|
The wxListItem object can also contain item-specific colour and font
|
|
|
|
information: for this you need to call one of SetTextColour(), SetBackgroundColour()
|
|
|
|
or SetFont() functions on it passing it the colour/font to use.
|
|
|
|
If the colour/font is not specified, the default list control colour/font is used.
|
|
|
|
|
2012-10-15 01:17:21 +00:00
|
|
|
@library{wxcore}
|
2009-02-20 11:34:52 +00:00
|
|
|
@category{data}
|
2008-10-19 12:49:07 +00:00
|
|
|
|
|
|
|
@see wxListCtrl
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
class wxListItem : public wxObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Constructor.
|
|
|
|
*/
|
|
|
|
wxListItem();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Resets the item state to the default.
|
|
|
|
*/
|
|
|
|
void Clear();
|
|
|
|
|
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
Returns the alignment for this item.
|
|
|
|
Can be one of @c wxLIST_FORMAT_LEFT, @c wxLIST_FORMAT_RIGHT or @c wxLIST_FORMAT_CENTRE.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
wxListColumnFormat GetAlign() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the background colour for this item.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
wxColour GetBackgroundColour() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the zero-based column; meaningful only in report mode.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
int GetColumn() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
Returns client data associated with the control.
|
|
|
|
Please note that client data is associated with the item and not with subitems.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-10-29 15:34:31 +00:00
|
|
|
wxUIntPtr GetData() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the font used to display the item.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
wxFont GetFont() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the zero-based item position.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
long GetId() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
Returns the zero-based index of the image associated with the item into
|
|
|
|
the image list.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
int GetImage() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
Returns a bit mask indicating which fields of the structure are valid.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-10-19 12:49:07 +00:00
|
|
|
Can be any combination of the following values:
|
|
|
|
- wxLIST_MASK_STATE: @b GetState is valid.
|
|
|
|
- wxLIST_MASK_TEXT: @b GetText is valid.
|
|
|
|
- wxLIST_MASK_IMAGE: @b GetImage is valid.
|
|
|
|
- wxLIST_MASK_DATA: @b GetData is valid.
|
|
|
|
- wxLIST_MASK_WIDTH: @b GetWidth is valid.
|
|
|
|
- wxLIST_MASK_FORMAT: @b GetFormat is valid.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
long GetMask() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
Returns a bit field representing the state of the item.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-10-19 12:49:07 +00:00
|
|
|
Can be any combination of:
|
|
|
|
- wxLIST_STATE_DONTCARE: Don't care what the state is. Win32 only.
|
|
|
|
- wxLIST_STATE_DROPHILITED: The item is highlighted to receive a drop event. Win32 only.
|
|
|
|
- wxLIST_STATE_FOCUSED: The item has the focus.
|
|
|
|
- wxLIST_STATE_SELECTED: The item is selected.
|
|
|
|
- wxLIST_STATE_CUT: The item is in the cut state. Win32 only.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
long GetState() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the label/header text.
|
|
|
|
*/
|
2008-10-19 12:49:07 +00:00
|
|
|
const wxString& GetText() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the text colour.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
wxColour GetTextColour() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Meaningful only for column headers in report mode. Returns the column width.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
int GetWidth() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
Sets the alignment for the item. See also GetAlign()
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
void SetAlign(wxListColumnFormat align);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the background colour for the item.
|
|
|
|
*/
|
|
|
|
void SetBackgroundColour(const wxColour& colBack);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the zero-based column. Meaningful only in report mode.
|
|
|
|
*/
|
|
|
|
void SetColumn(int col);
|
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
2008-10-19 12:49:07 +00:00
|
|
|
Sets client data for the item.
|
|
|
|
Please note that client data is associated with the item and not with subitems.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
void SetData(long data);
|
2008-03-08 14:43:31 +00:00
|
|
|
void SetData(void* data);
|
2008-03-08 13:52:38 +00:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the font for the item.
|
|
|
|
*/
|
|
|
|
void SetFont(const wxFont& font);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the zero-based item position.
|
|
|
|
*/
|
|
|
|
void SetId(long id);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the zero-based index of the image associated with the item
|
|
|
|
into the image list.
|
|
|
|
*/
|
|
|
|
void SetImage(int image);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the mask of valid fields. See GetMask().
|
|
|
|
*/
|
|
|
|
void SetMask(long mask);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the item state flags (note that the valid state flags are influenced
|
2008-10-19 12:49:07 +00:00
|
|
|
by the value of the state mask, see wxListItem::SetStateMask).
|
|
|
|
|
|
|
|
See GetState() for valid flag values.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
void SetState(long state);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the bitmask that is used to determine which of the state flags
|
|
|
|
are to be set. See also SetState().
|
|
|
|
*/
|
|
|
|
void SetStateMask(long stateMask);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the text label for the item.
|
|
|
|
*/
|
|
|
|
void SetText(const wxString& text);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the text colour for the item.
|
|
|
|
*/
|
|
|
|
void SetTextColour(const wxColour& colText);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Meaningful only for column headers in report mode. Sets the column width.
|
|
|
|
*/
|
|
|
|
void SetWidth(int width);
|
|
|
|
};
|
2008-03-10 15:24:38 +00:00
|
|
|
|