TreeComboBox.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /************************************************************************/
  2. /* Copyright (C), 2016-2020, [IT], 保留所有权利;
  3. /* 模 块 名:;
  4. /* 描 述:;
  5. /*
  6. /* 版 本:[V];
  7. /* 作 者:[IT];
  8. /* 日 期:[11/4/2016];
  9. /*
  10. /*
  11. /* 注 意:;
  12. /*
  13. /* 修改记录:[IT];
  14. /* 修改日期:;
  15. /* 修改版本:;
  16. /* 修改内容:;
  17. /************************************************************************/
  18. #ifndef __TREECOMBOBOX__
  19. #define __TREECOMBOBOX__
  20. #include "ComboTreeCtrl.h"
  21. #pragma once
  22. #ifndef COLOR_RED
  23. #define COLOR_RED RGB(220,0,0)
  24. #endif //COLOR_RED
  25. #ifndef COLOR_ALERT
  26. #define COLOR_ALERT RGB(255,180,180)
  27. #endif //COLOR_ALERT
  28. /////////////////////////////////////////////////////////////////////////////
  29. // CTreeComboBox window
  30. class CTreeComboBox : public CComboBox
  31. {
  32. CString m_pretext;
  33. // Construction
  34. public:
  35. CTreeComboBox();
  36. // Attributes
  37. public:
  38. BOOL m_bTree;
  39. // Operations
  40. public:
  41. void DisplayTree();
  42. void SetTitle(CString sTitle);
  43. BOOL IsAlertBkg(){ return m_bAlertBkg; }
  44. BOOL IsAlertText(){ return m_bAlertText; }
  45. CTreeCtrl& GetTreeCtrl(){ return m_Tree; }
  46. int GetDroppedWidth(){ return m_droppedWidth; };
  47. int GetDroppedHeight(){ return m_droppedHeight; };
  48. void SetDroppedWidth(int nWidth){ m_droppedWidth = nWidth; };
  49. void SetDroppedHeight(int nHeight){ m_droppedHeight = nHeight; };
  50. void AlertBkg(BOOL bAlert = TRUE){ m_bAlertBkg = bAlert; Invalidate(); };
  51. void AlertText(BOOL bAlert = TRUE){ m_bAlertText = bAlert; Invalidate(); };
  52. public:
  53. virtual BOOL PreTranslateMessage(MSG* pMsg);
  54. protected:
  55. virtual void PreSubclassWindow();
  56. public:
  57. void RefDroppedWidth();
  58. UINT GetTreeCount();
  59. void TreeCtrlDone();
  60. virtual ~CTreeComboBox();
  61. protected:
  62. afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  63. afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
  64. afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
  65. afx_msg LRESULT OnCloseControl(WPARAM wParam, LPARAM lParam);
  66. DECLARE_MESSAGE_MAP()
  67. private:
  68. BOOL m_bAlertBkg;
  69. BOOL m_bAlertText;
  70. int m_droppedWidth;
  71. int m_droppedHeight;
  72. HBRUSH m_hBrushAlert;
  73. CComboTreeCtrl m_Tree;
  74. public:
  75. void InsertMyItem(IN CString strRoot, IN CString strItem);
  76. };
  77. #endif // __TREECOMBOBOX__;