home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / addins / wins / mylistctrl.h < prev    next >
C/C++ Source or Header  |  1998-04-08  |  2KB  |  91 lines

  1. #if !defined(AFX_MYLISTCTRL_H__C1AC212D_8ABF_11D1_B145_000000000000__INCLUDED_)
  2. #define AFX_MYLISTCTRL_H__C1AC212D_8ABF_11D1_B145_000000000000__INCLUDED_
  3.  
  4. #if _MSC_VER > 1000
  5. #pragma once
  6. #endif // _MSC_VER > 1000
  7. // MyListCtrl.h : header file
  8. //
  9.  
  10. class CMyListCtrl;
  11.  
  12. struct SortInfo
  13. {
  14.     int iColumn;
  15.     CMyListCtrl *pList;
  16. };
  17.  
  18. /////////////////////////////////////////////////////////////////////////////
  19. // CMyListCtrl window
  20.  
  21. typedef void (CALLBACK * LPFNLCOP)(NMHDR* pNMHDR, LRESULT* pResult, LPARAM lParam);
  22. typedef void (CALLBACK * LPFNLCSOP)(NMHDR* pNMHDR, LRESULT* pResult, LPARAM lParam, SortInfo *pSortInfo); // ListControl Sort OPeration
  23.  
  24. class CMyListCtrl : public CListCtrl
  25. {
  26. // Construction
  27. public:
  28.     CMyListCtrl();
  29.  
  30. // Attributes
  31. public:
  32.  
  33. // Operations
  34. public:
  35.  
  36. // Overrides
  37.     // ClassWizard generated virtual function overrides
  38.     //{{AFX_VIRTUAL(CMyListCtrl)
  39.     //}}AFX_VIRTUAL
  40.  
  41. // Implementation
  42. public:
  43.     void SetOnClick(LPFNLCOP pfnLCOpHandler, LPARAM lParam);
  44.     void SetOnDblClick(LPFNLCOP pfnLCOpHandler, LPARAM lParam);
  45.     void SetSort(PFNLVCOMPARE pfnSort, LPARAM lParam);
  46.     void SetColClick(LPFNLCSOP pfnLCOpHandler, LPARAM lParam);
  47.     void DoSort(int iCol);
  48.  
  49.     int GetColumnCount();
  50.     virtual ~CMyListCtrl();
  51.     void SetWidths();
  52.     int InsertColumn(int nCol, LPCTSTR lpszColumnHeading,
  53.         int nFormat = LVCFMT_LEFT, int nWidth = -1, int nSubItem = -1);
  54.     int GetCurrentIndex();
  55.     int InsertItem(int nItem, LPCTSTR lpszItem, LPARAM lItemData);
  56.  
  57.  
  58.     // Generated message map functions
  59. protected:
  60.     LPFNLCOP m_pfnLCClick;
  61.     LPARAM m_lParamClick;
  62.     LPFNLCSOP m_pfnLCColClick;
  63.     LPARAM m_lParamColClick;
  64.     LPFNLCOP m_pfnLCDblClick;
  65.     LPARAM m_lParamDblClick;
  66.     PFNLVCOMPARE m_pfnSort;
  67.     LPARAM m_lParamSort;
  68.  
  69.     int m_cCols;
  70.     int m_iIndexCurrent;
  71.  
  72.     //{{AFX_MSG(CMyListCtrl)
  73.     afx_msg void OnColumnclick(NMHDR* pNMHDR, LRESULT* pResult);
  74.     afx_msg void OnClick(NMHDR* pNMHDR, LRESULT* pResult); 
  75.     afx_msg void OnDblclk(NMHDR* pNMHDR, LRESULT* pResult);
  76.     afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
  77.     //}}AFX_MSG
  78.  
  79.     DECLARE_MESSAGE_MAP()
  80. };
  81.  
  82.  
  83.  
  84.  
  85. /////////////////////////////////////////////////////////////////////////////
  86.  
  87. //{{AFX_INSERT_LOCATION}}
  88. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  89.  
  90. #endif // !defined(AFX_MYLISTCTRL_H__C1AC212D_8ABF_11D1_B145_000000000000__INCLUDED_)
  91.