forked from gopa810/gcal-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDlgGetDate.cpp
106 lines (85 loc) · 2.29 KB
/
DlgGetDate.cpp
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
// DlgGetDate.cpp : implementation file
//
#include "stdafx.h"
#include "vcal5beta.h"
#include "DlgGetDate.h"
#include "TTimeZone.h"
/////////////////////////////////////////////////////////////////////////////
// DlgGetDate dialog
int DlgGetDate::s_init = 0;
VCTIME DlgGetDate::s_event;
DlgGetDate::DlgGetDate(CWnd* pParent /*=NULL*/)
: CDialog(DlgGetDate::IDD, pParent)
{
SYSTEMTIME st;
if (s_init == 0)
{
GetLocalTime(&st);
s_init = 1;
}
else
{
st.wDay = s_event.day;
st.wMonth = s_event.month;
st.wYear = s_event.year;
st.wHour = s_event.GetHour();
st.wMinute = s_event.GetMinuteRound();
}
m_nNextStep = 0;
//{{AFX_DATA_INIT(DlgGetDate)
m_nDay = st.wDay;
m_nMonth = st.wMonth;
m_nYear = st.wYear;
m_nHour = st.wHour;
m_nMin = st.wMinute;
//}}AFX_DATA_INIT
}
void DlgGetDate::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(DlgGetDate)
DDX_Text(pDX, IDC_EDIT1, m_nDay);
DDV_MinMaxUInt(pDX, m_nDay, 1, 31);
DDX_Text(pDX, IDC_EDIT2, m_nMonth);
DDV_MinMaxUInt(pDX, m_nMonth, 1, 12);
DDX_Text(pDX, IDC_EDIT3, m_nYear);
DDV_MinMaxUInt(pDX, m_nYear, 1600, 3999);
DDX_Text(pDX, IDC_EDIT4, m_nHour);
DDV_MinMaxUInt(pDX, m_nHour, 0, 23);
DDX_Text(pDX, IDC_EDIT5, m_nMin);
DDV_MinMaxUInt(pDX, m_nMin, 0, 59);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(DlgGetDate, CDialog)
//{{AFX_MSG_MAP(DlgGetDate)
ON_BN_CLICKED(ID_BUTTON_NEXT, OnButtonNext)
ON_BN_CLICKED(IDC_BUTTON_BACK, OnButtonBack)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// DlgGetDate message handlers
void DlgGetDate::OnButtonNext()
{
// TODO: Add your control notification handler code here
UpdateData();
m_nNextStep = 1;
s_event.day = m_nDay;
s_event.month = m_nMonth;
s_event.year = m_nYear;
s_event.shour = (double(m_nHour)*60.0 + double(m_nMin)) / 1440.0;
CDialog::OnOK();
}
void DlgGetDate::OnButtonBack()
{
// TODO: Add your control notification handler code here
m_nNextStep = -1;
CDialog::OnCancel();
}
BOOL DlgGetDate::OnInitDialog()
{
m_nNextStep = 0;
CDialog::OnInitDialog();
SetDlgItemText(IDC_STATIC_TZ, TTimeZone::GetTimeZoneOffsetText(s_event.tzone));
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}