Click here to Skip to main content
12,395,593 members (60,134 online)
Click here to Skip to main content

Stats

211.1K views
5.4K downloads
105 bookmarked
Posted

Fast Binary Tree Operations

, 22 Jan 2005
Describes main binary tree operations.
// BinaryTreeDemoDlg.h : header file
//

#pragma once
#include "afxwin.h"
#include "afxcmn.h"
#include "RBTree.h"

#define RBTNODE CRBTreeNode<string, HTREEITEM>
#define TNODE CBinaryTreeNode<string, HTREEITEM>

// CBinaryTreeDemoDlg dialog
class CBinaryTreeDemoDlg : public CDialog
{
// Construction
public:
	CBinaryTreeDemoDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	enum { IDD = IDD_BINARYTREEDEMO_DIALOG };
	CSize m_size;
	CImageList m_imageList;

	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support

	int ParseFolder(LPCSTR lpcsFolder);
	void InsertItem(int nChild, TNODE* pNode, HTREEITEM hParent);
	void Expand(TNODE* pNode);
	void Select(TNODE* pNode);

// Implementation
protected:
	HICON m_hIcon;
	CRBTree<string, LPCSTR, HTREEITEM, HTREEITEM> m_rbTree;

	// Generated message map functions
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	DECLARE_MESSAGE_MAP()
public:
	CStatic m_staticStatus;
	CTreeCtrl m_tree;
	CString m_strFolder;
	CString m_strExt;
	BOOL m_bRedBlack;
	afx_msg void OnBnClickedBrowse();
	afx_msg void OnBnClickedOk();
	afx_msg void OnBnClickedClear();
	afx_msg void OnBnClickedDelete();
	afx_msg void OnBnClickedSuccessor();
	afx_msg void OnBnClickedPredecessor();
	afx_msg void OnBnClickedMin();
	afx_msg void OnBnClickedMax();
	afx_msg void OnTvnItemexpandingTree1(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnBnClickedCheck1();
	afx_msg void OnDestroy();
};

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

Share

About the Author


You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.160721.1 | Last Updated 23 Jan 2005
Article Copyright 2004 by Hatem Mostafa
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid