Click here to Skip to main content
15,897,273 members
Articles / Desktop Programming / MFC

My Tree Control

Rate me:
Please Sign up or sign in to vote.
1.09/5 (11 votes)
10 Nov 20052 min read 66.8K   1.5K   21  
A tree control that is like a template and stores items.
#ifndef __CListWizard__
#define __CListWizard__

#include "newwizpage.h"
#include <string>
#include <list>
#include <hash_map>
#include "afxcmn.h"
#include "afxwin.h"
using namespace std;

#ifdef DLL_EXPORT
class __declspec(dllexport) CListWizard :
	public CNewWizPage
#else
class __declspec(dllimport) CListWizard :
	public CNewWizPage
#endif
{

protected:
	class CMyCheckLListBox : public CCheckListBox
	{

	};

public:
	typedef list<pair<string,DWORD> > WizItemList;

	CListWizard(LPCSTR Column[],   //array of column's names
				int NumOfColumns,  //size of array
				int  RowsNum,    //number of rows
				bool HasCheckBoxes,//
				WizItemList& GridData, //grid data
				void (*CallNextOnItem)(DWORD CodeID,DWORD PageID),//called when user press Next on wizard
				void (*CallFinishOnItem)(DWORD CodeID,DWORD PageID), //called when user selects item and finish wizard
				LPCSTR pTitle,
				LPCSTR pUpperText, //save upperText
				HBITMAP hBitmap,
				int   PageID,
				CWnd* pParent = NULL);   // standard constructor

	virtual ~CListWizard(void);

	protected:
	DECLARE_MESSAGE_MAP()
	virtual BOOL OnInitDialog();
	CListCtrl m_List;
	virtual void DoDataExchange(CDataExchange* pDX);
	void OnSetActive();
	BOOL OnWizardFinish();

	virtual LRESULT OnWizardBack();
	virtual LRESULT OnWizardNext();

	virtual BOOL  CheckSelection();

	virtual BOOL OnWizardCheckBeforeFinish();

	const bool m_HasCheckBoxes;

	list<string> m_ColumnList;
	WizItemList m_GridDataList;

	const string m_Title;
	const string m_UpperText;
	const int    m_PageID;

	void (*m_CallNextOnItem)(DWORD CodeID,DWORD PageID);

	void (*m_CallFinishOnItem)(DWORD CodeID,DWORD PageID);

	const int m_RowsNum;

	int m_SelectionMark;

	CStatic m_StaticPicture;

	HBITMAP m_hBitmap;
};

#endif

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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


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

Comments and Discussions