1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/calctrl.h
3 // Purpose: wxCalendarCtrl control implementation for MSW
4 // Author: Vadim Zeitlin
6 // Copyright: (C) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 #ifndef _WX_MSW_CALCTRL_H_
11 #define _WX_MSW_CALCTRL_H_
13 class WXDLLIMPEXP_ADV wxCalendarCtrl
: public wxCalendarCtrlBase
16 wxCalendarCtrl() { Init(); }
17 wxCalendarCtrl(wxWindow
*parent
,
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
)
27 Create(parent
, id
, date
, pos
, size
, style
, name
);
30 bool Create(wxWindow
*parent
,
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
);
38 virtual bool SetDate(const wxDateTime
& date
);
39 virtual wxDateTime
GetDate() const;
41 virtual bool SetDateRange(const wxDateTime
& lowerdate
= wxDefaultDateTime
,
42 const wxDateTime
& upperdate
= wxDefaultDateTime
);
43 virtual bool GetDateRange(wxDateTime
*lowerdate
, wxDateTime
*upperdate
) const;
45 virtual bool EnableMonthChange(bool enable
= true);
47 virtual void Mark(size_t day
, bool mark
);
48 virtual void SetHoliday(size_t day
);
50 virtual wxCalendarHitTestResult
HitTest(const wxPoint
& pos
,
51 wxDateTime
*date
= NULL
,
52 wxDateTime::WeekDay
*wd
= NULL
);
54 virtual void SetWindowStyleFlag(long style
);
57 virtual wxSize
DoGetBestSize() const;
59 virtual WXDWORD
MSWGetStyle(long style
, WXDWORD
*exstyle
) const;
61 virtual bool MSWOnNotify(int idCtrl
, WXLPARAM lParam
, WXLPARAM
*result
);
63 void MSWOnClick(wxMouseEvent
& event
);
64 void MSWOnDoubleClick(wxMouseEvent
& event
);
69 // bring the control in sync with m_marks
72 // set first day of week in the control to correspond to our
73 // wxCAL_MONDAY_FIRST flag
74 void UpdateFirstDayOfWeek();
76 // reset holiday information
77 virtual void ResetHolidayAttrs() { m_holidays
= 0; }
80 virtual void RefreshHolidays() { UpdateMarks(); }
83 // current date, we need to store it instead of simply retrieving it from
84 // the control as needed in order to be able to generate the correct events
88 // bit field containing the state (marked or not) of all days in the month
91 // the same but indicating whether a day is a holiday or not
95 DECLARE_DYNAMIC_CLASS(wxCalendarCtrl
)
96 wxDECLARE_NO_COPY_CLASS(wxCalendarCtrl
);
99 #endif // _WX_MSW_CALCTRL_H_