+ m_panel->SetDate(wxDateTime::Today());
+}
+
+void MyFrame::OnBeginDST(wxCommandEvent &WXUNUSED(event))
+{
+ m_panel->SetDate(wxDateTime::GetBeginDST(m_panel->GetDate().GetYear()));
+}
+
+void MyFrame::OnCalToggleResizable(wxCommandEvent& event)
+{
+ wxSizer * const sizer = m_panel->GetSizer();
+ wxSizerItem * const item = sizer->GetItem(m_panel->GetCal());
+ if ( event.IsChecked() )
+ {
+ item->SetProportion(1);
+ item->SetFlag(wxEXPAND);
+ }
+ else // not resizable
+ {
+ item->SetProportion(0);
+ item->SetFlag(wxALIGN_CENTER);
+ }
+
+ sizer->Layout();
+}
+
+void MyFrame::OnCalRClick(wxMouseEvent& event)
+{
+ wxDateTime dt;
+ wxDateTime::WeekDay wd;
+
+ const wxPoint pt = event.GetPosition();
+ wxString msg = wxString::Format("Point (%d, %d) is ", pt.x, pt.y);
+
+ switch ( m_panel->GetCal()->HitTest(pt, &dt, &wd) )
+ {
+ default:
+ wxFAIL_MSG( "unexpected" );
+ // fall through
+
+ case wxCAL_HITTEST_NOWHERE:
+ msg += "nowhere";
+ break;
+
+ case wxCAL_HITTEST_HEADER:
+ msg += wxString::Format("over %s", wxDateTime::GetWeekDayName(wd));
+ break;
+
+ case wxCAL_HITTEST_DAY:
+ msg += wxString::Format("over %s", dt.FormatISODate());
+ break;
+
+ case wxCAL_HITTEST_INCMONTH:
+ msg += "over next month button";
+ break;
+
+ case wxCAL_HITTEST_DECMONTH:
+ msg += "over previous month button";
+ break;
+
+ case wxCAL_HITTEST_SURROUNDING_WEEK:
+ msg += "over a day from another month";
+ break;
+ }
+
+ wxLogMessage("%s", msg);