NULL, this);
m_spinYear->Connect(m_spinYear->GetId(), wxEVT_COMMAND_SPINCTRL_UPDATED,
- wxCommandEventHandler(wxGenericCalendarCtrl::OnYearChange),
+ wxSpinEventHandler(wxGenericCalendarCtrl::OnYearChange),
NULL, this);
}
wxSize wxGenericCalendarCtrl::DoGetBestSize() const
{
// calc the size of the calendar
- wx_const_cast(wxGenericCalendarCtrl *, this)->RecalcGeometry();
+ const_cast<wxGenericCalendarCtrl *>(this)->RecalcGeometry();
wxCoord width = 7*m_widthCol,
height = 7*m_heightRow + m_rowOffset;
SetDateAndNotify(target);
}
-void wxGenericCalendarCtrl::OnYearChange(wxCommandEvent& event)
+void wxGenericCalendarCtrl::HandleYearChange(wxCommandEvent& event)
{
int year = (int)event.GetInt();
if ( year == INT_MIN )
}
}
+void wxGenericCalendarCtrl::OnYearChange(wxSpinEvent& event)
+{
+ HandleYearChange( event );
+}
+
void wxGenericCalendarCtrl::OnYearTextChange(wxCommandEvent& event)
{
SetUserChangedYear();
- OnYearChange(event);
+ HandleYearChange(event);
}
// Responds to colour changes, and passes event on to children.
// holidays handling
// ----------------------------------------------------------------------------
-void wxGenericCalendarCtrl::EnableHolidayDisplay(bool display)
-{
- long style = GetWindowStyle();
- if ( display )
- style |= wxCAL_SHOW_HOLIDAYS;
- else
- style &= ~wxCAL_SHOW_HOLIDAYS;
-
- SetWindowStyle(style);
-
- if ( display )
- SetHolidayAttrs();
- else
- ResetHolidayAttrs();
-
- Refresh();
-}
-
-void wxGenericCalendarCtrl::SetHolidayAttrs()
-{
- if ( GetWindowStyle() & wxCAL_SHOW_HOLIDAYS )
- {
- ResetHolidayAttrs();
-
- wxDateTime::Tm tm = m_date.GetTm();
- wxDateTime dtStart(1, tm.mon, tm.year),
- dtEnd = dtStart.GetLastMonthDay();
-
- wxDateTimeArray hol;
- wxDateTimeHolidayAuthority::GetHolidaysInRange(dtStart, dtEnd, hol);
-
- size_t count = hol.GetCount();
- for ( size_t n = 0; n < count; n++ )
- {
- SetHoliday(hol[n].GetDay());
- }
- }
-}
-
void wxGenericCalendarCtrl::SetHoliday(size_t day)
{
wxCHECK_RET( day > 0 && day < 32, _T("invalid day in SetHoliday") );