X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/67d3fc4926c67818cfbee1cbb1e1b5cbb619afc0..66c2bf7b1d9326fb650acfaae22ec50528cfbf7c:/include/wx/msw/listctrl.h diff --git a/include/wx/msw/listctrl.h b/include/wx/msw/listctrl.h index 00583ea8a3..e3f0a7d1df 100644 --- a/include/wx/msw/listctrl.h +++ b/include/wx/msw/listctrl.h @@ -4,7 +4,6 @@ // Author: Julian Smart // Modified by: Agron Selimaj // Created: 01/02/97 -// RCS-ID: $Id$ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -14,8 +13,13 @@ #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 +#define wxHAS_LISTCTRL_COLUMN_ORDER /* The wxListCtrl can show lists of items in four different modes: @@ -71,7 +75,7 @@ class WXDLLIMPEXP_FWD_CORE wxImageList; */ -class WXDLLEXPORT wxListCtrl: public wxControl +class WXDLLIMPEXP_CORE wxListCtrl: public wxListCtrlBase { public: /* @@ -167,7 +171,7 @@ 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); @@ -250,12 +254,6 @@ public: 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); @@ -282,7 +280,7 @@ public: 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); @@ -320,14 +318,6 @@ public: // 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); @@ -349,7 +339,7 @@ public: // or zero if the two items are equivalent. // data is arbitrary data to be passed to the sort function. - bool SortItems(wxListCtrlCompare fn, long data); + bool SortItems(wxListCtrlCompare fn, wxIntPtr data); // IMPLEMENTATION virtual bool MSWCommand(WXUINT param, WXWORD id); @@ -393,12 +383,26 @@ protected: // common part of all ctors void Init(); + // Implement constrained best size calculation. + virtual int DoGetBestClientHeight(int width) const + { return MSWGetBestViewRect(width, -1).y; } + virtual int DoGetBestClientWidth(int height) const + { return MSWGetBestViewRect(-1, height).x; } + + wxSize MSWGetBestViewRect(int x, int y) const; + + // 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 *DoGetItemAttr(long item) const; + wxListItemAttr *DoGetItemColumnAttr(long item, long column) const; wxTextCtrl* m_textCtrl; // The control used for editing a label @@ -413,10 +417,9 @@ protected: // 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 m_internalData; // true if we have any items with custom attributes bool m_hasAnyAttr; @@ -435,16 +438,34 @@ protected: // return the icon for the given item and column. virtual int OnGetItemColumnImage(long item, long column) const; - // return the attribute for the item (may return NULL if none) - virtual wxListItemAttr *OnGetItemAttr(long item) const; + // return the attribute for the given item and column (may return NULL if none) + virtual wxListItemAttr *OnGetItemColumnAttr(long item, long WXUNUSED(column)) const + { + return OnGetItemAttr(item); + } private: // process NM_CUSTOMDRAW notification message WXLPARAM OnCustomDraw(WXLPARAM lParam); + // set the extended styles for the control (used by Create() and + // UpdateStyle()), only should be called if InReportView() + void MSWSetExListStyles(); + + // initialize the (already created) m_textCtrl with the associated HWND + void InitEditControl(WXHWND hWnd); + + // 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() - DECLARE_NO_COPY_CLASS(wxListCtrl) + wxDECLARE_NO_COPY_CLASS(wxListCtrl); }; #endif // _WX_LISTCTRL_H_