TreeMenuFrame.h
上传用户:rxhxxy
上传日期:2007-01-02
资源大小:72k
文件大小:4k
源码类别:

TreeView控件

开发平台:

Visual C++

  1. #if !defined(_TREEMENUFRAME_H_)
  2. #define _TREEMENUFRAME_H_
  3. #if _MSC_VER >= 1000
  4. #pragma once
  5. #endif // _MSC_VER >= 1000
  6. // TreeMenuFrame.h : header file
  7. //
  8. #include "TreeMenu.h"
  9. /////////////////////////////////////////////////////////////////////////////
  10. // CTreeMenuFrame window
  11. #define IDC_CAPTION (5100)
  12. #define IDC_BEVEL (5101)
  13. #define IDC_BEVELL (5102)
  14. #define IDC_BEVELR (5103)
  15. #define IDC_LINE (5104)
  16. #define IDC_BTN_HIDE (5105)
  17. #define TMFN_HIDE WM_USER + 1001
  18. #define TMFN_CAPTIONDRAG WM_USER + 1002
  19. #define TREEMENUCTRL_CLASSNAME _T("TreeMenuControl")
  20. class CFlatBtn : public CButton
  21. {
  22. // Construction
  23. public:
  24. CFlatBtn();
  25. BOOL m_bLBtnDown;
  26. COLORREF m_clrHotText;
  27. //{{AFX_VIRTUAL(CFlatBtn)
  28. public:
  29. virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
  30. //}}AFX_VIRTUAL
  31. // Implementation
  32. protected:
  33. COLORREF m_clrFace;
  34. COLORREF m_clrText;
  35. CString strText;
  36. CRect m_rect;
  37. public:
  38. virtual ~CFlatBtn();
  39. // Generated message map functions
  40. protected:
  41. //{{AFX_MSG(CFlatBtn)
  42. afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  43. afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  44. afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  45. afx_msg void OnTimer(UINT nIDEvent);
  46. //}}AFX_MSG
  47. DECLARE_MESSAGE_MAP()
  48. };
  49. class CDragCaption : public CStatic {
  50. public:
  51. DECLARE_DYNAMIC(CDragCaption)
  52. CDragCaption(LPCTSTR lpText = NULL, BOOL bDeleteOnDestroy=FALSE);
  53. ~CDragCaption() { }
  54. BOOL SubclassDlgItem(UINT nID, CWnd* pParent) {
  55. return CStatic::SubclassDlgItem(nID, pParent);
  56. }
  57. COLORREF m_color;
  58. protected:
  59. CFont m_font;
  60. BOOL m_bDeleteOnDestroy; // delete object when window destroyed?
  61. virtual void PostNcDestroy();
  62. // message handlers
  63. DECLARE_MESSAGE_MAP()
  64. afx_msg UINT OnNcHitTest(CPoint point);
  65. afx_msg HBRUSH  CtlColor(CDC* pDC, UINT nCtlColor);
  66. afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  67. };
  68. class CTreeMenuFrame : public CWnd
  69. {
  70. // Construction
  71. public:
  72. CTreeMenuFrame();
  73. DECLARE_DYNCREATE(CTreeMenuFrame)
  74. // Attributes
  75. public:
  76. CDragCaption m_stcCaption;
  77. CFont m_captionFont;
  78. CStatic m_stcBevel;
  79. CStatic m_stcBevelLeft;
  80. CStatic m_stcBevelRight;
  81. CStatic     m_stcLine;
  82. CTreeMenu m_tree;
  83. CFlatBtn m_btn;
  84. // Operations
  85. private:
  86. void Initialize();
  87. public:
  88. void RegisterClass();
  89. BOOL Create(const RECT& rect, CWnd* parent, UINT nID,
  90.                 DWORD dwStyle = WS_CHILD | WS_TABSTOP | WS_VISIBLE);
  91. BOOL SubclassDlgItem(UINT nID, CWnd* parent); // use in CDialog/CFormView
  92. CTreeMenu* GetTreeMenuCtrl() { return &m_tree;}
  93. void Hide(BOOL hide = TRUE);
  94. void ShowSideBevels(BOOL SideBevels = TRUE) { bSideBevels = SideBevels;}
  95. void ShowFrameBevel(BOOL FrameBevel = TRUE) { bFrameBevel = FrameBevel;}
  96. void CalcLayout(BOOL bParent = FALSE);
  97. // Overrides
  98. // ClassWizard generated virtual function overrides
  99. //{{AFX_VIRTUAL(CTreeMenuFrame)
  100. public:
  101. virtual BOOL PreTranslateMessage(MSG* pMsg);
  102. //}}AFX_VIRTUAL
  103. // Implementation
  104. public:
  105. virtual ~CTreeMenuFrame();
  106. // Generated message map functions
  107. protected:
  108. BOOL bSideBevels;
  109. BOOL bFrameBevel;
  110. CToolTipCtrl m_ToolTip;
  111. //{{AFX_MSG(CTreeMenuFrame)
  112. afx_msg void OnButtonHide();
  113. afx_msg void OnCaptionDrag();
  114.     afx_msg void OnSize(UINT nType, int cx, int cy);
  115. //}}AFX_MSG
  116. DECLARE_MESSAGE_MAP()
  117. };
  118. /////////////////////////////////////////////////////////////////////////////
  119. //{{AFX_INSERT_LOCATION}}
  120. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  121. #endif // !defined(_TREEMENUFRAME_H_)