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

📄 dirtreeview.h

📁 c++系统开发实例精粹内附的80例源代码 环境:windows2000,c++6.0
💻 H
字号:
//////////////////////////////////////////////////////////////////////
// FileFury
// Copyright (c) 2000 Tenebril Incorporated
// All rights reserved.
//
// This source code is governed by the Tenebril open source
// license (http://www.tenebril.com/developers/opensource/license.html)
//
// For more information on this and other open source applications,
// visit the Tenebril OpenSource page:
//       http://www.tenebril.com/developers/opensource
//
//////////////////////////////////////////////////////////////////////

// treeview.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// CTreeCtrlView view

#include "FileSystem.h"
#include "FileInfoArray.h"

class CDirTreeView : public CView
{
protected:
	CTreeCtrl	   m_Tree;
	CImageList*    m_pDragImage;
	BOOL	       m_bDragging;
	HTREEITEM	   m_hDragItem, m_hDropItem;
	int			   m_nDropIndex;
	CWnd*		   m_pDropWnd;
	CFileSystem   *m_pFileSystem;
	CString        m_strPath;

	void DropItemOnTree (CTreeCtrl* pTree);
	void DropItemOnList (CListCtrl* pList);

	CDirTreeView();           // protected constructor used by dynamic creation
	DECLARE_DYNCREATE(CDirTreeView)

// Attributes
public:

	BOOL SetSelPath( LPCTSTR strPath );
	LPCTSTR GetFileDisplayName(LPCTSTR strName);
	CString GetFullPath( HTREEITEM hItem );
	LPCTSTR GetSubPath( LPCTSTR strPath );
	BOOL DisplayTree( LPCTSTR strRoot, BOOL bForceUpdate = FALSE );

// Operations
public:
	BOOL RecolorChildren(HTREEITEM hItem);
	BOOL ReplaceDirectory(LPCTSTR czOldName, LPCTSTR czNewName);
	void OnBeginRDrag(NMHDR *pnmhdr, LRESULT *pResult);
	BOOL RemoveDirectory(LPCTSTR czDirPath);
	CString GetMachineName();
	BOOL SetIcon(HTREEITEM hItem, int nImage, int nSelectedImage);
	HTREEITEM SelectedItem();
	void AllowReload(BOOL bAllow);
	HTREEITEM SearchSiblingItem( HTREEITEM hItem, LPCTSTR strText,
		BOOL bAdhereSiblings = FALSE);

	HTREEITEM AddItem( HTREEITEM hParent, LPCTSTR strPath );

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CTreeCtrlView)
	protected:
	virtual void OnDraw(CDC* pDC);      // overridden to draw this view
	//}}AFX_VIRTUAL

// Implementation
protected:
	virtual ~CDirTreeView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

	// Generated message map functions
protected:
	BOOL m_bDragShowMenu;
	afx_msg void OnKeyDown(NMHDR *pNMHDR, LRESULT *pResult);
	HTREEITEM m_hLastDropHilight;
	BOOL IsValidPath( LPCTSTR strPath );
	void ExpandItem( HTREEITEM hItem, UINT nCode );
	BOOL FindSubDir( LPCTSTR strPath );
	void DisplayPath( HTREEITEM hParent, LPCTSTR strPath );
	BOOL DisplayDrives();
	CString m_strError;
	BOOL GetSysImgList();
	CImageList *m_pImgList;
	bool m_bOwnsImgList;
	CString m_strRoot;
	CString m_csRealRoot;
	CFileInfoArray m_cFileArray;

	//{{AFX_MSG(CDirTreeView)
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
	//}}AFX_MSG
	afx_msg void OnBeginDrag (NMHDR* pnmhdr, LRESULT* pResult);
	afx_msg void OnItemexpanded(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnSelChanged(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnEndLabelEdit(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnRClick(NMHDR *pMessageHeader, LRESULT *pResult);

	DECLARE_MESSAGE_MAP()
private:
	BOOL m_bAllowReload;
};

/////////////////////////////////////////////////////////////////////////////

⌨️ 快捷键说明

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