X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bc385ba9ebd0185d5bc3dcbf9fb3f35e3eac4d7a..050207ec17f2bd354fd7db2714e03d6467fa253b:/samples/calendar/calendar.cpp diff --git a/samples/calendar/calendar.cpp b/samples/calendar/calendar.cpp index 31c28a57a7..d029c165fd 100644 --- a/samples/calendar/calendar.cpp +++ b/samples/calendar/calendar.cpp @@ -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() @@ -311,15 +315,15 @@ MyPanel::MyPanel(wxFrame *frame) wxLayoutConstraints *c = new wxLayoutConstraints; c->left.SameAs(this, wxLeft, 10); - c->centreY.SameAs(m_calendar, wxCentreY); + c->centreY.SameAs(this, wxCentreY); c->height.AsIs(); c->width.AsIs(); m_date->SetConstraints(c); c = new wxLayoutConstraints; - c->left.SameAs(m_date, wxRight, 10); - c->top.SameAs(this, wxTop, 10); + c->left.SameAs(m_date, wxRight, 20); + c->centreY.SameAs(this, wxCentreY); c->height.AsIs(); c->width.AsIs(); @@ -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",