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

📄 detailview.h

📁 磁盘容量扫描、但界面和程序结构非常不错
💻 H
字号:
// DetailView.h : interface of the CDetailView class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_DETAILVIEW_H__C3455E3D_7FBF_11D2_929A_0080C8E7F1DB__INCLUDED_)
#define AFX_DETAILVIEW_H__C3455E3D_7FBF_11D2_929A_0080C8E7F1DB__INCLUDED_

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

#include <afxtempl.h>

#define WM_FOLDER_RESELECTED WM_USER+20

/////////////////////////////////////////////////////////////////////////////
// CInfoCtrl window
class CInfoCtrl : public CWnd
{
public:
	int DrawItemArray(CDC* pDC, CRect rc, int nItem);
	class CInfoCtrlItem;
	typedef CTypedPtrArray<CObArray, CInfoCtrlItem*> CInfoCtrlItemArray;
	CInfoCtrlItemArray m_arrayDiskInfo, m_arrayInfoItem, m_arrayRootItem;

	CFont m_font;

	CString m_strDriveTitle, m_strFolderTitle;

	void InsertColumn(UINT, CInfoCtrlItemArray* pArray);
	void DrawPercentItem(CDC* pDC, const CRect& rc, CInfoCtrlItem* pItem);
	void DrawTextItem(CDC* pDC, const CRect& rc, CInfoCtrlItem* pItem);
	void UpdateCtrl();
	void SetValue(UINT nID, const CString& str, int nT, int nArray);
	void ResetInfoValues();
	void ResetDriveValues();
	void ResetRootValues();
	
	CInfoCtrl();
	virtual ~CInfoCtrl();
	
	virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
	
	// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CInfoCtrl)
	//}}AFX_VIRTUAL
	
	// Generated message map functions
protected:
	//{{AFX_MSG(CInfoCtrl)
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnPaint();
	afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

class CInfoCtrl::CInfoCtrlItem : public CObject
{
public:
	CInfoCtrlItem(): m_nITEMID(0), m_strItemName(""), m_nPercentData(-1), m_strTextData(""){;}
	~CInfoCtrlItem() {;}

	UINT m_nITEMID;
	CString m_strItemName;
	int m_nPercentData; // = -1 if the item contains text data
	CString m_strTextData;
};

/////////////////////////////////////////////////////////////////////////////
// CDetailView window

#include "DiskTreeCtrl.h"
#include "Common/PieChartCtrl.h"
#include "Common/ListCtrlEx.h"
#include "Common/Splitwnd.h"
#include "Common/FlatHeaderCtrl.h"

class CDetailView : public CView
{
	// For printing
	/*ont m_printerFont;
	CFont m_headerFont;
	UINT m_nCharWidth;
	
	UINT m_cyItemHeight;
	UINT m_cxOffset;
    UINT m_cxWidth;

    int m_nItemsPerPage;
	int m_nItemsTotal;

	void PrintPageHeader (CDC*, UINT, UINT);*/
	CFlatHeaderCtrl m_wndFlatHeader; // For the subitem list
public:
	CDetailView();

// Attributes
public:
	CDiskTreeCtrl m_wndDiskTree;
	int m_nInfoWidth, m_nInfoHeight;
	BOOL m_bVerMode;
	BOOL m_bScanFinished;

	CPieChartCtrl m_wndChart;
	CListCtrlEx m_wndChartInfo;
	CImageList m_imgColorList;
	BOOL m_bShowChart, m_bShowInfo;

	CSplitWnd m_wndSplitVer, m_wndSplitHor;

	CInfoCtrl m_wndInfo;

	CString m_strTitle;
	CFont m_fontTitle;
	CRect m_rcTitle;

	int m_nMouseInCode;
	BOOL m_bMouseDown;
	BOOL m_bFirstTime;

	CMyFolder m_folder;
	CMyFolder* m_pSelectedFolder;
	BOOL m_bSelectedIsFile;

	int m_nSortedCol;
	static BOOL m_bChartInfoSortAscending;
	static int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);

	
// Operations
public:

	// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CDetailView)
	protected:
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	virtual void OnDraw(CDC* pDC);
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnPrint(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrintPreview(CDC* pDC, CPrintInfo* pInfo, POINT point, CPreviewView* pView);
	//}}AFX_VIRTUAL

// Implementation
public:
	void AutoResizeColumns();
	void OnPrintPreview();
	void ShowMe();
	void OnSplitWnd();
	void UpdateFolderChart(CMyFolder* pFolder);
	// Compare two folders to sort
	// Used in UpdateFolderChart
	static int CompareFolderSize(const void* f1, const void* f2);
	void SetCurrentFolder(CString& str);
	void OnSelectFolder();
	void OnRescan();
	void Reset();
	void RedrawItem(int nCode);
	int HitTestEx(const CPoint& pt);
	void SetTitle(const CString& str);
	void RepositionCtrls();
	virtual ~CDetailView();

	void UpdateShowInfo();
	void UpdateShowChart();

	afx_msg void OnStop();
	// Generated message map functions
protected:
	//{{AFX_MSG(CDetailView)
	afx_msg void OnPaint();
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnUpdateStop(CCmdUI* pCmdUI);
	afx_msg void OnGetdispFolderChartList(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnColumnclickChartList(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnChangedTreeFolder(WPARAM wParam, LPARAM lParam);
	afx_msg void OnShowChart();
	afx_msg void OnUpdateShowChart(CCmdUI* pCmdUI);
	afx_msg void OnShowInfo();
	afx_msg void OnUpdateShowInfo(CCmdUI* pCmdUI);
	afx_msg void OnFileSelect();
	afx_msg void OnUpdateRescan(CCmdUI* pCmdUI);
	afx_msg void OnUpdateFileSelect(CCmdUI* pCmdUI);
	afx_msg void OnDestroy();
	afx_msg void OnSaveResult();
	afx_msg void OnToolsSafeclean();
	afx_msg void OnCollapseAll();
	afx_msg void OnExpandAll();
	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnUpdateSaveResult(CCmdUI* pCmdUI);
	afx_msg void OnUpdateFilePrint(CCmdUI* pCmdUI);
	afx_msg void OnUpdateFilePrintPreview(CCmdUI* pCmdUI);
	afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

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

/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_DETAILVIEW_H__C3455E3D_7FBF_11D2_929A_0080C8E7F1DB__INCLUDED_)

⌨️ 快捷键说明

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