]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/calctrl.cpp
More wxPlotWindow goodies.
[wxWidgets.git] / src / generic / calctrl.cpp
index df8e2d745d37951bc5a4d7ec9cade0538adfe6e6..34c346e4c7afe9b9889d55db2deabc2ca9155549 100644 (file)
@@ -36,6 +36,9 @@
     #include "wx/stattext.h"
 #endif //WX_PRECOMP
 
     #include "wx/stattext.h"
 #endif //WX_PRECOMP
 
+// Can only use wxSpinEvent if this is enabled
+#if wxUSE_SPINBTN
+
 #include "wx/calctrl.h"
 
 #define DEBUG_PAINT 0
 #include "wx/calctrl.h"
 
 #define DEBUG_PAINT 0
@@ -81,9 +84,6 @@ BEGIN_EVENT_TABLE(wxCalendarCtrl, wxControl)
 
     EVT_LEFT_DOWN(wxCalendarCtrl::OnClick)
     EVT_LEFT_DCLICK(wxCalendarCtrl::OnDClick)
 
     EVT_LEFT_DOWN(wxCalendarCtrl::OnClick)
     EVT_LEFT_DCLICK(wxCalendarCtrl::OnDClick)
-
-    EVT_CALENDAR_MONTH(-1, wxCalendarCtrl::OnCalMonthChange)
-    EVT_CALENDAR_YEAR(-1, wxCalendarCtrl::OnCalMonthChange)
 END_EVENT_TABLE()
 
 BEGIN_EVENT_TABLE(wxMonthComboBox, wxComboBox)
 END_EVENT_TABLE()
 
 BEGIN_EVENT_TABLE(wxMonthComboBox, wxComboBox)
@@ -359,6 +359,9 @@ void wxCalendarCtrl::SetDate(const wxDateTime& date)
             m_spinYear->SetValue(m_date.Format(_T("%Y")));
         }
 
             m_spinYear->SetValue(m_date.Format(_T("%Y")));
         }
 
+        // as the month changed, holidays did too
+        SetHolidayAttrs();
+
         // update the calendar
         Refresh();
     }
         // update the calendar
         Refresh();
     }
@@ -861,9 +864,7 @@ void wxCalendarCtrl::OnMonthChange(wxCommandEvent& event)
         tm.mday = wxDateTime::GetNumberOfDays(mon, tm.year);
     }
 
         tm.mday = wxDateTime::GetNumberOfDays(mon, tm.year);
     }
 
-    SetDate(wxDateTime(tm.mday, mon, tm.year));
-
-    GenerateEvents(wxEVT_CALENDAR_MONTH_CHANGED, wxEVT_CALENDAR_SEL_CHANGED);
+    SetDateAndNotify(wxDateTime(tm.mday, mon, tm.year));
 }
 
 void wxCalendarCtrl::OnYearChange(wxSpinEvent& event)
 }
 
 void wxCalendarCtrl::OnYearChange(wxSpinEvent& event)
@@ -876,9 +877,7 @@ void wxCalendarCtrl::OnYearChange(wxSpinEvent& event)
         tm.mday = wxDateTime::GetNumberOfDays(tm.mon, year);
     }
 
         tm.mday = wxDateTime::GetNumberOfDays(tm.mon, year);
     }
 
-    SetDate(wxDateTime(tm.mday, tm.mon, year));
-
-    GenerateEvents(wxEVT_CALENDAR_YEAR_CHANGED, wxEVT_CALENDAR_SEL_CHANGED);
+    SetDateAndNotify(wxDateTime(tm.mday, tm.mon, year));
 }
 
 // ----------------------------------------------------------------------------
 }
 
 // ----------------------------------------------------------------------------
@@ -957,13 +956,6 @@ void wxCalendarCtrl::OnChar(wxKeyEvent& event)
 // holidays handling
 // ----------------------------------------------------------------------------
 
 // holidays handling
 // ----------------------------------------------------------------------------
 
-void wxCalendarCtrl::OnCalMonthChange(wxCalendarEvent& event)
-{
-    SetHolidayAttrs();
-
-    event.Skip();
-}
-
 void wxCalendarCtrl::EnableHolidayDisplay(bool display)
 {
     long style = GetWindowStyle();
 void wxCalendarCtrl::EnableHolidayDisplay(bool display)
 {
     long style = GetWindowStyle();
@@ -1044,3 +1036,6 @@ wxCalendarEvent::wxCalendarEvent(wxCalendarCtrl *cal, wxEventType type)
 {
     m_date = cal->GetDate();
 }
 {
     m_date = cal->GetDate();
 }
+
+#endif // wxUSE_SPINBTN
+