Click here to Skip to main content
15,896,063 members
Articles / Desktop Programming / MFC

Tree ComboBox Control

Rate me:
Please Sign up or sign in to vote.
4.91/5 (18 votes)
16 Oct 2014CPOL1 min read 75.9K   4.8K   68  
Tree ComboBox Control
#if !defined(AFX_COMBOTREECTRL_H__FE1D96F3_B70F_4E65_8203_B37AE69DB82D__INCLUDED_)
#define AFX_COMBOTREECTRL_H__FE1D96F3_B70F_4E65_8203_B37AE69DB82D__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ComboTreeCtrl.h : header file
//

#define TREECTRL_CHECK_STATE_CHANGE			(WM_USER + 64)
#define WMU_CLOSE_CONTROL					(WM_USER + 65)
/////////////////////////////////////////////////////////////////////////////
// CComboTreeCtrl window

class CTreeComboBox;

class CComboTreeCtrl : public CTreeCtrl
{
// Construction
public:
	CComboTreeCtrl();

// Attributes
protected:
	CTreeComboBox* m_pCombo;

// Operations
protected:
	virtual int UncheckChilds(HTREEITEM hItem = NULL, BOOL bRecurse = TRUE);
	virtual void GetTreeHierarchy(HTREEITEM hItem, CString& sTreeHierarchy, const BOOL bTopToBottom);
	virtual HTREEITEM FindItem(const CString& sName, HTREEITEM hRoot);

// Attributes
public:

// Operations
public:
	virtual void Display(CRect rect);

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CComboTreeCtrl)
	public:
	virtual BOOL PreTranslateMessage(MSG* pMsg);
	//}}AFX_VIRTUAL

// Implementation
public:
	void Init(CTreeComboBox* pCombo){m_pCombo = pCombo;};
	virtual ~CComboTreeCtrl();

	// Generated message map functions
protected:
	//{{AFX_MSG(CComboTreeCtrl)
	afx_msg void OnKillfocus(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnClick(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnKeydown(NMHDR* pNMHDR, LRESULT* pResult);
	//}}AFX_MSG
	afx_msg LRESULT OnTreeCtrlCheckStateChange(WPARAM wParam, LPARAM lParam);
	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_COMBOTREECTRL_H__FE1D96F3_B70F_4E65_8203_B37AE69DB82D__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Romania Romania
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions