TreeComboBox.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #if !defined(AFX_TREECOMBOBOX_H__B9544E92_7215_4D8B_9DF2_67F232BA4014__INCLUDED_)
  2. #define AFX_TREECOMBOBOX_H__B9544E92_7215_4D8B_9DF2_67F232BA4014__INCLUDED_
  3. #include "ComboTreeCtrl.h"
  4. #if _MSC_VER > 1000
  5. #pragma once
  6. #endif // _MSC_VER > 1000
  7. // TreeComboBox.h : header file
  8. //
  9. #ifndef COLOR_RED
  10. #define COLOR_RED RGB(220,0,0)
  11. #endif //COLOR_RED
  12. #ifndef COLOR_ALERT
  13. #define COLOR_ALERT RGB(255,180,180)
  14. #endif //COLOR_ALERT
  15. /////////////////////////////////////////////////////////////////////////////
  16. // CTreeComboBox window
  17. class CTreeComboBox : public CComboBox
  18. {
  19. CString m_pretext;
  20. // Construction
  21. public:
  22. CTreeComboBox();
  23. // Attributes
  24. public:
  25. BOOL m_bTree;
  26. // Operations
  27. public:
  28. void DisplayTree();
  29. void SetTitle(CString sTitle);
  30. BOOL IsAlertBkg(){return m_bAlertBkg;}
  31. BOOL IsAlertText(){return m_bAlertText;}
  32. CTreeCtrl& GetTreeCtrl(){return m_Tree;}
  33. int GetDroppedWidth(){return m_droppedWidth;};
  34. int GetDroppedHeight(){return m_droppedHeight;};
  35. void SetDroppedWidth(int nWidth){m_droppedWidth = nWidth;};
  36. void SetDroppedHeight(int nHeight){m_droppedHeight = nHeight;};
  37. void AlertBkg(BOOL bAlert = TRUE){m_bAlertBkg = bAlert;Invalidate();};
  38. void AlertText(BOOL bAlert = TRUE){m_bAlertText = bAlert;Invalidate();};
  39. // Overrides
  40. // ClassWizard generated virtual function overrides
  41. //{{AFX_VIRTUAL(CTreeComboBox)
  42. public:
  43. virtual BOOL PreTranslateMessage(MSG* pMsg);
  44. protected:
  45. virtual void PreSubclassWindow();
  46. //}}AFX_VIRTUAL
  47. // Implementation
  48. public:
  49. void InitTree();
  50. void RefDroppedWidth();
  51. UINT GetTreeCount();
  52. void TreeCtrlDone();
  53. virtual ~CTreeComboBox();
  54. // Generated message map functions
  55. protected:
  56. //{{AFX_MSG(CTreeComboBox)
  57. afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  58. afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
  59. afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
  60. //}}AFX_MSG
  61. afx_msg LRESULT OnCloseControl(WPARAM wParam, LPARAM lParam);
  62. DECLARE_MESSAGE_MAP()
  63. private:
  64. BOOL m_bAlertBkg;
  65. BOOL m_bAlertText;
  66. int m_droppedWidth;
  67. int m_droppedHeight;
  68. HBRUSH m_hBrushAlert;
  69. CComboTreeCtrl m_Tree;
  70. };
  71. /////////////////////////////////////////////////////////////////////////////
  72. //{{AFX_INSERT_LOCATION}}
  73. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  74. #endif // !defined(AFX_TREECOMBOBOX_H__B9544E92_7215_4D8B_9DF2_67F232BA4014__INCLUDED_)