NavListCtrl.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #ifndef __NAVLISTCTRL__
  2. #define __NAVLISTCTRL__
  3. #if _MSC_VER > 1000
  4. #pragma once
  5. #endif // _MSC_VER > 1000
  6. #include <deque>
  7. #include <atlimage.h>
  8. #include "EnBitmap.h"
  9. /////////////////////////////////////////////////////////////////////////////
  10. // CNavListCtrl window
  11. struct LUSERITEM
  12. {
  13. CString szUserID;
  14. CString szUserName;
  15. CString szIPAddress;
  16. CString szServerAddress;
  17. CString szNoticeMsg;
  18. BOOL bOnline;
  19. int nHeadImageIndex;
  20. };
  21. typedef std::deque<LUSERITEM> DEQUELVITEM;
  22. class CNavListCtrl : public CListCtrl
  23. {
  24. // Construction
  25. public:
  26. CNavListCtrl();
  27. enum {
  28. TVS_CAMERA = 1 << 0,
  29. TVS_EMAIL = 1 << 1,
  30. TVS_MOBILE = 1 << 2,
  31. TVS_ONLINEUSER = 1 << 3
  32. };
  33. // Attributes
  34. public:
  35. COLORREF m_crHighlight;
  36. COLORREF m_crHighlightBorder;
  37. COLORREF m_crHover;
  38. CEnBitmap m_bitmap;
  39. // Operations
  40. public:
  41. void SetBackBitmap(LPCTSTR lpszImage) {};
  42. int InsertItem(int nItem, LPCTSTR szItemText, int nImageIndex, LUSERITEM* UserInfo = NULL);
  43. BOOL GetUserItemInfo(LPCTSTR szItemText, LUSERITEM* userInfo);
  44. CRect GetTailIconRect(int nItem, DWORD dwServeFlag);
  45. // Implementation
  46. public:
  47. virtual ~CNavListCtrl();
  48. int m_nHighlight;
  49. virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
  50. // Generated message map functions
  51. protected:
  52. //{{AFX_MSG(CNavListCtrl)
  53. afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp);
  54. afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  55. afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  56. afx_msg void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);
  57. //}}AFX_MSG
  58. afx_msg void OnNMCustomdraw(NMHDR* pNMHDR, LRESULT* pResult);
  59. afx_msg void OnSize(UINT nType, int cx, int cy);
  60. DECLARE_MESSAGE_MAP()
  61. private:
  62. DEQUELVITEM m_DequeList;
  63. HICON m_hTailIconCamera;
  64. HICON m_hTailIconEmail;
  65. HICON m_hTailIconMobile;
  66. CEnBitmap m_bmpItemSelected;
  67. CEnBitmap m_bmpFaceBG;
  68. int nHoverItem;
  69. int nLastHoverItem;
  70. public:
  71. afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  72. afx_msg void OnPaint();
  73. afx_msg void OnTimer(UINT_PTR nIDEvent);
  74. };
  75. #endif