void HighlightSpecial(bool on);
+ void SetDate();
+ void Today();
+
private:
wxCalendarCtrl *m_calendar;
wxStaticText *m_date;
void OnCalSeqMonth(wxCommandEvent& event);
void OnCalShowSurroundingWeeks(wxCommandEvent& event);
+ void OnSetDate(wxCommandEvent& event);
+ void OnToday(wxCommandEvent& event);
+
void OnAllowYearUpdate(wxUpdateUIEvent& event);
private:
Calendar_Cal_Year,
Calendar_Cal_SeqMonth,
Calendar_Cal_SurroundWeeks,
+ Calendar_Cal_SetDate,
+ Calendar_Cal_Today,
Calendar_CalCtrl = 1000
};
EVT_MENU(Calendar_Cal_SeqMonth, MyFrame::OnCalSeqMonth)
EVT_MENU(Calendar_Cal_SurroundWeeks, MyFrame::OnCalShowSurroundingWeeks)
+ EVT_MENU(Calendar_Cal_SetDate, MyFrame::OnSetDate)
+ EVT_MENU(Calendar_Cal_Today, MyFrame::OnToday)
+
+
EVT_UPDATE_UI(Calendar_Cal_Year, MyFrame::OnAllowYearUpdate)
END_EVENT_TABLE()
menuCal->Append(Calendar_Cal_Year, _T("&Year can be changed\tCtrl-Y"),
_T("Allow changing the year in the calendar"),
TRUE);
+ menuCal->AppendSeparator();
+ menuCal->Append(Calendar_Cal_SetDate, _T("SetDate()"), _T("Set date to 2005-12-24."));
+ menuCal->Append(Calendar_Cal_Today, _T("Today()"), _T("Set the current date."));
// now append the freshly created menu to the menu bar...
wxMenuBar *menuBar = new wxMenuBar;
event.Enable( GetMenuBar()->IsChecked(Calendar_Cal_Month));
}
+void MyFrame::OnSetDate(wxCommandEvent &WXUNUSED(event))
+{
+ m_panel->SetDate();
+}
+
+void MyFrame::OnToday(wxCommandEvent &WXUNUSED(event))
+{
+ m_panel->Today();
+}
+
// ----------------------------------------------------------------------------
// MyPanel
// ----------------------------------------------------------------------------
m_calendar->Refresh();
}
+
+void MyPanel::SetDate()
+{
+ wxDateTime date(24, wxDateTime::Dec, 2005, 23, 59, 59);
+ m_calendar->SetDate(date);
+}
+
+void MyPanel::Today()
+{
+ m_calendar->SetDate(wxDateTime::Today());
+}