X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bc385ba9ebd0185d5bc3dcbf9fb3f35e3eac4d7a..cf471cab8277f4cc2c19bce417356badf9e2ca49:/src/generic/calctrl.cpp diff --git a/src/generic/calctrl.cpp b/src/generic/calctrl.cpp index dca2a4e76d..a0aae27144 100644 --- a/src/generic/calctrl.cpp +++ b/src/generic/calctrl.cpp @@ -81,9 +81,6 @@ BEGIN_EVENT_TABLE(wxCalendarCtrl, wxControl) 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) @@ -288,12 +285,12 @@ void wxCalendarCtrl::ShowCurrentControls() wxControl *wxCalendarCtrl::GetMonthControl() const { - return AllowMonthChange() ? m_comboMonth : m_staticMonth; + return AllowMonthChange() ? (wxControl *)m_comboMonth : (wxControl *)m_staticMonth; } wxControl *wxCalendarCtrl::GetYearControl() const { - return AllowYearChange() ? m_spinYear : m_staticYear; + return AllowYearChange() ? (wxControl *)m_spinYear : (wxControl *)m_staticYear; } void wxCalendarCtrl::EnableYearChange(bool enable) @@ -359,6 +356,9 @@ void wxCalendarCtrl::SetDate(const wxDateTime& date) m_spinYear->SetValue(m_date.Format(_T("%Y"))); } + // as the month changed, holidays did too + SetHolidayAttrs(); + // update the calendar Refresh(); } @@ -861,9 +861,7 @@ void wxCalendarCtrl::OnMonthChange(wxCommandEvent& event) 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) @@ -876,9 +874,7 @@ void wxCalendarCtrl::OnYearChange(wxSpinEvent& event) 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 +953,6 @@ void wxCalendarCtrl::OnChar(wxKeyEvent& event) // holidays handling // ---------------------------------------------------------------------------- -void wxCalendarCtrl::OnCalMonthChange(wxCalendarEvent& event) -{ - SetHolidayAttrs(); - - event.Skip(); -} - void wxCalendarCtrl::EnableHolidayDisplay(bool display) { long style = GetWindowStyle();