OptionTreeItem.h
Upload User: kairuinn
Upload Date: 2009-02-07
Package Size: 2922k
Code Size: 4k
Category:

Graph program

Development Platform:

Visual C++

  1. // COptionTree
  2. //
  3. // License
  4. // -------
  5. // This code is provided "as is" with no expressed or implied warranty.
  6. // 
  7. // You may use this code in a commercial product with or without acknowledgement.
  8. // However you may not sell this code or any modification of this code, this includes 
  9. // commercial libraries and anything else for profit.
  10. //
  11. // I would appreciate a notification of any bugs or bug fixes to help the control grow.
  12. //
  13. // History:
  14. // --------
  15. // See License.txt for full history information.
  16. //
  17. //
  18. // Copyright (c) 1999-2002 
  19. // ComputerSmarts.net 
  20. // mattrmiller@computersmarts.net
  21. #ifndef OT_TREEITEM
  22. #define OT_TREEITEM
  23. #if _MSC_VER > 1000
  24. #pragma once
  25. #endif // _MSC_VER > 1000
  26. // Added Headers
  27. //////#include "CommonRes.h"
  28. #include "OptionTreeDef.h"
  29. // Classes
  30. class COptionTree;
  31. class COptionTreeItem  
  32. {
  33. public:
  34. COLORREF GetTextColor();
  35. void SetTextColor(COLORREF crColor);
  36. COLORREF GetLabelBackgroundColor();
  37. void SetLabelBackgroundColor(COLORREF crColor);
  38. COLORREF GetRootBackgroundColor();
  39. void SetRootBackgroundColor(COLORREF crColor);
  40. COLORREF GetLabelTextColor();
  41. void SetLabelTextColor(COLORREF crColor);
  42. COLORREF GetBackgroundColor();
  43. void SetBackgroundColor(COLORREF crColor);
  44. BOOL GetDrawMultiline();
  45. void SetDrawMultiline(BOOL bMultiline);
  46. int GetItemType();
  47. void SetItemType(int nType);
  48. void SetLabelRect(CRect rcLabel);
  49. CRect GetLabelRect();
  50. virtual void DrawAttribute(CDC *pDC, const RECT &rcRect);
  51. virtual void OnActivate();
  52. virtual void OnMove();
  53. virtual void OnRefresh();
  54. virtual void OnCommit();
  55. virtual void CleanDestroyWindow();
  56. virtual void OnDeSelect();
  57. virtual void OnSelect();
  58. virtual void OnExpand(BOOL bExpand);
  59. void SetItemHeight(long lHeight);
  60. void CommitChanges();
  61. void Activate();
  62. long GetHeight();
  63. long DrawItem(CDC* pDC, const RECT &rcRect, long x, long y);
  64. void SetOptionsOwner(COptionTree* otOption);
  65. long GetTotalHeight();
  66. BOOL IsRootLevel();
  67. BOOL HitExpand(const POINT& pt);
  68. void ReadOnly(BOOL bReadOnly = TRUE);
  69. void Expand(BOOL bExpand = TRUE);
  70. void Select(BOOL bSelect = TRUE);
  71. BOOL IsActivated();
  72. BOOL IsReadOnly();
  73. BOOL IsSelected();
  74. BOOL IsExpanded();
  75. void SetNextVisible(COptionTreeItem *otiNextVisible);
  76. COptionTreeItem * GetNextVisible();
  77. void SetChild(COptionTreeItem *otiChild);
  78. COptionTreeItem * GetChild();
  79. void SetSibling(COptionTreeItem *otiSibling);
  80. COptionTreeItem * GetSibling();
  81. void SetParent(COptionTreeItem *otiParent);
  82. COptionTreeItem * GetParent();
  83. UINT GetCtrlID();
  84. void SetCtrlID(UINT nID);
  85. CString GetLabelText();
  86. void SetLabelText(CString strLabel);
  87. CString GetInfoText();
  88. void SetInfoText(CString strText);
  89. const POINT& GetLocation();
  90. COptionTreeItem();
  91. virtual ~COptionTreeItem();
  92. protected:
  93. void _DrawExpand(HDC hdc, long lX, long lY, BOOL bExpand, BOOL bFill);
  94. BOOL IsStringEmpty(CString strString);
  95. protected:
  96. CString m_strLabel;
  97. CString m_strInfoText;
  98. UINT m_uControlID;
  99. COptionTreeItem *m_otiParent;
  100. COptionTreeItem *m_otiSibling;
  101. COptionTreeItem *m_otiChild;
  102. COptionTreeItem *m_otiNextVisible;
  103. CRect m_rcExpand;
  104. COptionTree *m_otOption;
  105. CPoint m_ptLocation;
  106. CRect m_rcAttribute;
  107. BOOL m_bCommitOnce;
  108. LPARAM m_lParam;
  109. long m_lItemHeight;
  110. CRect m_rcLabelRect;
  111. BOOL m_bSelected;
  112. BOOL m_bExpanded;
  113. BOOL m_bActivated;
  114. BOOL m_bReadOnly;
  115. int m_nItemType;
  116. BOOL m_bDrawMultiline;
  117. COLORREF m_crBackground;
  118. COLORREF m_crText;
  119. COLORREF m_crRootBackground;
  120. COLORREF m_crLabelText;
  121. COLORREF m_crLabelBackground;
  122. };
  123. #endif // !OT_TREEITEM