-
Notifications
You must be signed in to change notification settings - Fork 0
/
DirTree.h
executable file
·84 lines (62 loc) · 2.21 KB
/
DirTree.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// DirTree.h: interface for the CDirTree class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_DIRTREE_H__7D26FA53_2342_4A37_994C_67174577D58D__INCLUDED_)
#define AFX_DIRTREE_H__7D26FA53_2342_4A37_994C_67174577D58D__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
//#include "GraphicsObject.h"
#include <list>
#include <map>
#include "RenderDC.h"
#include "StyleTemplate.h"
#include <Gdiplus.h>
typedef struct tagDirItem
{
CString strPath, strName;
int nLevel;
bool bIsFile;
int nIcon;
} DirItem;
typedef struct tagSysImage
{
HICON hIcon;
Gdiplus::Bitmap* pBitmap;
} SysImage;
enum DrawIconType
{
IconFile,
IconFolder
};
class CDirTree //: public CGraphicsObject
{
public:
CDirTree ();
CDirTree (CString strRootDir, int nMaxNesting, bool bDisplayFiles, int nColumnsCount, bool bUseSystemIcons);
virtual ~CDirTree ();
virtual void Render (CRenderDC& rdc, CRect r, CStyleTemplate& style, bool bIsPrinting);
void Serialize (CArchive& ar);
inline CString GetRootDir () { return m_strRootDir; }
inline int GetMaxNesting () { return m_nMaxNesting; }
inline bool GetDisplayFiles () { return m_bDisplayFiles; }
inline int GetColumnsCount () { return m_nColumnsCount; }
inline bool UseSystemIcons () { return m_bUseSystemIcons; }
CDirTree& operator = (CDirTree& dirTree);
bool operator == (CDirTree& dirTree);
bool operator != (CDirTree& dirTree) { return !(*this == dirTree); }
bool equals (CString strRootDir, int nMaxNesting, bool bDisplayFiles, int nColumnsCount, bool bUseSystemIcons);
static void EmptyImageStore (); // call this method at app termination. Deletes all the image in the store
private:
double ComputeFontSize (CDC* pDC, CRect r, LOGFONT* pLogfont);
void AddSubDirs (CString strDir, int nLevel);
void DrawIcon (CDC* pDC, DrawIconType type, CPoint pt, int nWidth, int nHeight);
Gdiplus::Bitmap* GetBitmapFromStore (int nIndex);
std::list<DirItem*> m_list;
CString m_strRootDir;
int m_nMaxNesting;
bool m_bDisplayFiles;
int m_nColumnsCount;
bool m_bUseSystemIcons;
};
#endif // !defined(AFX_DIRTREE_H__7D26FA53_2342_4A37_994C_67174577D58D__INCLUDED_)