MyListCtrl.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /************************************************************************
  2. * 程序名: 精仿QQ主界面
  3. * 制作人: 李克平, 2011年04月11日
  4. * 版本号: 1.0
  5. ************************************************************************/
  6. #if !defined(AFX_MYLISTCTRL_H__AEB7A796_0079_40F7_892E_32954E3D1604__INCLUDED_)
  7. #define AFX_MYLISTCTRL_H__AEB7A796_0079_40F7_892E_32954E3D1604__INCLUDED_
  8. #if _MSC_VER > 1000
  9. #pragma once
  10. #endif // _MSC_VER > 1000
  11. // MyListCtrl.h : header file
  12. //
  13. #include <deque>
  14. #include <atlimage.h>
  15. #include "EnBitmap.h"
  16. /////////////////////////////////////////////////////////////////////////////
  17. // CMyListCtrl window
  18. struct LUSERITEM
  19. {
  20. CString szUserID;
  21. CString szUserName;
  22. CString szIPAddress;
  23. CString szServerAddress;
  24. CString szNoticeMsg;
  25. BOOL bOnline;
  26. int nHeadImageIndex;
  27. };
  28. typedef std::deque<LUSERITEM> DEQUELVITEM;
  29. /////////////////////////////////////////////////////////////////////////////
  30. // CMyListCtrl window
  31. class CMyListCtrl : public CListCtrl
  32. {
  33. // Construction
  34. public:
  35. CMyListCtrl();
  36. enum { TVS_CAMERA = 1 << 0, TVS_EMAIL = 1 << 1, TVS_MOBILE = 1 << 2,TVS_ONLINEUSER = 1 << 3};
  37. // Attributes
  38. public:
  39. COLORREF m_crHighlight;
  40. COLORREF m_crHighlightBorder;
  41. COLORREF m_crHover;
  42. CEnBitmap m_bitmap;
  43. // Operations
  44. public:
  45. void SetBackBitmap(LPCTSTR lpszImage){};
  46. int InsertItem(int nItem, LPCTSTR szItemText, int nImageIndex, LUSERITEM* UserInfo = NULL);
  47. BOOL GetUserItemInfo(LPCTSTR szItemText,LUSERITEM* userInfo);
  48. CRect GetTailIconRect(int nItem,DWORD dwServeFlag);
  49. // Overrides
  50. // ClassWizard generated virtual function overrides
  51. //{{AFX_VIRTUAL(CMyListCtrl)
  52. //}}AFX_VIRTUAL
  53. // Implementation
  54. public:
  55. virtual ~CMyListCtrl();
  56. int m_nHighlight;
  57. virtual void DrawItem(LPDRAWITEMSTRUCT /*lpDrawItemStruct*/);
  58. // Generated message map functions
  59. protected:
  60. //{{AFX_MSG(CMyListCtrl)
  61. afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp);
  62. afx_msg void OnMouseMove(UINT nFlags, CPoint point) ;
  63. afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  64. afx_msg void MeasureItem( LPMEASUREITEMSTRUCT lpMeasureItemStruct);
  65. //}}AFX_MSG
  66. afx_msg void OnNMCustomdraw(NMHDR *pNMHDR, LRESULT *pResult);
  67. afx_msg void OnSize(UINT nType, int cx, int cy);
  68. DECLARE_MESSAGE_MAP()
  69. private:
  70. DEQUELVITEM m_DequeList;
  71. HICON m_hTailIconCamera;
  72. HICON m_hTailIconEmail;
  73. HICON m_hTailIconMobile;
  74. CEnBitmap m_bmpItemSelected;
  75. CEnBitmap m_bmpFaceBG;
  76. int nHoverItem;
  77. int nLastHoverItem;
  78. public:
  79. afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  80. afx_msg void OnPaint();
  81. afx_msg void OnTimer(UINT_PTR nIDEvent);
  82. };
  83. /////////////////////////////////////////////////////////////////////////////
  84. //{{AFX_INSERT_LOCATION}}
  85. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  86. #endif // !defined(AFX_MYLISTCTRL_H__AEB7A796_0079_40F7_892E_32954E3D1604__INCLUDED_)