From 836a92ef94cf47b23b9aeee030e0f023c57072d0 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sat, 16 Jul 2016 22:57:41 +0100 Subject: [PATCH] Added the DeselectOthersEvent function to XCCalendarMonthView --- source/widgets/XCCalendarMonthView.cpp | 19 +++++++++++++++++++ source/widgets/XCCalendarMonthView.h | 1 + 2 files changed, 20 insertions(+) diff --git a/source/widgets/XCCalendarMonthView.cpp b/source/widgets/XCCalendarMonthView.cpp index 9d485ab..aa99d8b 100644 --- a/source/widgets/XCCalendarMonthView.cpp +++ b/source/widgets/XCCalendarMonthView.cpp @@ -27,6 +27,8 @@ END_EVENT_TABLE() XCCalendarMonthView::XCCalendarMonthView(const wxString& title, const wxPoint& pos, const wxSize& size, XCCalendarMonthViewGrid *grid) : wxFrame(NULL, wxID_ANY, title, pos, size){ + Connect(ID_MONTHVIEWCLEARSELECTION, XCCALENDARMONTH_DESELECTOTHERENTRIES, wxCommandEventHandler(XCCalendarMonthView::DeselectOthersEvent)); + MondayText = new XCCalendarMonthViewDayTitle(this, _("Monday"), wxDefaultPosition, wxDefaultSize); TuesdayText = new XCCalendarMonthViewDayTitle(this, _("Tuesday"), wxDefaultPosition, wxDefaultSize); WednesdayText = new XCCalendarMonthViewDayTitle(this, _("Wednesday"), wxDefaultPosition, wxDefaultSize); @@ -129,4 +131,21 @@ void XCCalendarMonthView::ResizeFrameEvent(wxSizeEvent &SizeEvent){ this->Refresh(); +} + +void XCCalendarMonthView::DeselectOthersEvent(wxCommandEvent &DeselectEvent){ + + for (vector::iterator DayIter = CalendarDayList.begin(); + DayIter != CalendarDayList.end(); DayIter++){ + + if (DeselectEvent.GetClientData() != (void*)(*DayIter)){ + + wxCommandEvent DeselectEvent(XCCALENDARDAY_DESELECTALLENTRIES); + DeselectEvent.SetId(ID_DESELECTALLITEMS); + wxPostEvent((*DayIter), DeselectEvent); + + } + + } + } \ No newline at end of file diff --git a/source/widgets/XCCalendarMonthView.h b/source/widgets/XCCalendarMonthView.h index d09f4cd..9799ea8 100644 --- a/source/widgets/XCCalendarMonthView.h +++ b/source/widgets/XCCalendarMonthView.h @@ -57,6 +57,7 @@ class XCCalendarMonthView: public wxFrame void PaintFrameEvent(wxPaintEvent &PaintEvent); void ResizeFrameEvent(wxSizeEvent &SizeEvent); + void DeselectOthersEvent(wxCommandEvent &DeselectEvent); DECLARE_EVENT_TABLE() -- 2.39.5