Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

178 lines
5.5 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1996-1997 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // ListView.h
  7. //
  8. // Abstract:
  9. // Definition of the CClusterListView class.
  10. //
  11. // Implementation File:
  12. // ListView.cpp
  13. //
  14. // Author:
  15. // David Potter (davidp) May 3, 1996
  16. //
  17. // Revision History:
  18. //
  19. // Notes:
  20. //
  21. /////////////////////////////////////////////////////////////////////////////
  22. #ifndef _LISTVIEW_H_
  23. #define _LISTVIEW_H_
  24. /////////////////////////////////////////////////////////////////////////////
  25. // Forward Class Declarations
  26. /////////////////////////////////////////////////////////////////////////////
  27. class CClusterListView;
  28. /////////////////////////////////////////////////////////////////////////////
  29. // External Class Declarations
  30. /////////////////////////////////////////////////////////////////////////////
  31. class CColumnItem;
  32. class CClusterDoc;
  33. class CTreeItem;
  34. class CSplitterFrame;
  35. /////////////////////////////////////////////////////////////////////////////
  36. // Type Definitions
  37. /////////////////////////////////////////////////////////////////////////////
  38. typedef CList<CClusterListView *, CClusterListView *> CClusterListViewList;
  39. /////////////////////////////////////////////////////////////////////////////
  40. // Include Files
  41. /////////////////////////////////////////////////////////////////////////////
  42. #ifndef _TREEITEM_H_
  43. #include "TreeItem.h" // for CTreeItem
  44. #endif
  45. #ifndef _SPLITFRM_H
  46. #include "SplitFrm.h" // for CSplitterFrame
  47. #endif
  48. /////////////////////////////////////////////////////////////////////////////
  49. // CClusterListView view
  50. /////////////////////////////////////////////////////////////////////////////
  51. class CClusterListView : public CListView
  52. {
  53. friend class CListItem;
  54. friend class CClusterDoc;
  55. friend class CSplitterFrame;
  56. protected:
  57. CClusterListView(void); // protected constructor used by dynamic creation
  58. DECLARE_DYNCREATE(CClusterListView)
  59. // Attributes
  60. protected:
  61. CTreeItem * m_ptiParent;
  62. int m_nColumns;
  63. CSplitterFrame * m_pframe;
  64. BOOL BDragging(void) const { ASSERT_VALID(Pframe()); return Pframe()->BDragging(); }
  65. CImageList * Pimagelist(void) const { ASSERT_VALID(Pframe()); return Pframe()->Pimagelist(); }
  66. public:
  67. CClusterDoc * GetDocument(void);
  68. CSplitterFrame * Pframe(void) const { return m_pframe; }
  69. CListItem * PliFocused(void) const;
  70. int IliFocused(void) const { return GetListCtrl().GetNextItem(-1, LVNI_FOCUSED); }
  71. CTreeItem * PtiParent(void) const { return m_ptiParent; }
  72. // Operations
  73. public:
  74. void Refresh(IN OUT CTreeItem * ptiSelected);
  75. BOOL DeleteAllItems(void);
  76. void SaveColumns(void);
  77. void SetView(IN DWORD dwView);
  78. int GetView(void) const { return (GetWindowLong(GetListCtrl().m_hWnd, GWL_STYLE) & LVS_TYPEMASK); }
  79. CMenu * PmenuPopup(
  80. IN CPoint & rpointScreen,
  81. OUT CClusterItem *& rpci
  82. );
  83. protected:
  84. void AddColumns(void);
  85. // CMenu * PmenuPopup(void);
  86. // Overrides
  87. // ClassWizard generated virtual function overrides
  88. //{{AFX_VIRTUAL(CClusterListView)
  89. public:
  90. virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
  91. virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
  92. virtual BOOL PreTranslateMessage(MSG* pMsg);
  93. virtual void OnInitialUpdate();
  94. protected:
  95. virtual void OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView);
  96. //}}AFX_VIRTUAL
  97. // Implementation
  98. protected:
  99. virtual ~CClusterListView(void);
  100. #ifdef _DEBUG
  101. virtual void AssertValid(void) const;
  102. virtual void Dump(CDumpContext& dc) const;
  103. #endif
  104. static int CALLBACK CompareItems(LPARAM lparam1, LPARAM lparam2, LPARAM lparamSort);
  105. int m_nSortDirection;
  106. CColumnItem * m_pcoliSort;
  107. // Label editing.
  108. CListItem * m_pliBeingEdited;
  109. BOOL m_bShiftPressed;
  110. BOOL m_bControlPressed;
  111. BOOL m_bAltPressed;
  112. MSG m_msgControl;
  113. // Drag & drop.
  114. int m_iliDrag;
  115. CListItem * m_pliDrag;
  116. int m_iliDrop;
  117. CPoint m_ptDragHotSpot;
  118. void OnMouseMoveForDrag(IN UINT nFlags, IN CPoint point, IN const CWnd * pwndDrop);
  119. void OnButtonUpForDrag(IN UINT nFlags, IN CPoint point);
  120. void BeginDrag(void);
  121. void EndDrag(void);
  122. int NSortDirection(void) const { return m_nSortDirection; }
  123. CColumnItem * PcoliSort(void) const { return m_pcoliSort; }
  124. // Generated message map functions
  125. protected:
  126. //{{AFX_MSG(CClusterListView)
  127. afx_msg void OnDestroy();
  128. afx_msg void OnItemChanged(NMHDR* pNMHDR, LRESULT* pResult);
  129. afx_msg void OnColumnClick(NMHDR* pNMHDR, LRESULT* pResult);
  130. afx_msg void OnDblClk(NMHDR* pNMHDR, LRESULT* pResult);
  131. afx_msg void OpenItem();
  132. afx_msg void OnBeginLabelEdit(NMHDR* pNMHDR, LRESULT* pResult);
  133. afx_msg void OnEndLabelEdit(NMHDR* pNMHDR, LRESULT* pResult);
  134. afx_msg void OnUpdateProperties(CCmdUI* pCmdUI);
  135. afx_msg void OnCmdProperties();
  136. afx_msg void OnCmdRename();
  137. afx_msg void OnBeginDrag(NMHDR* pNMHDR, LRESULT* pResult);
  138. afx_msg void OnKeyDown(NMHDR* pNMHDR, LRESULT* pResult);
  139. //}}AFX_MSG
  140. DECLARE_MESSAGE_MAP()
  141. }; //*** class CClusterListView
  142. #ifndef _DEBUG // debug version in TreeView.cpp
  143. inline CClusterDoc * CClusterListView::GetDocument(void)
  144. { return (CClusterDoc *) m_pDocument; }
  145. #endif
  146. /////////////////////////////////////////////////////////////////////////////
  147. #endif // _LISTVIEW_H_