Repository navigation
Expand file tree
/
Copy pathCFileTypeSelectDlg.cpp
More file actions
117 lines (95 loc) · 2.46 KB
/
Copy pathCFileTypeSelectDlg.cpp
File metadata and controls
117 lines (95 loc) · 2.46 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
114
115
// CFileTypeSelectDlg.cpp : implementation file
//
#include "pch.h"
#include "MainFrm.h"
#include "NetDesigner.h"
#include "NetDesignerDoc.h"
#include "NetDesignerView.h"
#include "CFileTypeSelectDlg.h"
#include "afxdialogex.h"
// CFileTypeSelectDlg dialog
IMPLEMENT_DYNAMIC(CFileTypeSelectDlg, CDialogEx)
CFileTypeSelectDlg::CFileTypeSelectDlg(CWnd* pParent /*=nullptr*/)
: CDialogEx(IDD_FILE_TYPE, pParent)
{
type = _T("");
m_list_value = _T("");
}
CFileTypeSelectDlg::~CFileTypeSelectDlg()
{
}
void CFileTypeSelectDlg::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_Control(pDX, IDC_LIST1, m_list_ctrl);
DDX_LBString(pDX, IDC_LIST1, m_list_value);
}
BEGIN_MESSAGE_MAP(CFileTypeSelectDlg, CDialogEx)
ON_WM_CTLCOLOR()
END_MESSAGE_MAP()
// CFileTypeSelectDlg message handlers
BOOL CFileTypeSelectDlg::OnInitDialog()
{
CDialogEx::OnInitDialog();
mbrush.CreateSolidBrush(GetGlobalData()->clrBarFace);
mbrush2.CreateSolidBrush(GetGlobalData()->clrActiveCaption);
CString s = _T("");
for (int i = 0; i < (int)mfile_types.size(); i++) {
if (mfile_types[i].second > 0) {
s.Format(_T(" : num files = %i"), mfile_types[i].second);
m_list_ctrl.AddString(mfile_types[i].first + s);
}
}
m_list_ctrl.SetCurSel(0);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CFileTypeSelectDlg::OnOK()
{
UpdateData();
type = m_list_value;
CDialogEx::OnOK();
}
HBRUSH CFileTypeSelectDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = mbrush;
switch (nCtlColor)
{
case CTLCOLOR_STATIC:
pDC->SetTextColor(GetGlobalData()->clrGrayedText);
pDC->SetBkMode(TRANSPARENT);
break;
case CTLCOLOR_BTN:
pDC->SetTextColor(RGB(255, 0, 0));
break;
case CTLCOLOR_DLG:
pDC->SetTextColor(RGB(255, 255, 0));
break;
case CTLCOLOR_EDIT:
hbr = mbrush2;
pDC->SetTextColor(GetGlobalData()->clrGrayedText);
pDC->SetBkMode(TRANSPARENT);
break;
case CTLCOLOR_LISTBOX:
//pDC->SetTextColor(RGB(0, 255, 0));
pDC->SetTextColor(GetGlobalData()->clrGrayedText);
break;
case CTLCOLOR_MSGBOX:
pDC->SetTextColor(RGB(255, 0, 255));
break;
case CTLCOLOR_SCROLLBAR:
pDC->SetTextColor(RGB(0, 0, 255));
break;
default:
pDC->SetTextColor(GetGlobalData()->clrGrayedText);
}
return hbr;
}
CString CFileTypeSelectDlg::getSelectedType()
{
return(type);
}
void CFileTypeSelectDlg::setFiles(vector<pair<CString, int>> file_types)
{
mfile_types = file_types;
}