1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/calctrl.h
3 // Purpose: wxCalendarCtrl control implementation for MSW
4 // Author: Vadim Zeitlin
5 // Copyright: (C) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
9 #ifndef _WX_MSW_CALCTRL_H_
10 #define _WX_MSW_CALCTRL_H_
12 class WXDLLIMPEXP_ADV wxCalendarCtrl
: public wxCalendarCtrlBase
15 wxCalendarCtrl() { Init(); }
16 wxCalendarCtrl(wxWindow
*parent
,
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
)
26 Create(parent
, id
, date
, pos
, size
, style
, name
);
29 bool Create(wxWindow
*parent
,
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
);
37 virtual bool SetDate(const wxDateTime
& date
);
38 virtual wxDateTime
GetDate() const;
40 virtual bool SetDateRange(const wxDateTime
& lowerdate
= wxDefaultDateTime
,
41 const wxDateTime
& upperdate
= wxDefaultDateTime
);
42 virtual bool GetDateRange(wxDateTime
*lowerdate
, wxDateTime
*upperdate
) const;
44 virtual bool EnableMonthChange(bool enable
= true);
46 virtual void Mark(size_t day
, bool mark
);
47 virtual void SetHoliday(size_t day
);
49 virtual wxCalendarHitTestResult
HitTest(const wxPoint
& pos
,
50 wxDateTime
*date
= NULL
,
51 wxDateTime::WeekDay
*wd
= NULL
);
53 virtual void SetWindowStyleFlag(long style
);
56 virtual wxSize
DoGetBestSize() const;
58 virtual WXDWORD
MSWGetStyle(long style
, WXDWORD
*exstyle
) const;
60 virtual bool MSWOnNotify(int idCtrl
, WXLPARAM lParam
, WXLPARAM
*result
);
62 void MSWOnClick(wxMouseEvent
& event
);
63 void MSWOnDoubleClick(wxMouseEvent
& event
);
68 // bring the control in sync with m_marks
71 // set first day of week in the control to correspond to our
72 // wxCAL_MONDAY_FIRST flag
73 void UpdateFirstDayOfWeek();
75 // reset holiday information
76 virtual void ResetHolidayAttrs() { m_holidays
= 0; }
79 virtual void RefreshHolidays() { UpdateMarks(); }
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
87 // bit field containing the state (marked or not) of all days in the month
90 // the same but indicating whether a day is a holiday or not
94 DECLARE_DYNAMIC_CLASS(wxCalendarCtrl
)
95 wxDECLARE_NO_COPY_CLASS(wxCalendarCtrl
);
98 #endif // _WX_MSW_CALCTRL_H_