#include "wx/textctrl.h"
#include "wx/dynarray.h"
+#include "wx/vector.h"
-class WXDLLIMPEXP_FWD_CORE wxImageList;
+class wxMSWListItemData;
// define this symbol to indicate the availability of SetColumnsOrder() and
// related functions
*/
-class WXDLLIMPEXP_CORE wxListCtrl: public wxControl
+class WXDLLIMPEXP_CORE wxListCtrl: public wxListCtrlBase
{
public:
/*
bool SetItemColumnImage(long item, long column, int image);
// Gets the item text
- wxString GetItemText(long item) const;
+ wxString GetItemText(long item, int col = 0) const;
// Sets the item text
void SetItemText(long item, const wxString& str);
void SetImageList(wxImageList *imageList, int which);
void AssignImageList(wxImageList *imageList, int which);
- // are we in report mode?
- bool InReportView() const { return HasFlag(wxLC_REPORT); }
-
- // are we in virtual report mode?
- bool IsVirtual() const { return HasFlag(wxLC_VIRTUAL); }
-
// refresh items selectively (only useful for virtual list controls)
void RefreshItem(long item);
void RefreshItems(long itemFrom, long itemTo);
void ClearAll();
// Edit the label
- wxTextCtrl* EditLabel(long item, wxClassInfo* textControlClass = CLASSINFO(wxTextCtrl));
+ wxTextCtrl* EditLabel(long item, wxClassInfo* textControlClass = wxCLASSINFO(wxTextCtrl));
// End label editing, optionally cancelling the edit
bool EndEditLabel(bool cancel);
// Insert an image/string item
long InsertItem(long index, const wxString& label, int imageIndex);
- // For list view mode (only), inserts a column.
- long InsertColumn(long col, const wxListItem& info);
-
- long InsertColumn(long col,
- const wxString& heading,
- int format = wxLIST_FORMAT_LEFT,
- int width = -1);
-
// set the number of items in a virtual list control
void SetItemCount(long count);
// common part of all ctors
void Init();
+ // Implement base class pure virtual methods.
+ long DoInsertColumn(long col, const wxListItem& info);
+
// free memory taken by all internal data
void FreeAllInternalData();
+ // get the internal data object for this item (may return NULL)
+ wxMSWListItemData *MSWGetItemData(long item) const;
+
// get the item attribute, either by quering it for virtual control, or by
// returning the one previously set using setter methods for a normal one
wxListItemAttr *DoGetItemColumnAttr(long item, long column) const;
// keep track of inserted/deleted columns
long m_count; // Keep track of item count to save calls to
// ListView_GetItemCount
- bool m_ignoreChangeMessages;
- // true if we have any internal data (user data & attributes)
- bool m_AnyInternalData;
+ // all wxMSWListItemData objects we use
+ wxVector<wxMSWListItemData *> m_internalData;
// true if we have any items with custom attributes
bool m_hasAnyAttr;
// destroy m_textCtrl if it's currently valid and reset it to NULL
void DeleteEditControl();
+ // Intercept Escape and Enter keys to avoid them being stolen from our
+ // in-place editor control.
+ void OnCharHook(wxKeyEvent& event);
+
DECLARE_DYNAMIC_CLASS(wxListCtrl)
DECLARE_EVENT_TABLE()