Click here to Skip to main content
12,691,777 members (29,561 online)
Click here to Skip to main content

Stats

104.7K views
4.5K downloads
35 bookmarked
Posted

Tree control templates

, 11 Jun 2001 CPOL
Three tree control templates to easily operate with CTreeCtrl derived objects
/////////////////////////////////////////////////////////////////////
// Template: TTCExpand
// Purpose : Template to expand or collapse all items of a CTreeCtrl
//				derived object
// Created : SEN (1- Jun - 2001)
// History : None
// 
// Copyright (c) 2001 by Francisco Jos� Sen del Prado
// All rights reserved.
/////////////////////////////////////////////////////////////////////


// TCExpand.h : header file
//

#if !defined(_TCEXPAND_H__INCLUDED_)
#define _TCEXPAND_H__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#ifndef __AFXTEMPL_H__
	#pragma message ("To avoid this warning message place #include <afxtempl.h> in your stdafx.h precompiler headers file")
	#include <afxtempl.h>
#endif

/////////////////////////////////////////////////////////////////////////////
// TTCExpand (Declaration)

template <class T>
class TTCExpand : public T
{
// Operations
public:
	void ExpandItem(HTREEITEM hti= TVI_ROOT, UINT nCode= TVE_EXPAND);
};


/////////////////////////////////////////////////////////////////////////////
// TTCExpand (Implementation)

template <class T>
void TTCExpand<T>::ExpandItem(HTREEITEM hti, UINT nCode)
{
	bool bOk= true;

	bOk= Expand(hti, nCode) != 0;

	if (bOk)
	{
		HTREEITEM htiChild= GetChildItem(hti);

		while (htiChild != NULL)
		{
			ExpandItem(htiChild, nCode);

			htiChild= GetNextSiblingItem(htiChild);
		}
	}
}

#endif // !defined(_TCEXPAND_H__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)

Share

About the Author

Francisco José Sen del Prado
Software Developer (Senior)
Spain Spain
I started programming in Basic language when I was 14 years old. The second programming language I learned was Z80 assembler. I've been programming with C++ for the last 20 years. I attended the 2012 C++ Now event in Aspen and it was the most exciting experience I've lived in my professional life. I met a lot of brilliant C++ minds and I have very good memories from that trip.

You may also be interested in...

Pro
Pro
| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170117.1 | Last Updated 12 Jun 2001
Article Copyright 2001 by Francisco José Sen del Prado
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid