]>
Commit | Line | Data |
---|---|---|
51317496 VZ |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/msw/calctrl.h | |
3 | // Purpose: wxCalendarCtrl control implementation for MSW | |
4 | // Author: Vadim Zeitlin | |
51317496 VZ |
5 | // Copyright: (C) 2008 Vadim Zeitlin <vadim@wxwidgets.org> |
6 | // Licence: wxWindows licence | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | #ifndef _WX_MSW_CALCTRL_H_ | |
10 | #define _WX_MSW_CALCTRL_H_ | |
11 | ||
12 | class WXDLLIMPEXP_ADV wxCalendarCtrl : public wxCalendarCtrlBase | |
13 | { | |
14 | public: | |
82c6027b | 15 | wxCalendarCtrl() { Init(); } |
51317496 VZ |
16 | wxCalendarCtrl(wxWindow *parent, |
17 | wxWindowID id, | |
18 | const wxDateTime& date = wxDefaultDateTime, | |
19 | const wxPoint& pos = wxDefaultPosition, | |
20 | const wxSize& size = wxDefaultSize, | |
21 | long style = wxCAL_SHOW_HOLIDAYS, | |
22 | const wxString& name = wxCalendarNameStr) | |
23 | { | |
82c6027b VZ |
24 | Init(); |
25 | ||
51317496 VZ |
26 | Create(parent, id, date, pos, size, style, name); |
27 | } | |
28 | ||
29 | bool Create(wxWindow *parent, | |
30 | wxWindowID id, | |
31 | const wxDateTime& date = wxDefaultDateTime, | |
32 | const wxPoint& pos = wxDefaultPosition, | |
33 | const wxSize& size = wxDefaultSize, | |
34 | long style = wxCAL_SHOW_HOLIDAYS, | |
35 | const wxString& name = wxCalendarNameStr); | |
36 | ||
37 | virtual bool SetDate(const wxDateTime& date); | |
38 | virtual wxDateTime GetDate() const; | |
39 | ||
40 | virtual bool SetDateRange(const wxDateTime& lowerdate = wxDefaultDateTime, | |
41 | const wxDateTime& upperdate = wxDefaultDateTime); | |
42 | virtual bool GetDateRange(wxDateTime *lowerdate, wxDateTime *upperdate) const; | |
43 | ||
44 | virtual bool EnableMonthChange(bool enable = true); | |
45 | ||
46 | virtual void Mark(size_t day, bool mark); | |
6d9b6716 | 47 | virtual void SetHoliday(size_t day); |
51317496 | 48 | |
ee22a3a2 VZ |
49 | virtual wxCalendarHitTestResult HitTest(const wxPoint& pos, |
50 | wxDateTime *date = NULL, | |
51 | wxDateTime::WeekDay *wd = NULL); | |
52 | ||
db0b0942 VZ |
53 | virtual void SetWindowStyleFlag(long style); |
54 | ||
51317496 | 55 | protected: |
c24fd888 | 56 | virtual wxSize DoGetBestSize() const; |
51317496 VZ |
57 | |
58 | virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; | |
59 | ||
60 | virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); | |
61 | ||
3ccd1b49 | 62 | void MSWOnClick(wxMouseEvent& event); |
b3ed7020 VZ |
63 | void MSWOnDoubleClick(wxMouseEvent& event); |
64 | ||
51317496 | 65 | private: |
6d9b6716 | 66 | void Init(); |
82c6027b | 67 | |
db0b0942 | 68 | // bring the control in sync with m_marks |
82c6027b VZ |
69 | void UpdateMarks(); |
70 | ||
db0b0942 VZ |
71 | // set first day of week in the control to correspond to our |
72 | // wxCAL_MONDAY_FIRST flag | |
73 | void UpdateFirstDayOfWeek(); | |
74 | ||
6d9b6716 VZ |
75 | // reset holiday information |
76 | virtual void ResetHolidayAttrs() { m_holidays = 0; } | |
77 | ||
78 | // redisplay holidays | |
79 | virtual void RefreshHolidays() { UpdateMarks(); } | |
80 | ||
82c6027b VZ |
81 | |
82 | // current date, we need to store it instead of simply retrieving it from | |
83 | // the control as needed in order to be able to generate the correct events | |
84 | // from MSWOnNotify() | |
a4fcd589 VZ |
85 | wxDateTime m_date; |
86 | ||
82c6027b VZ |
87 | // bit field containing the state (marked or not) of all days in the month |
88 | wxUint32 m_marks; | |
89 | ||
6d9b6716 VZ |
90 | // the same but indicating whether a day is a holiday or not |
91 | wxUint32 m_holidays; | |
92 | ||
82c6027b | 93 | |
51317496 | 94 | DECLARE_DYNAMIC_CLASS(wxCalendarCtrl) |
c0c133e1 | 95 | wxDECLARE_NO_COPY_CLASS(wxCalendarCtrl); |
51317496 VZ |
96 | }; |
97 | ||
98 | #endif // _WX_MSW_CALCTRL_H_ |