fixed refresh problem with holidays in wxCalendarCtrl

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5345 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2000-01-11 19:12:47 +00:00
parent c2754d2903
commit 0de868d9dd
5 changed files with 52 additions and 19 deletions

View File

@@ -67,6 +67,8 @@ public:
void OnCalendar(wxCalendarEvent& event);
void OnCalendarWeekDayClick(wxCalendarEvent& event);
void OnCalendarChange(wxCalendarEvent& event);
void OnCalMonthChange(wxCalendarEvent& event);
void OnCalYearChange(wxCalendarEvent& event);
wxCalendarCtrl *GetCal() const { return m_calendar; }
@@ -148,6 +150,8 @@ END_EVENT_TABLE()
BEGIN_EVENT_TABLE(MyPanel, wxPanel)
EVT_CALENDAR (Calendar_CalCtrl, MyPanel::OnCalendar)
EVT_CALENDAR_MONTH (Calendar_CalCtrl, MyPanel::OnCalMonthChange)
EVT_CALENDAR_YEAR (Calendar_CalCtrl, MyPanel::OnCalYearChange)
EVT_CALENDAR_SEL_CHANGED(Calendar_CalCtrl, MyPanel::OnCalendarChange)
EVT_CALENDAR_WEEKDAY_CLICKED(Calendar_CalCtrl, MyPanel::OnCalendarWeekDayClick)
END_EVENT_TABLE()
@@ -340,6 +344,16 @@ void MyPanel::OnCalendarChange(wxCalendarEvent& event)
m_date->SetLabel(s);
}
void MyPanel::OnCalMonthChange(wxCalendarEvent& WXUNUSED(event))
{
wxLogStatus("Calendar month changed");
}
void MyPanel::OnCalYearChange(wxCalendarEvent& WXUNUSED(event))
{
wxLogStatus("Calendar year changed");
}
void MyPanel::OnCalendarWeekDayClick(wxCalendarEvent& event)
{
wxLogMessage("Clicked on %s",

View File

@@ -1349,6 +1349,31 @@ static void TestTimeArithmetics()
}
}
static void TestTimeHolidays()
{
puts("\n*** testing wxDateTimeHolidayAuthority ***\n");
wxDateTime::Tm tm = wxDateTime(29, wxDateTime::May, 2000).GetTm();
wxDateTime dtStart(1, tm.mon, tm.year),
dtEnd = dtStart.GetLastMonthDay();
wxDateTimeArray hol;
wxDateTimeHolidayAuthority::GetHolidaysInRange(dtStart, dtEnd, hol);
const wxChar *format = "%d-%b-%Y (%a)";
printf("All holidays between %s and %s:\n",
dtStart.Format(format).c_str(), dtEnd.Format(format).c_str());
size_t count = hol.GetCount();
for ( size_t n = 0; n < count; n++ )
{
printf("\t%s\n", hol[n].Format(format).c_str());
}
puts("");
}
#if 0
// test compatibility with the old wxDate/wxTime classes
@@ -1737,6 +1762,11 @@ int main(int argc, char **argv)
fprintf(stderr, "Failed to initialize the wxWindows library, aborting.");
}
#ifdef TEST_USLEEP
puts("Sleeping for 3 seconds... z-z-z-z-z...");
wxUsleep(3000);
#endif // TEST_USLEEP
#ifdef TEST_CMDLINE
static const wxCmdLineEntryDesc cmdLineDesc[] =
{
@@ -1883,7 +1913,7 @@ int main(int argc, char **argv)
#endif // TEST_MIME
#ifdef TEST_TIME
if ( 1 )
if ( 0 )
{
TestTimeSet();
TestTimeStatic();
@@ -1898,6 +1928,7 @@ int main(int argc, char **argv)
TestTimeFormat();
TestTimeArithmetics();
}
TestTimeHolidays();
if ( 0 )
TestInteractive();
#endif // TEST_TIME