QListCtrl.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. #if !defined(AFX_QLISTCTRL_H__30BEB04A_4B97_4943_BB73_C5128E66B4ED__INCLUDED_)
  2. #define AFX_QLISTCTRL_H__30BEB04A_4B97_4943_BB73_C5128E66B4ED__INCLUDED_
  3. #if _MSC_VER > 1000
  4. #pragma once
  5. #endif // _MSC_VER > 1000
  6. // QListCtrl.h : header file
  7. //
  8. #include "ArrayEx.h"
  9. #include "SkinHorizontalScrollbar.h"
  10. #include "SkinVerticleScrollbar.h"
  11. #define NM_SELECT WM_USER+0x100
  12. #define NM_RIGHT WM_USER+0x101
  13. #define NM_LEFT WM_USER+0x102
  14. #define NM_END WM_USER+0x103
  15. #define NM_DELETE WM_USER+0x105
  16. #define NM_PROPERTIES WM_USER+0x106
  17. #define NM_LBUTTONDOWN WM_USER+0x107
  18. #define NM_GETTOOLTIPTEXT WM_USER+0x108
  19. #define NM_SELECT_DB_ID WM_USER+0x109
  20. #define NM_SELECT_INDEX WM_USER+0x110
  21. #define NM_GROUP_TREE_MESSAGE WM_USER+0x111
  22. //#define NM_LIST_CUT WM_USER+0x111
  23. //#define NM_LIST_COPY WM_USER+0x112
  24. //#define NM_LIST_PASTE WM_USER+0x113
  25. class CQListToolTipText
  26. {
  27. public:
  28. NMHDR hdr;
  29. long lItem;
  30. LPTSTR pszText;
  31. int cchTextMax;
  32. };
  33. class CQListCtrl : public CListCtrl
  34. {
  35. // Construction
  36. public:
  37. CQListCtrl();
  38. // Attributes
  39. public:
  40. // Operations
  41. public:
  42. // Overrides
  43. // ClassWizard generated virtual function overrides
  44. //{{AFX_VIRTUAL(CQListCtrl)
  45. public:
  46. virtual int OnToolHitTest(CPoint point, TOOLINFO * pTI) const;
  47. virtual BOOL PreTranslateMessage(MSG* pMsg);
  48. //}}AFX_VIRTUAL
  49. // Implementation
  50. public:
  51. virtual ~CQListCtrl();
  52. CPopup m_Popup;
  53. // The "FirstTen" block is either at the top or the bottom
  54. // of the list based upon m_bStartTop.
  55. BOOL m_bShowTextForFirstTenHotKeys;
  56. BOOL m_bStartTop;
  57. // returns the position 1-10 if the index is in the FirstTen block else -1
  58. int GetFirstTenNum( int index );
  59. // returns the list index corresponding to the given FirstTen position number.
  60. int GetFirstTenIndex( int num );
  61. void SetNumberOfLinesPerRow(int nLines);
  62. void GetSelectionIndexes(ARRAY &arr);
  63. void GetSelectionItemData(ARRAY &arr);
  64. void RefreshVisibleRows();
  65. void RemoveAllSelection();
  66. BOOL SetSelection(int nRow, BOOL bSelect = TRUE);
  67. BOOL SetText(int nRow, int nCol, CString cs);
  68. BOOL SetFormattedText(int nRow, int nCol, LPCTSTR lpszFormat,...);
  69. BOOL SetCaret(int nRow, BOOL bFocus = TRUE);
  70. long GetCaret();
  71. // moves the caret to the given index, selects it, and ensures it is visible.
  72. BOOL SetListPos( int index );
  73. DWORD GetItemData(int nItem);
  74. void GetToolTipText(int nItem, CString &csText);
  75. void SetShowTextForFirstTenHotKeys(BOOL bVal) { m_bShowTextForFirstTenHotKeys = bVal; }
  76. void DestroyAndCreateAccelerator(BOOL bCreate);
  77. void ShowFullDescription(bool bFromAuto = false);
  78. BOOL SetItemCountEx(int iCount, DWORD dwFlags = LVSICF_NOINVALIDATEALL);
  79. void MoveWindow(int x, int y, int nWidth, int nHeight, BOOL bRepaint = TRUE);
  80. protected:
  81. void SendSelection(int nItem);;
  82. void SendSelection(ARRAY &arrItems);
  83. void LoadCopyOrCutToClipboard();
  84. void PositionScrollBars();
  85. WCHAR *m_pwchTip;
  86. TCHAR *m_pchTip;
  87. HFONT m_SmallFont;
  88. //Accelerator
  89. CAccels m_Accels;
  90. CSkinVerticleScrollbar m_SkinVerticleScrollbar;
  91. CSkinHorizontalScrollbar m_SkinHorizontalScrollbar;
  92. // Generated message map functions
  93. protected:
  94. //{{AFX_MSG(CQListCtrl)
  95. afx_msg void OnKeydown(NMHDR* pNMHDR, LRESULT* pResult);
  96. afx_msg void OnDblclk(NMHDR* pNMHDR, LRESULT* pResult);
  97. afx_msg void OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult);
  98. afx_msg void OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
  99. afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  100. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  101. afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
  102. afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
  103. afx_msg void OnTimer(UINT nIDEvent);
  104. afx_msg void OnWindowPosChanged(WINDOWPOS FAR* lpwndpos);
  105. afx_msg void OnSelectionChange(NMHDR* pNMHDR, LRESULT* pResult);
  106. afx_msg void OnSize(UINT nType, int cx, int cy);
  107. afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
  108. afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
  109. afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
  110. //}}AFX_MSG
  111. afx_msg BOOL OnToolTipText( UINT id, NMHDR * pNMHDR, LRESULT * pResult );
  112. DECLARE_MESSAGE_MAP()
  113. public:
  114. afx_msg void OnKillFocus(CWnd* pNewWnd);
  115. };
  116. /////////////////////////////////////////////////////////////////////////////
  117. //{{AFX_INSERT_LOCATION}}
  118. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  119. #endif // !defined(AFX_QLISTCTRL_H__30BEB04A_4B97_4943_BB73_C5128E66B4ED__INCLUDED_)