From 7ec5c42e94de656d0ce21333ef684493a8999410 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 4 Apr 2008 14:24:02 +0000 Subject: [PATCH] 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 --- src/msw/calctrl.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) 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) -- 2.50.0