UITreeView.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. #ifndef UITreeView_h__
  2. #define UITreeView_h__
  3. #include <vector>
  4. using namespace std;
  5. #pragma once
  6. namespace DuiLib
  7. {
  8. class CTreeViewUI;
  9. class CCheckBoxUI;
  10. class CLabelUI;
  11. class COptionUI;
  12. class UILIB_API CTreeNodeUI : public CListContainerElementUI
  13. {
  14. DECLARE_DUICONTROL(CTreeNodeUI)
  15. public:
  16. CTreeNodeUI(CTreeNodeUI* _ParentNode = NULL);
  17. ~CTreeNodeUI(void);
  18. public:
  19. LPCTSTR GetClass() const;
  20. LPVOID GetInterface(LPCTSTR pstrName);
  21. void DoEvent(TEventUI& event);
  22. void Invalidate();
  23. bool Select(bool bSelect = true);
  24. bool SelectMulti(bool bSelect = true);
  25. bool Add(CControlUI* _pTreeNodeUI);
  26. bool AddAt(CControlUI* pControl, int iIndex);
  27. bool Remove(CControlUI* pControl);
  28. void SetVisibleTag(bool _IsVisible);
  29. bool GetVisibleTag();
  30. void SetItemText(LPCTSTR pstrValue);
  31. CDuiString GetItemText();
  32. void CheckBoxSelected(bool _Selected);
  33. bool IsCheckBoxSelected() const;
  34. bool IsHasChild() const;
  35. long GetTreeLevel();
  36. bool AddChildNode(CTreeNodeUI* _pTreeNodeUI);
  37. bool RemoveAt(CTreeNodeUI* _pTreeNodeUI);
  38. void SetParentNode(CTreeNodeUI* _pParentTreeNode);
  39. CTreeNodeUI* GetParentNode();
  40. long GetCountChild();
  41. void SetTreeView(CTreeViewUI* _CTreeViewUI);
  42. CTreeViewUI* GetTreeView();
  43. CTreeNodeUI* GetChildNode(int _nIndex);
  44. void SetVisibleFolderBtn(bool _IsVisibled);
  45. bool GetVisibleFolderBtn();
  46. void SetVisibleCheckBtn(bool _IsVisibled);
  47. bool GetVisibleCheckBtn();
  48. void SetItemTextColor(DWORD _dwItemTextColor);
  49. DWORD GetItemTextColor() const;
  50. void SetItemHotTextColor(DWORD _dwItemHotTextColor);
  51. DWORD GetItemHotTextColor() const;
  52. void SetSelItemTextColor(DWORD _dwSelItemTextColor);
  53. DWORD GetSelItemTextColor() const;
  54. void SetSelItemHotTextColor(DWORD _dwSelHotItemTextColor);
  55. DWORD GetSelItemHotTextColor() const;
  56. void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
  57. CStdPtrArray GetTreeNodes();
  58. int GetTreeIndex();
  59. int GetNodeIndex();
  60. public:
  61. CHorizontalLayoutUI* GetTreeNodeHoriznotal() const {return pHoriz;};
  62. CCheckBoxUI* GetFolderButton() const {return pFolderButton;};
  63. CLabelUI* GetDottedLine() const {return pDottedLine;};
  64. CCheckBoxUI* GetCheckBox() const {return pCheckBox;};
  65. COptionUI* GetItemButton() const {return pItemButton;};
  66. private:
  67. CTreeNodeUI* GetLastNode();
  68. CTreeNodeUI* CalLocation(CTreeNodeUI* _pTreeNodeUI);
  69. private:
  70. long m_iTreeLavel;
  71. bool m_bIsVisable;
  72. bool m_bIsCheckBox;
  73. DWORD m_dwItemTextColor;
  74. DWORD m_dwItemHotTextColor;
  75. DWORD m_dwSelItemTextColor;
  76. DWORD m_dwSelItemHotTextColor;
  77. CTreeViewUI* pTreeView;
  78. CHorizontalLayoutUI* pHoriz;
  79. CCheckBoxUI* pFolderButton;
  80. CLabelUI* pDottedLine;
  81. CCheckBoxUI* pCheckBox;
  82. COptionUI* pItemButton;
  83. CTreeNodeUI* pParentTreeNode;
  84. CStdPtrArray mTreeNodes;
  85. };
  86. class UILIB_API CTreeViewUI : public CListUI,public INotifyUI
  87. {
  88. DECLARE_DUICONTROL(CTreeViewUI)
  89. public:
  90. CTreeViewUI(void);
  91. ~CTreeViewUI(void);
  92. public:
  93. virtual LPCTSTR GetClass() const;
  94. virtual LPVOID GetInterface(LPCTSTR pstrName);
  95. virtual UINT GetListType();
  96. virtual bool Add(CTreeNodeUI* pControl );
  97. virtual long AddAt(CTreeNodeUI* pControl, int iIndex );
  98. virtual bool AddAt(CTreeNodeUI* pControl,CTreeNodeUI* _IndexNode);
  99. virtual bool Remove(CTreeNodeUI* pControl);
  100. virtual bool RemoveAt(int iIndex);
  101. virtual void RemoveAll();
  102. virtual bool OnCheckBoxChanged(void* param);
  103. virtual bool OnFolderChanged(void* param);
  104. virtual bool OnDBClickItem(void* param);
  105. virtual bool SetItemCheckBox(bool _Selected,CTreeNodeUI* _TreeNode = NULL);
  106. virtual void SetItemExpand(bool _Expanded,CTreeNodeUI* _TreeNode = NULL);
  107. virtual void Notify(TNotifyUI& msg);
  108. virtual void SetVisibleFolderBtn(bool _IsVisibled);
  109. virtual bool GetVisibleFolderBtn();
  110. virtual void SetVisibleCheckBtn(bool _IsVisibled);
  111. virtual bool GetVisibleCheckBtn();
  112. virtual void SetItemMinWidth(UINT _ItemMinWidth);
  113. virtual UINT GetItemMinWidth();
  114. virtual void SetItemTextColor(DWORD _dwItemTextColor);
  115. virtual void SetItemHotTextColor(DWORD _dwItemHotTextColor);
  116. virtual void SetSelItemTextColor(DWORD _dwSelItemTextColor);
  117. virtual void SetSelItemHotTextColor(DWORD _dwSelHotItemTextColor);
  118. virtual void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
  119. private:
  120. UINT m_uItemMinWidth;
  121. bool m_bVisibleFolderBtn;
  122. bool m_bVisibleCheckBtn;
  123. };
  124. }
  125. #endif // UITreeView_h__