CTRLEXT.H
上传用户:bangxh
上传日期:2007-01-31
资源大小:42235k
文件大小:6k
源码类别:

Windows编程

开发平台:

Visual C++

  1. // ctrlext.h : header file
  2. //
  3. // This is a part of the Microsoft Foundation Classes and
  4. // Templates (MFC&T).
  5. // Copyright (C) 1998 Microsoft Corporation
  6. // All rights reserved.
  7. //
  8. // This source code is only intended as a supplement to the
  9. // MFC&T Reference and related electronic documentation provided
  10. // with the library.  See these sources for detailed information
  11. // regarding the MFC&T product.
  12. //
  13. #ifndef __CTRLEXT_H__
  14. #define __CTRLEXT_H__
  15. /////////////////////////////////////////////////////////////////////////////
  16. // Forward Declarations
  17. class CTreeCtrlEx;
  18. class CListCtrlEx;
  19. class CTreeCursor;
  20. /////////////////////////////////////////////////////////////////////////////
  21. // CTreeCursor
  22. class CTreeCursor
  23. {
  24. // Attributes
  25. protected:
  26. HTREEITEM   m_hTreeItem;
  27. CTreeCtrlEx *m_pTree;
  28. // Implementation
  29. protected:
  30. CTreeCursor CTreeCursor::_Insert(LPCTSTR strItem, int nImageIndex,
  31. HTREEITEM hAfter);
  32. // Operations
  33. public:
  34. CTreeCursor();
  35. CTreeCursor(HTREEITEM hTreeItem, CTreeCtrlEx* pTree);
  36. CTreeCursor(const CTreeCursor& posSrc);
  37. ~CTreeCursor();
  38. const CTreeCursor& operator =(const CTreeCursor& posSrc);
  39. operator HTREEITEM();
  40. CTreeCursor InsertAfter(LPCTSTR strItem, HTREEITEM hAfter,
  41. int nImageIndex = -1);
  42. CTreeCursor AddHead(LPCTSTR strItem, int nImageIndex = -1);
  43. CTreeCursor AddTail(LPCTSTR strItem, int nImageIndex = -1);
  44. int GetImageID();
  45. BOOL GetRect(LPRECT lpRect, BOOL bTextOnly);
  46. CTreeCursor GetNext(UINT nCode);
  47. CTreeCursor GetChild();
  48. CTreeCursor GetNextSibling();
  49. CTreeCursor GetPrevSibling();
  50. CTreeCursor GetParent();
  51. CTreeCursor GetFirstVisible();
  52. CTreeCursor GetNextVisible();
  53. CTreeCursor GetPrevVisible();
  54. CTreeCursor GetSelected();
  55. CTreeCursor GetDropHilight();
  56. CTreeCursor GetRoot();
  57. CString GetText();
  58. BOOL GetImage(int& nImage, int& nSelectedImage);
  59. UINT GetState(UINT nStateMask);
  60. DWORD GetData();
  61. BOOL Set(UINT nMask, LPCTSTR lpszItem, int nImage,
  62. int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam);
  63. BOOL SetText(LPCTSTR lpszItem);
  64. BOOL SetImage(int nImage, int nSelectedImage);
  65. BOOL SetState(UINT nState, UINT nStateMask);
  66. BOOL SetData(DWORD dwData);
  67. BOOL HasChildren();
  68. // Operations
  69. BOOL Delete();
  70. BOOL Expand(UINT nCode = TVE_EXPAND);
  71. CTreeCursor Select(UINT nCode);
  72. CTreeCursor Select();
  73. CTreeCursor SelectDropTarget();
  74. CTreeCursor SelectSetFirstVisible();
  75. CEdit* EditLabel();
  76. CImageList* CreateDragImage();
  77. BOOL SortChildren();
  78. BOOL EnsureVisible();
  79. };
  80. /////////////////////////////////////////////////////////////////////////////
  81. // CListCtrlEx window
  82. class CListCtrlEx : public CListCtrl
  83. {
  84. // Construction
  85. public:
  86. CListCtrlEx();
  87. // Attributes
  88. public:
  89. // Operations
  90. public:
  91. CImageList* SetImageList(CImageList* pImageList,
  92. int nImageListType = TVSIL_NORMAL);
  93. BOOL AddColumn(
  94. LPCTSTR strItem, int nItem, int nSubItem = -1,
  95. int nMask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM,
  96. int nFmt = LVCFMT_LEFT);
  97. BOOL AddItem(int nItem, int nSubItem, LPCTSTR strItem, int nImageIndex = -1);
  98. // Overrides
  99. // ClassWizard generated virtual function overrides
  100. //{{AFX_VIRTUAL(CListCtrlEx)
  101. //}}AFX_VIRTUAL
  102. // Implementation
  103. public:
  104. virtual ~CListCtrlEx();
  105. // Generated message map functions
  106. protected:
  107. //{{AFX_MSG(CListCtrlEx)
  108. //}}AFX_MSG
  109. DECLARE_MESSAGE_MAP()
  110. };
  111. /////////////////////////////////////////////////////////////////////////////
  112. /////////////////////////////////////////////////////////////////////////////
  113. // CTreeCtrlEx window
  114. class CTreeCtrlEx : public CTreeCtrl
  115. {
  116. // Construction
  117. public:
  118. CTreeCtrlEx();
  119. // Attributes
  120. public:
  121. // Operations
  122. public:
  123. CImageList* SetImageList(CImageList* pImageList, int nImageListType = TVSIL_NORMAL);
  124. CTreeCursor GetNextItem(HTREEITEM hItem, UINT nCode);
  125. CTreeCursor GetChildItem(HTREEITEM hItem);
  126. CTreeCursor GetNextSiblingItem(HTREEITEM hItem);
  127. CTreeCursor GetPrevSiblingItem(HTREEITEM hItem);
  128. CTreeCursor GetParentItem(HTREEITEM hItem);
  129. CTreeCursor GetFirstVisibleItem();
  130. CTreeCursor GetNextVisibleItem(HTREEITEM hItem);
  131. CTreeCursor GetPrevVisibleItem(HTREEITEM hItem);
  132. CTreeCursor GetSelectedItem();
  133. CTreeCursor GetDropHilightItem();
  134. CTreeCursor GetRootItem();
  135. CTreeCursor InsertItem(LPTV_INSERTSTRUCT lpInsertStruct);
  136. CTreeCursor InsertItem(UINT nMask, LPCTSTR lpszItem, int nImage,
  137. int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam,
  138. HTREEITEM hParent, HTREEITEM hInsertAfter);
  139. CTreeCursor InsertItem(LPCTSTR lpszItem, HTREEITEM hParent = TVI_ROOT,
  140. HTREEITEM hInsertAfter = TVI_LAST);
  141. CTreeCursor InsertItem(LPCTSTR lpszItem, int nImage, int nSelectedImage,
  142. HTREEITEM hParent = TVI_ROOT, HTREEITEM hInsertAfter = TVI_LAST);
  143. CTreeCursor Select(HTREEITEM hItem, UINT nCode);
  144. CTreeCursor SelectItem(HTREEITEM hItem);
  145. CTreeCursor SelectDropTarget(HTREEITEM hItem);
  146. CTreeCursor SelectSetFirstVisible(HTREEITEM hItem);
  147. CTreeCursor HitTest(CPoint pt, UINT* pFlags = NULL);
  148. CTreeCursor HitTest(TV_HITTESTINFO* pHitTestInfo);
  149. // Overrides
  150. // ClassWizard generated virtual function overrides
  151. //{{AFX_VIRTUAL(CTreeCtrlEx)
  152. //}}AFX_VIRTUAL
  153. // Implementation
  154. public:
  155. virtual ~CTreeCtrlEx();
  156. // Generated message map functions
  157. protected:
  158. //{{AFX_MSG(CTreeCtrlEx)
  159. // NOTE - the ClassWizard will add and remove member functions here.
  160. //}}AFX_MSG
  161. DECLARE_MESSAGE_MAP()
  162. };
  163. /////////////////////////////////////////////////////////////////////////////
  164. #include "CtrlExt.inl"
  165. /////////////////////////////////////////////////////////////////////////////
  166. #endif // __CTRLEXT_H__
  167. /////////////////////////////////////////////////////////////////////////////