]>
Commit | Line | Data |
---|---|---|
51317496 VZ |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/msw/calctrl.h | |
3 | // Purpose: wxCalendarCtrl control implementation for MSW | |
4 | // Author: Vadim Zeitlin | |
5 | // RCS-ID: $Id$ | |
6 | // Copyright: (C) 2008 Vadim Zeitlin <vadim@wxwidgets.org> | |
7 | // Licence: wxWindows licence | |
8 | ///////////////////////////////////////////////////////////////////////////// | |
9 | ||
10 | #ifndef _WX_MSW_CALCTRL_H_ | |
11 | #define _WX_MSW_CALCTRL_H_ | |
12 | ||
13 | class WXDLLIMPEXP_ADV wxCalendarCtrl : public wxCalendarCtrlBase | |
14 | { | |
15 | public: | |
82c6027b | 16 | wxCalendarCtrl() { Init(); } |
51317496 VZ |
17 | wxCalendarCtrl(wxWindow *parent, |
18 | wxWindowID id, | |
19 | const wxDateTime& date = wxDefaultDateTime, | |
20 | const wxPoint& pos = wxDefaultPosition, | |
21 | const wxSize& size = wxDefaultSize, | |
22 | long style = wxCAL_SHOW_HOLIDAYS, | |
23 | const wxString& name = wxCalendarNameStr) | |
24 | { | |
82c6027b VZ |
25 | Init(); |
26 | ||
51317496 VZ |
27 | Create(parent, id, date, pos, size, style, name); |
28 | } | |
29 | ||
30 | bool Create(wxWindow *parent, | |
31 | wxWindowID id, | |
32 | const wxDateTime& date = wxDefaultDateTime, | |
33 | const wxPoint& pos = wxDefaultPosition, | |
34 | const wxSize& size = wxDefaultSize, | |
35 | long style = wxCAL_SHOW_HOLIDAYS, | |
36 | const wxString& name = wxCalendarNameStr); | |
37 | ||
38 | virtual bool SetDate(const wxDateTime& date); | |
39 | virtual wxDateTime GetDate() const; | |
40 | ||
41 | virtual bool SetDateRange(const wxDateTime& lowerdate = wxDefaultDateTime, | |
42 | const wxDateTime& upperdate = wxDefaultDateTime); | |
43 | virtual bool GetDateRange(wxDateTime *lowerdate, wxDateTime *upperdate) const; | |
44 | ||
45 | virtual bool EnableMonthChange(bool enable = true); | |
46 | ||
47 | virtual void Mark(size_t day, bool mark); | |
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: |
82c6027b VZ |
66 | void Init() { m_marks = 0; } |
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 | ||
82c6027b VZ |
75 | |
76 | // current date, we need to store it instead of simply retrieving it from | |
77 | // the control as needed in order to be able to generate the correct events | |
78 | // from MSWOnNotify() | |
a4fcd589 VZ |
79 | wxDateTime m_date; |
80 | ||
82c6027b VZ |
81 | // bit field containing the state (marked or not) of all days in the month |
82 | wxUint32 m_marks; | |
83 | ||
84 | ||
51317496 VZ |
85 | DECLARE_DYNAMIC_CLASS(wxCalendarCtrl) |
86 | DECLARE_NO_COPY_CLASS(wxCalendarCtrl) | |
87 | }; | |
88 | ||
89 | #endif // _WX_MSW_CALCTRL_H_ |