Repository navigation
Expand file tree
/
Copy pathDialogSkinFileNew.cpp
More file actions
113 lines (91 loc) · 2.63 KB
/
Copy pathDialogSkinFileNew.cpp
File metadata and controls
113 lines (91 loc) · 2.63 KB
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// DialogSkinFileNew.cpp : implementation file
//
#include "stdafx.h"
#include "DuiDesigner.h"
#include "DialogSkinFileNew.h"
// CDialogSkinFileNew dialog
IMPLEMENT_DYNAMIC(CDialogSkinFileNew, CDialog)
CDialogSkinFileNew::CDialogSkinFileNew(CWnd* pParent /*=NULL*/)
: CDialog(CDialogSkinFileNew::IDD, pParent)
, m_strUITitle(_T(""))
, m_strStyleFile(_T(""))
{
}
CDialogSkinFileNew::~CDialogSkinFileNew()
{
}
void CDialogSkinFileNew::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Text(pDX, IDC_EDIT_FILE_NAME, m_strUITitle);
DDX_Control(pDX, IDC_LIST_STYLE, m_lstStyles);
DDX_Control(pDX, IDC_STATIC_PREVIEW, m_StylePreview);
}
BEGIN_MESSAGE_MAP(CDialogSkinFileNew, CDialog)
ON_LBN_SELCHANGE(IDC_LIST_STYLE, &CDialogSkinFileNew::OnLbnSelchangeListStyle)
ON_BN_CLICKED(IDOK, &CDialogSkinFileNew::OnBnClickedOk)
END_MESSAGE_MAP()
// CDialogSkinFileNew message handlers
BOOL CDialogSkinFileNew::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_lstStyles.AddString(_T("(ÎÞ)"));
m_lstStyles.SetCurSel(0);
FindStyleFiles(CGlobalVariable::GetStylesDir());
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
CString& CDialogSkinFileNew::GetStyleFilePath()
{
return m_strStyleFile;
}
void CDialogSkinFileNew::FindStyleFiles(CString& strDir)
{
WIN32_FIND_DATA FindFileData = {0};
CString strFind = strDir + _T("*.*");
HANDLE hFind = ::FindFirstFile(strFind, &FindFileData);
if(hFind == INVALID_HANDLE_VALUE)
return;
do
{
if((FindFileData.dwFileAttributes | FILE_ATTRIBUTE_DIRECTORY) != 0)
{
if(FindFileData.cFileName[0] == '.')
if (FindFileData.cFileName[1] == '\0' ||
(FindFileData.cFileName[1] == '.' &&
FindFileData.cFileName[2] == '\0'))
continue;
m_lstStyles.AddString(FindFileData.cFileName);
}
}while(::FindNextFile(hFind, &FindFileData));
::FindClose(hFind);
}
void CDialogSkinFileNew::OnLbnSelchangeListStyle()
{
// TODO: Add your control notification handler code here
CString strText;
int nIndex = m_lstStyles.GetCurSel();
if(nIndex == -1)
return;
m_lstStyles.GetText(nIndex, strText);
CString strStyleDir;
strStyleDir = (strText == _T("(ÎÞ)")) ? _T("") : CGlobalVariable::GetStylesDir() \
+ strText;
if(!strStyleDir.IsEmpty())
{
m_strStyleFile = strStyleDir + _T("\\style.xml");
m_StylePreview.SetPreviewImage(strStyleDir + _T("\\style.ui"));
}
else
{
m_strStyleFile.Empty();
m_StylePreview.SetPreviewImage(_T(""));
}
}
void CDialogSkinFileNew::OnBnClickedOk()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
OnOK();
}