-#if wxUSE_LISTCTRL
-
-// ----------------------------------------------------------------------------
-// types
-// ----------------------------------------------------------------------------
-
-// type of compare function for wxListCtrl sort operation
-typedef int (wxCALLBACK *wxListCtrlCompare)(long item1, long item2, long sortData);
-
-// ----------------------------------------------------------------------------
-// wxListCtrl constants
-// ----------------------------------------------------------------------------
-
-// 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)
-
-// for compatibility only
-#define wxLC_USER_TEXT wxLC_VIRTUAL
-
-// Omitted because
-// (a) too much detail
-// (b) not enough style flags
-// (c) not implemented anyhow in the generic version
-//
-// #define wxLC_NO_SCROLL
-// #define wxLC_NO_LABEL_WRAP
-// #define wxLC_OWNERDRAW_FIXED
-// #define wxLC_SHOW_SEL_ALWAYS
-
-// 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
-
-// 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)
-
-// 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
-};
-
-// ----------------------------------------------------------------------------
-// wxListItemAttr: a structure containing the visual attributes of an item
-// ----------------------------------------------------------------------------
-
-class WXDLLEXPORT wxListItemAttr
-{
-public:
- // ctors
- wxListItemAttr() { }
- wxListItemAttr(const wxColour& colText,
- const wxColour& colBack,
- const wxFont& font)
- : m_colText(colText), m_colBack(colBack), m_font(font) { }
-
- // setters
- void SetTextColour(const wxColour& colText) { m_colText = colText; }
- void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; }
- void SetFont(const wxFont& font) { m_font = font; }
-
- // accessors
- bool HasTextColour() const { return m_colText.Ok(); }
- bool HasBackgroundColour() const { return m_colBack.Ok(); }
- bool HasFont() const { return m_font.Ok(); }
-
- const wxColour& GetTextColour() const { return m_colText; }
- const wxColour& GetBackgroundColour() const { return m_colBack; }
- const wxFont& GetFont() const { return m_font; }
-
-private:
- wxColour m_colText,
- m_colBack;
- wxFont m_font;
-};
-
-// ----------------------------------------------------------------------------
-// wxListItem: the item or column info, used to exchange data with wxListCtrl
-// ----------------------------------------------------------------------------
-
-class WXDLLEXPORT wxListItem : public wxObject
-{
-public:
- wxListItem() { Init(); m_attr = NULL; }
- wxListItem(const wxListItem& item)
- : wxObject(),
- m_mask(item.m_mask),
- m_itemId(item.m_itemId),
- m_col(item.m_col),
- m_state(item.m_state),
- m_stateMask(item.m_stateMask),
- m_text(item.m_text),
- m_image(item.m_image),
- m_data(item.m_data),
- m_format(item.m_format),
- m_width(item.m_width),
- m_attr(NULL)
- {
- // copy list item attributes
- m_attr = new wxListItemAttr(*item.GetAttributes());
- }
- virtual ~wxListItem() { delete m_attr; }
-
- // resetting
- void Clear() { Init(); m_text.clear(); ClearAttributes(); }
- void ClearAttributes() { if ( m_attr ) { delete m_attr; m_attr = NULL; } }
-
- // setters
- void SetMask(long mask) { m_mask = mask; }
- void SetId(long id) { m_itemId = id; }
- void SetColumn(int col) { m_col = col; }
- void SetState(long state) { m_state = state; m_stateMask |= state; }
- void SetStateMask(long stateMask) { m_stateMask = stateMask; }
- void SetText(const wxString& text) { m_text = text; }
- void SetImage(int image) { m_image = image; }
- void SetData(long data) { m_data = data; }
- void SetData(void *data) { m_data = (long)data; }
-
- void SetWidth(int width) { m_width = width; }
- void SetAlign(wxListColumnFormat align) { m_format = align; }
-
- void SetTextColour(const wxColour& colText)
- { Attributes().SetTextColour(colText); }
- void SetBackgroundColour(const wxColour& colBack)
- { Attributes().SetBackgroundColour(colBack); }
- void SetFont(const wxFont& font)
- { Attributes().SetFont(font); }
-
- // accessors
- long GetMask() const { return m_mask; }
- long GetId() const { return m_itemId; }
- int GetColumn() const { return m_col; }
- long GetState() const { return m_state & m_stateMask; }
- const wxString& GetText() const { return m_text; }
- int GetImage() const { return m_image; }
- long GetData() const { return m_data; }
-
- int GetWidth() const { return m_width; }
- wxListColumnFormat GetAlign() const { return (wxListColumnFormat)m_format; }
-
- wxListItemAttr *GetAttributes() const { return m_attr; }
- bool HasAttributes() const { return m_attr != NULL; }
-
- wxColour GetTextColour() const
- { return HasAttributes() ? m_attr->GetTextColour() : wxNullColour; }
- wxColour GetBackgroundColour() const
- { return HasAttributes() ? m_attr->GetBackgroundColour()
- : wxNullColour; }
- wxFont GetFont() const
- { return HasAttributes() ? m_attr->GetFont() : wxNullFont; }
-
- // this conversion is necessary to make old code using GetItem() to
- // compile
- operator long() const { return m_itemId; }