]> git.saurik.com Git - wxWidgets.git/commitdiff
implement EnableMonthChange() by restricting the dates range to the current month...
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 4 Apr 2008 14:24:02 +0000 (14:24 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 4 Apr 2008 14:24:02 +0000 (14:24 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53005 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/calctrl.cpp

index 6bc01d1d45593c360776e3126d0b1157489f3085..b9b8e18f2b419d2d1543f2932417ee5c5c86d067 100644 (file)
@@ -189,9 +189,22 @@ bool wxCalendarCtrl::GetDateRange(wxDateTime *dt1, wxDateTime *dt2) const
 
 bool wxCalendarCtrl::EnableMonthChange(bool enable)
 {
 
 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)
 }
 
 void wxCalendarCtrl::Mark(size_t day, bool mark)