From 12c1ca8d2877104bd61b02ae72ef32314afeaa51 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Thu, 29 Dec 2016 19:53:14 +0000 Subject: [PATCH] XCCalendarMonthView: Receive CalendarDataStorage pointer --- source/widgets/XCCalendarMonthView.cpp | 10 +++++++--- source/widgets/XCCalendarMonthView.h | 7 +++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/source/widgets/XCCalendarMonthView.cpp b/source/widgets/XCCalendarMonthView.cpp index 64452d5..479f59c 100644 --- a/source/widgets/XCCalendarMonthView.cpp +++ b/source/widgets/XCCalendarMonthView.cpp @@ -24,10 +24,12 @@ BEGIN_EVENT_TABLE(XCCalendarMonthView, wxPanel) EVT_PAINT(XCCalendarMonthView::PaintFrameEvent) END_EVENT_TABLE() -XCCalendarMonthView::XCCalendarMonthView(wxWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size, XCCalendarMonthViewGrid *grid) +XCCalendarMonthView::XCCalendarMonthView(wxWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size, XCCalendarMonthViewGrid *grid, CalendarDataStorage *dataStorage) : wxPanel(parent, wxID_ANY, pos, size, wxTAB_TRAVERSAL){ Connect(ID_MONTHVIEWCLEARSELECTION, XCCALENDARMONTH_DESELECTOTHERENTRIES, wxCommandEventHandler(XCCalendarMonthView::DeselectOthersEvent)); + + calendarStorage = dataStorage; MondayText = new XCCalendarMonthViewDayTitle(this, _("Monday"), wxDefaultPosition, wxDefaultSize); TuesdayText = new XCCalendarMonthViewDayTitle(this, _("Tuesday"), wxDefaultPosition, wxDefaultSize); @@ -68,10 +70,12 @@ XCCalendarMonthView::XCCalendarMonthView(wxWindow *parent, const wxString& title } -XCCalendarMonthView::XCCalendarMonthView(XCCalendarMonthViewGrid *grid) +XCCalendarMonthView::XCCalendarMonthView(XCCalendarMonthViewGrid *grid, CalendarDataStorage *dataStorage) : wxPanel(NULL, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL){ Connect(ID_MONTHVIEWCLEARSELECTION, XCCALENDARMONTH_DESELECTOTHERENTRIES, wxCommandEventHandler(XCCalendarMonthView::DeselectOthersEvent)); + + calendarStorage = dataStorage; MondayText = new XCCalendarMonthViewDayTitle(this, _("Monday"), wxDefaultPosition, wxDefaultSize); TuesdayText = new XCCalendarMonthViewDayTitle(this, _("Tuesday"), wxDefaultPosition, wxDefaultSize); @@ -140,7 +144,7 @@ void XCCalendarMonthView::ProcessGrid(XCCalendarMonthViewGrid *grid){ // Setup the control. - CalendarDayItem->SetupControl((*DayIter).Day, (*DayIter).Month, (*DayIter).Year, (*DayIter).IsInMonth, this); + CalendarDayItem->SetupControl((*DayIter).Day, (*DayIter).Month, (*DayIter).Year, (*DayIter).IsInMonth, this, calendarStorage); CalendarDayList.push_back(CalendarDayItem); WindowSizer->Add(CalendarDayItem, 1, wxEXPAND, 5); diff --git a/source/widgets/XCCalendarMonthView.h b/source/widgets/XCCalendarMonthView.h index 62b986b..3a91fd8 100644 --- a/source/widgets/XCCalendarMonthView.h +++ b/source/widgets/XCCalendarMonthView.h @@ -27,6 +27,8 @@ #include "../common/events.h" #include "../common/monthviewgen.h" +#include "../libraries/CalendarDataStorage/CalendarDataStorage.h" + #include "XCCalendarMonthView.h" #include "XCCalendarMonthViewDayTitle.h" #include "XCCalendarDay.h" @@ -47,13 +49,14 @@ class XCCalendarMonthView: public wxPanel XCCalendarMonthViewDayTitle *FridayText = nullptr; XCCalendarMonthViewDayTitle *SaturdayText = nullptr; XCCalendarMonthViewDayTitle *SundayText = nullptr; + CalendarDataStorage *calendarStorage = nullptr; void ProcessGrid(XCCalendarMonthViewGrid *grid); void Repaint(); public: - XCCalendarMonthView(wxWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size, XCCalendarMonthViewGrid *grid); - XCCalendarMonthView(XCCalendarMonthViewGrid *grid); + XCCalendarMonthView(wxWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size, XCCalendarMonthViewGrid *grid, CalendarDataStorage *dataStorage); + XCCalendarMonthView(XCCalendarMonthViewGrid *grid, CalendarDataStorage *dataStorage); ~XCCalendarMonthView(); void PaintFrameEvent(wxPaintEvent &PaintEvent); -- 2.39.5