SortListCtrl.h
上传用户:xuemeng126
上传日期:2022-07-05
资源大小:454k
文件大小:2k
源码类别:

系统编程

开发平台:

Visual C++

  1. #ifndef SORTLISTCTRL_H
  2. #define SORTLISTCTRL_H
  3. #if _MSC_VER > 1000
  4. #pragma once
  5. #endif // _MSC_VER > 1000
  6. #ifndef SORTHEADERCTRL_H
  7. #include "SortHeaderCtrl.h"
  8. #endif // SORTHEADERCTRL_H
  9. #ifdef _DEBUG
  10. #define ASSERT_VALID_STRING( str ) ASSERT( !IsBadStringPtr( str, 0xfffff ) )
  11. #else // _DEBUG
  12. #define ASSERT_VALID_STRING( str ) ( (void)0 )
  13. #endif // _DEBUG
  14. class CSortListCtrl : public CListCtrl
  15. {
  16. // Construction
  17. public:
  18. CSortListCtrl();
  19. // Attributes
  20. public:
  21. // Operations
  22. public:
  23. BOOL SetHeadings( UINT uiStringID );
  24. BOOL SetHeadings( const CString& strHeadings );
  25. int AddItem( int j,LPCTSTR pszText, ... );
  26. BOOL DeleteItem( int iItem );
  27. BOOL DeleteAllItems();
  28. void LoadColumnInfo();
  29. void SaveColumnInfo();
  30. BOOL SetItemText( int nItem, int nSubItem, LPCTSTR lpszText );
  31. void Sort( int iColumn, BOOL bAscending );
  32. BOOL SetItemData(int nItem, DWORD dwData);
  33. DWORD GetItemData(int nItem) const;
  34. void OnCustomDraw(NMHDR   *pnotify,   LRESULT   *result) ;
  35. // Overrides
  36. // ClassWizard generated virtual function overrides
  37. //{{AFX_VIRTUAL(CSortListCtrl)
  38. protected:
  39. virtual void PreSubclassWindow();
  40. //}}AFX_VIRTUAL
  41. // Implementation
  42. public:
  43. virtual ~CSortListCtrl();
  44. // Generated message map functions
  45. protected:
  46. static int CALLBACK CompareFunction( LPARAM lParam1, LPARAM lParam2, LPARAM lParamData );
  47. void FreeItemMemory( const int iItem );
  48. BOOL CSortListCtrl::SetTextArray( int iItem, LPTSTR* arrpsz );
  49. LPTSTR* CSortListCtrl::GetTextArray( int iItem ) const;
  50. CSortHeaderCtrl m_ctlHeader;
  51. int m_iNumColumns;
  52. int m_iSortColumn;
  53. BOOL m_bSortAscending;
  54. //{{AFX_MSG(CSortListCtrl)
  55. afx_msg void OnColumnClick(NMHDR* pNMHDR, LRESULT* pResult);
  56. afx_msg void OnDestroy();
  57. //}}AFX_MSG
  58. DECLARE_MESSAGE_MAP()
  59. };
  60. //{{AFX_INSERT_LOCATION}}
  61. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  62. #endif // SORTLISTCTRL_H