-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCalendar.h
72 lines (54 loc) · 2.1 KB
/
Calendar.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
#pragma once
class CalendarWindow : public CMonthCalCtrl
{
DECLARE_DYNAMIC(CalendarWindow)
protected:
bool _bShowToday;
bool _bShowWeekNums;
bool _bSavePosition;
int _xPos;
int _yPos;
bool _bSaveSize;
int _nNumMonthsX;
int _nNumMonthsY;
LOGFONT _lfFont;
CFont _font;
/*
WM_SETFONT
The application should call the DeleteObject function to delete the font
when it is no longer needed; for example, after it destroys the control.
*/
CSize _sizeMinClient; // the minimum size of the client area of a 1x1 calendar
public:
CalendarWindow();
virtual ~CalendarWindow() {}
bool Create();
bool Create(const int xPos, const int yPos, const int nNumMonthsX, const int nNumMonthsY, const bool bShowToday, const bool bShowWeekNums);
bool SavePosition() const { return _bSavePosition; }
inline void SavePositionEnable() { _SavePosition(true); }
inline void SavePositionDisable() { _SavePosition(false); }
bool SaveSize() const { return _bSaveSize; }
inline void SaveSizeEnable() { _SaveSize(true); }
inline void SaveSizeDisable() { _SaveSize(false); }
bool ShowToday() const { return _bShowToday; }
inline void TodayShow() { _TodayShow(true); }
inline void TodayHide() { _TodayShow(false); }
bool ShowWeekNumbers() const { return _bShowWeekNums; }
inline void WeekNumbersShow() { _WeekNumbersShow(true); }
inline void WeekNumbersHide() { _WeekNumbersShow(false); }
void ChooseFont();
protected:
void _TodayShow(const bool b);
void _WeekNumbersShow(const bool b);
void _SavePosition(const bool b);
void _SaveSize(const bool b);
CSize GetRequiredDimensions(const int nNumMonthsX, const int nNumMonthsY);
void Resize();
void CalculateMinimumClientArea();
DECLARE_MESSAGE_MAP()
afx_msg void OnDestroy();
afx_msg void OnGetMinMaxInfo(MINMAXINFO* lpMMI);
afx_msg void OnSizing(UINT fwSide, LPRECT pRect);
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnWindowPosChanged(WINDOWPOS* lpwndpos);
};