Click here to Skip to main content
15,886,873 members
Articles / Desktop Programming / MFC

A Faster Tree Control

,
Rate me:
Please Sign up or sign in to vote.
4.69/5 (13 votes)
16 Dec 2003CPOL5 min read 392.2K   3.7K   82  
An article about an open source and free fast tree control
#if !defined(AFX_RGTREECTRL_H__6DE6C0C5_8498_11D4_843E_02608CA1FA7B__INCLUDED_)
#define AFX_RGTREECTRL_H__6DE6C0C5_8498_11D4_843E_02608CA1FA7B__INCLUDED_

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


/**********************************************************************************************
 *                                                                                            *
 *  FILE: RGTreeCtrl.h                                                                        *
 *                                                                                            *
 *  DESCRIPTION:                                                                              *
 *       Declaration of the TreeCtrl class using the template CRGTreeT                        *
 *                                                                                            *
 *  Ren� Greiner                                                                              *
 *		eMail: rene.greiner@gmx.de                                                            *
 *                                                                                            *
 **********************************************************************************************/

// The following ifdef block is the standard way of creating macros which make exporting 
// from a DLL simpler. All files within this DLL are compiled with the RGTREECTRL_EXPORTS
// symbol defined on the command line. this symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see 
// RGTREECTRL_API functions as being imported from a DLL, wheras this DLL sees symbols
// defined with this macro as being exported.

#pragma once

#ifdef RGTREECTRL_EXPORTS
#define RGTREECTRL_API __declspec(dllexport)
#else
#define RGTREECTRL_API __declspec(dllimport)
#endif

extern "C" RGTREECTRL_API HWND CreateRGTree( DWORD dwStyle, int x, int y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HANDLE hInstance, LPVOID lpParam);

//extern "C" RGTREECTRL_API LRESULT CALLBACK RGTreeWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);

#ifdef __AFX_H__ // MFC project

/////////////////////////////////////////////////////////////////////////////
// CRGTreeCtrl window ( MFC )

class RGTREECTRL_API CRGTreeCtrl : public CTreeCtrl
{
protected:
	virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
	virtual void PreSubclassWindow();
	
	bool m_bCreated;
	
public:
    CRGTreeCtrl();
	
	virtual BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID);
	
	// advanced creation (allows access to extended styles)
	BOOL CreateEx(DWORD dwExStyle, LPCTSTR lpszClassName,
		LPCTSTR lpszWindowName, DWORD dwStyle,
		int x, int y, int nWidth, int nHeight,
		HWND hWndParent, HMENU nIDorHMenu, LPVOID lpParam = NULL);
	
	BOOL CreateEx(DWORD dwExStyle, LPCTSTR lpszClassName,
		LPCTSTR lpszWindowName, DWORD dwStyle,
		const RECT& rect,
		CWnd* pParentWnd, UINT nID,
		LPVOID lpParam = NULL);
};

#endif //__AFX_H__

#endif // !defined(AFX_RGTREECTRL_H__6DE6C0C5_8498_11D4_843E_02608CA1FA7B__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
Software Developer (Senior)
Slovakia Slovakia
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

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

Comments and Discussions