00001
00002
00003
00004
00005
00006 #if !defined(AFX_LISTCTRLEX_H__1447784E_2A04_4014_9A96_4D11F169E148__INCLUDED_)
00007 #define AFX_LISTCTRLEX_H__1447784E_2A04_4014_9A96_4D11F169E148__INCLUDED_
00008
00009 #if _MSC_VER > 1000
00010 #pragma once
00011 #endif
00012
00013 #include "list.h"
00014
00015 struct ListEx_ItemInfo
00016 {
00017 COLORREF clrBg;
00018 COLORREF clrText;
00019 };
00020
00021 const int LISTEX_MAXCOLUMNS = 15;
00022
00023 enum fsLCSortMode
00024 {
00025 LCSM_NONE = 0,
00026 LCSM_ASCENDING = 1,
00027 LCSM_DESCENDING = 2
00028 };
00029
00030 enum fsLCSortModeSupport
00031 {
00032 LCSM_ALL_SUPPORTED = 0,
00033 LCSM_ASCENDING_NOTSUPPORTED = 1,
00034 LCSM_DESCENDING_NOTSUPPORTED = 2
00035 };
00036
00037 class CListCtrlEx : public CListCtrl
00038 {
00039
00040 public:
00041 CListCtrlEx();
00042
00043 public:
00044
00045 public:
00046
00047
00048 protected:
00049 virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
00050
00051
00052 public:
00053
00054 int SubItemToSubItem (int nSubItem);
00055
00056 void VirtualView_AllItemsWillBeDeleted();
00057
00058 void VirtualView_ItemWillBeDeleted (int nItem);
00059
00060 void VirtualView_ItemWillBeAdded (COLORREF clrBg, COLORREF clrText, BOOL bAddToBeginning);
00061
00062 void ChangeColumnVisibility (int iColumn);
00063
00064 BOOL IsColumnShown (int iCol);
00065
00066 void SetItemText (int iItem, int iSubItem, LPCSTR pszText);
00067
00068 void SetColumnText (int iCol, LPCSTR pszText);
00069
00070 void Initialize ();
00071
00072 void DeleteHdrItem (int iItem);
00073
00074 void SetSelectedImages (CImageList* pImages);
00075
00076 void SetItemColor (int iItem, COLORREF clr, BOOL bUpdate = TRUE);
00077
00078 void ReadState (LPCSTR pszName);
00079
00080 void SaveState (LPCSTR pszName);
00081
00082 void UseGrid (BOOL bUse = TRUE);
00083
00084 int AddItem (LPCSTR pszItem, COLORREF clrBg = GetSysColor (COLOR_WINDOW), COLORREF clrText = GetSysColor (COLOR_WINDOWTEXT), int iImage = 0, BOOL bAddToBeginning = FALSE);
00085 int GetItemImage(int iItem);
00086 virtual ~CListCtrlEx();
00087
00088 protected:
00089 virtual void OnItemChanged (NM_LISTVIEW* pLV);
00090 CImageList m_imgsSort;
00091 void InitSortImages();
00092
00093 virtual void OnSortModeChanged ();
00094 fsLCSortMode m_sortMode;
00095 fsLCSortModeSupport m_sortModeSupport;
00096 int m_iSortCol;
00097
00098 void InsertHdrItem (int iCol);
00099
00100 afx_msg void OnShowCol (UINT uCmd);
00101
00102 void RebuildAIndex();
00103 int m_cTotalCols;
00104 CImageList *m_pSelImages;
00105 COLORREF m_clrGrid;
00106 BOOL m_bGrid;
00107
00108 int m_aIndex [LISTEX_MAXCOLUMNS];
00109
00110 LPCSTR m_appszCols [LISTEX_MAXCOLUMNS];
00111
00112 void SetItemImage (int iItem, int iImage);
00113
00114 virtual void OnForceUpdate ();
00115
00116 virtual void OnKeyDown(WORD wVK);
00117
00118 virtual void OnDeleteAllItems ();
00119
00120 virtual void OnDeleteItem (NM_LISTVIEW *pNM);
00121
00122 virtual void OnRClick ();
00123
00124 virtual void OnClick();
00125
00126 std::vector <ListEx_ItemInfo> m_vInfo;
00127
00128 void DrawItem (LPDRAWITEMSTRUCT lpDraw);
00129
00130
00131 afx_msg void OnClick(NMHDR* pNMHDR, LRESULT* pResult);
00132 afx_msg void OnRclick(NMHDR* pNMHDR, LRESULT* pResult);
00133 afx_msg void OnDeleteitem(NMHDR* pNMHDR, LRESULT* pResult);
00134 afx_msg void OnDeleteallitems(NMHDR* pNMHDR, LRESULT* pResult);
00135 afx_msg void OnKeydown(NMHDR* pNMHDR, LRESULT* pResult);
00136 afx_msg void OnParentNotify(UINT message, LPARAM lParam);
00137 afx_msg void OnColumnclick(NMHDR* pNMHDR, LRESULT* pResult);
00138 afx_msg void OnItemchanged(NMHDR* pNMHDR, LRESULT* pResult);
00139
00140
00141 DECLARE_MESSAGE_MAP()
00142 };
00143
00144
00145
00146 #endif