⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tree.cpp

📁 下载整个站点,将某一站点的资源全部下载,只要输入正确合法的站址!
💻 CPP
字号:
/*
	Tree.cpp : implementation of the CTree class

	Implements the tree class used to list downloaded pages, table of contents
	and multimedia files.

	Author: Steven E. Sipe
*/

#include "stdafx.h"
#include "tree.h"
#include "inet.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CTree

// Constructor
CTree::CTree()
{
}

// Destructor
CTree::~CTree()
{
}

BEGIN_MESSAGE_MAP(CTree, CTreeCtrl)
	//{{AFX_MSG_MAP(CTree)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

// Adds an item to the root of the tree
HTREEITEM CTree::AddRootItem(LPCSTR lpszTitle, int nImage)
{
	return(InsertItem(lpszTitle,nImage,nImage,TVI_ROOT,TVI_LAST));
}

// Adds a child item under the specified parent node
HTREEITEM CTree::AddChildItem(LPCTSTR lpszTitle, HTREEITEM htreeParent, int nImage)
{
	return(InsertItem(lpszTitle,nImage,nImage,htreeParent,TVI_LAST));
}

// Returns the proper multimedia node type based on the provide filename
CTree::NODE_TYPE CTree::GetMediaType(CString& strFileName)
{
	NODE_TYPE nodeType = CTree::IMAGE_NODE;

	// Get the extension of the file
	CString strExt = CInet::SplitFileName(strFileName,CInet::EXT);
	strExt.MakeLower();

	CString strTest = strFileName;

	// Is it mail link?
 	if(strTest.Left(7) == "mailto:")      
 		nodeType = CTree::EMAIL_NODE;
	else 
	{
		// Sound file?
		if(strExt == ".wav" || strExt == ".au" || strExt == ".mid" || strExt == ".midi")
			nodeType = CTree::WAVE_NODE;
		else if(strExt == ".txt" || strExt == ".pdf")
			nodeType = CTree::DOC_NODE;
		else if(strExt == ".class")
			nodeType = CTree::JAVA_NODE;
	}

	// Return the type
	return(nodeType);
}

/////////////////////////////////////////////////////////////////////////////
// CTree message handlers

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -