ctrlext.h
上传用户:lds876
上传日期:2013-05-25
资源大小:567k
文件大小:5k
源码类别:

P2P编程

开发平台:

Visual C++

  1. // ctrlext.h :
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1992-1998 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12. #ifndef __TREECTLX_H__
  13. #define __TREECTLX_H__
  14. #ifdef _AFX_NO_AFXCMN_SUPPORT
  15. #error Windows Common Control classes not supported in this library variant.
  16. #endif
  17. #ifndef __AFXWIN_H__
  18. #include <afxwin.h>
  19. #endif
  20. /////////////////////////////////////////////////////////////////////////////
  21. // TREECTLX - MFC Tree Control Helper Classes
  22. class CTreeCursor;
  23. class CTreeCtrlEx;
  24. /////////////////////////////////////////////////////////////////////////////
  25. // CTreeCursor
  26. class CTreeCursor
  27. {
  28. // Attributes
  29. protected:
  30. HTREEITEM   m_hTreeItem;
  31. CTreeCtrlEx *m_pTree;
  32. // Implementation
  33. protected:
  34. CTreeCursor CTreeCursor::_Insert(LPCTSTR strItem,int nImageIndex,HTREEITEM hAfter);
  35. // Operation
  36. public:
  37. CTreeCursor();
  38. CTreeCursor(HTREEITEM hTreeItem, CTreeCtrlEx* pTree);
  39. CTreeCursor(const CTreeCursor& posSrc);
  40. ~CTreeCursor();
  41. const CTreeCursor& operator =(const CTreeCursor& posSrc);
  42. operator HTREEITEM();
  43. CTreeCursor InsertAfter(LPCTSTR strItem,HTREEITEM hAfter,int nImageIndex = -1);
  44. CTreeCursor AddHead(LPCTSTR strItem,int nImageIndex = -1);
  45. CTreeCursor AddTail(LPCTSTR strItem,int nImageIndex = -1);
  46. int GetImageID();
  47. BOOL GetRect(LPRECT lpRect, BOOL bTextOnly);
  48. CTreeCursor GetNext(UINT nCode);
  49. CTreeCursor GetChild();
  50. CTreeCursor GetNextSibling();
  51. CTreeCursor GetPrevSibling();
  52. CTreeCursor GetParent();
  53. CTreeCursor GetFirstVisible();
  54. CTreeCursor GetNextVisible();
  55. CTreeCursor GetPrevVisible();
  56. CTreeCursor GetSelected();
  57. CTreeCursor GetDropHilight();
  58. CTreeCursor GetRoot();
  59. CString GetText();
  60. BOOL GetImage(int& nImage, int& nSelectedImage);
  61. UINT GetState(UINT nStateMask);
  62. DWORD GetData();
  63. BOOL Set(UINT nMask, LPCTSTR lpszItem, int nImage,
  64. int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam);
  65. BOOL SetText(LPCTSTR lpszItem);
  66. BOOL SetImage(int nImage, int nSelectedImage);
  67. BOOL SetState(UINT nState, UINT nStateMask);
  68. BOOL SetData(DWORD dwData);
  69. BOOL HasChildren();
  70. // Operations
  71. BOOL Delete();
  72. BOOL Expand(UINT nCode = TVE_EXPAND);
  73. BOOL Select(UINT nCode);
  74. BOOL Select();
  75. BOOL SelectDropTarget();
  76. BOOL SelectSetFirstVisible();
  77. CEdit* EditLabel();
  78. CImageList* CreateDragImage();
  79. BOOL SortChildren();
  80. BOOL EnsureVisible();
  81. };
  82. /////////////////////////////////////////////////////////////////////////////
  83. // CTreeCtrlEx
  84. class CTreeCtrlEx : public CTreeCtrl
  85. {
  86. // Attributes
  87. protected:
  88. // Operation
  89. public:
  90. CTreeCtrlEx();
  91. ~CTreeCtrlEx();
  92. CImageList* SetImageList(CImageList* pImageList, int nImageListType = TVSIL_NORMAL);
  93. CTreeCursor GetNextItem(HTREEITEM hItem, UINT nCode);
  94. CTreeCursor GetChildItem(HTREEITEM hItem);
  95. CTreeCursor GetNextSiblingItem(HTREEITEM hItem);
  96. CTreeCursor GetPrevSiblingItem(HTREEITEM hItem);
  97. CTreeCursor GetParentItem(HTREEITEM hItem);
  98. CTreeCursor GetFirstVisibleItem();
  99. CTreeCursor GetNextVisibleItem(HTREEITEM hItem);
  100. CTreeCursor GetPrevVisibleItem(HTREEITEM hItem);
  101. CTreeCursor GetSelectedItem();
  102. CTreeCursor GetDropHilightItem();
  103. CTreeCursor GetRootItem();
  104. CTreeCursor InsertItem(LPTV_INSERTSTRUCT lpInsertStruct);
  105. CTreeCursor InsertItem(UINT nMask, LPCTSTR lpszItem, int nImage,
  106. int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam,
  107. HTREEITEM hParent, HTREEITEM hInsertAfter);
  108. CTreeCursor InsertItem(LPCTSTR lpszItem, HTREEITEM hParent = TVI_ROOT,
  109. HTREEITEM hInsertAfter = TVI_LAST);
  110. CTreeCursor InsertItem(LPCTSTR lpszItem, int nImage, int nSelectedImage,
  111. HTREEITEM hParent = TVI_ROOT, HTREEITEM hInsertAfter = TVI_LAST);
  112. CTreeCursor HitTest(CPoint pt, UINT* pFlags = NULL);
  113. CTreeCursor HitTest(TV_HITTESTINFO* pHitTestInfo);
  114. };
  115. /////////////////////////////////////////////////////////////////////////////
  116. // CListCtrlEx
  117. class CListCtrlEx : public CListCtrl
  118. {
  119. // Attributes
  120. protected:
  121. // Operation
  122. public:
  123. CListCtrlEx();
  124. ~CListCtrlEx();
  125. CImageList* SetImageList(CImageList* pImageList, int nImageListType = TVSIL_NORMAL);
  126. BOOL AddColumn(
  127. LPCTSTR strItem,int nItem,int nSubItem = -1,
  128. int nMask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM,
  129. int nFmt = LVCFMT_LEFT);
  130. BOOL AddItem(int nItem,int nSubItem,LPCTSTR strItem,int nImageIndex = -1);
  131. };
  132. /////////////////////////////////////////////////////////////////////////////
  133. #include "CtrlExt.inl"
  134. #endif //__TREECTLX_H__