From: Vadim Zeitlin Date: Fri, 4 Apr 2008 14:24:02 +0000 (+0000) Subject: implement EnableMonthChange() by restricting the dates range to the current month... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/7ec5c42e94de656d0ce21333ef684493a8999410 implement EnableMonthChange() by restricting the dates range to the current month (this is not ideal as the UI of the control doesn't change, but better than nothing) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53005 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/calctrl.cpp b/src/msw/calctrl.cpp index 6bc01d1d45..b9b8e18f2b 100644 --- a/src/msw/calctrl.cpp +++ b/src/msw/calctrl.cpp @@ -189,9 +189,22 @@ bool wxCalendarCtrl::GetDateRange(wxDateTime *dt1, wxDateTime *dt2) const bool wxCalendarCtrl::EnableMonthChange(bool enable) { - wxFAIL_MSG( "not implemented" ); + if ( !wxCalendarCtrlBase::EnableMonthChange(enable) ) + return false; + + wxDateTime dtStart, dtEnd; + if ( !enable ) + { + dtStart = GetDate(); + dtStart.SetDay(1); - return false; + dtEnd = dtStart.GetLastMonthDay(); + } + //else: leave them invalid to remove the restriction + + SetDateRange(dtStart, dtEnd); + + return true; } void wxCalendarCtrl::Mark(size_t day, bool mark)