-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCDlgSort.cpp
More file actions
96 lines (74 loc) · 2.02 KB
/
CDlgSort.cpp
File metadata and controls
96 lines (74 loc) · 2.02 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
// CDlgSort.cpp: 구현 파일
//
#include "pch.h"
#include "BatchNamer.h"
#include "CDlgSort.h"
#include "afxdialogex.h"
#include "CNameListCtrl.h"
// CDlgSort 대화 상자
IMPLEMENT_DYNAMIC(CDlgSort, CDialogEx)
CDlgSort::CDlgSort(CWnd* pParent /*=nullptr*/)
: CDialogEx(IDD_SORT, pParent)
{
m_nSortCol = COL_OLDNAME;
m_bAsc = TRUE;
m_pSortWnd = NULL;
}
CDlgSort::~CDlgSort()
{
}
void CDlgSort::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CDlgSort, CDialogEx)
END_MESSAGE_MAP()
// CDlgSort 메시지 처리기
void CDlgSort::SetCheckByID(int nID, BOOL bCheck)
{
CButton* pBtn = (CButton*)GetDlgItem(nID);
pBtn->SetCheck(bCheck);
}
BOOL CDlgSort::GetCheckByID(int nID)
{
CButton* pBtn = (CButton*)GetDlgItem(nID);
return pBtn->GetCheck();
}
BOOL CDlgSort::OnInitDialog()
{
CDialogEx::OnInitDialog();
if (m_pSortWnd == NULL) return FALSE;
CMFCHeaderCtrl& header = ((CNameListCtrl*)m_pSortWnd)->GetHeaderCtrl();
CComboBox* pCB = (CComboBox*)GetDlgItem(IDC_CB_SORTCOL);
int nCount = header.GetItemCount();
m_nSortCol = header.GetSortColumn();
m_bAsc = header.IsAscending();
HDITEM hdi;
TCHAR buf[MAX_PATH];
hdi.mask = HDI_TEXT;
hdi.cchTextMax = MAX_PATH;
hdi.pszText = buf;
for (int i = 0; i < nCount; i++)
{
header.GetItem(i, &hdi);
pCB->AddString(hdi.pszText);
}
pCB->SetCurSel(m_nSortCol);
if (m_bAsc == TRUE) SetCheckByID(IDC_RADIO_SORT_ASCEND, TRUE);
else SetCheckByID(IDC_RADIO_SORT_DESCEND, TRUE);
return TRUE; // return TRUE unless you set the focus to a control
// 예외: OCX 속성 페이지는 FALSE를 반환해야 합니다.
}
void CDlgSort::OnOK()
{
CComboBox* pCB = (CComboBox*)GetDlgItem(IDC_CB_SORTCOL);
m_nSortCol = pCB->GetCurSel();
if (GetCheckByID(IDC_RADIO_SORT_ASCEND)) m_bAsc = TRUE;
else m_bAsc = FALSE; //if (GetCheckByID(IDC_RADIO_SORT_DESCEND))
CDialogEx::OnOK();
}
void CDlgSort::OnCancel()
{
// TODO: 여기에 특수화된 코드를 추가 및/또는 기본 클래스를 호출합니다.
CDialogEx::OnCancel();
}