X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Fwidgets%2FXCCalendarMonthView.cpp;h=ffc2346aa2b502780aa66d9b47118347fd3ac30f;hb=30cbe48e8a3eb7ecbff5d9bf0b2ad69bcd7dbd47;hp=64452d52819e865905a9c58249174f3a4e24f0b3;hpb=f1ecf412b80a5c25421595fde8f1e86131414f4c;p=xestiacalendar%2F.git diff --git a/source/widgets/XCCalendarMonthView.cpp b/source/widgets/XCCalendarMonthView.cpp index 64452d5..ffc2346 100644 --- a/source/widgets/XCCalendarMonthView.cpp +++ b/source/widgets/XCCalendarMonthView.cpp @@ -24,10 +24,10 @@ 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, std::vector *hideAccounts, std::vector *hideCalendars) : 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); @@ -45,7 +45,7 @@ XCCalendarMonthView::XCCalendarMonthView(wxWindow *parent, const wxString& title WindowSizer->Add(SaturdayText, 1, wxEXPAND|wxALL, 0); WindowSizer->Add(SundayText, 1, wxEXPAND|wxALL, 0); - ProcessGrid(grid); + ProcessGrid(grid, hideAccounts, hideCalendars); // Setup the days. @@ -66,12 +66,20 @@ XCCalendarMonthView::XCCalendarMonthView(wxWindow *parent, const wxString& title this->Layout(); this->SetBackgroundColour(wxColour(0,0,0)); + Connect(ID_MONTHVIEWCLEARSELECTION, XCCALENDARMONTH_DESELECTOTHERENTRIES, wxCommandEventHandler(XCCalendarMonthView::DeselectOthersEvent)); + Connect(ID_HIDEENTRIES, XCCALENDARMONTH_HIDEACCOUNTENTRIES, wxCommandEventHandler(XCCalendarMonthView::HideAccountEntries)); + Connect(ID_SHOWENTRIES, XCCALENDARMONTH_SHOWACCOUNTENTRIES, wxCommandEventHandler(XCCalendarMonthView::ShowAccountEntries)); + Connect(ID_HIDECALENDARENTRIES, XCCALENDARMONTH_HIDECALENDARENTRIES, wxCommandEventHandler(XCCalendarMonthView::HideCalendarEntries)); + Connect(ID_SHOWCALENDARENTRIES, XCCALENDARMONTH_SHOWCALENDARENTRIES, wxCommandEventHandler(XCCalendarMonthView::ShowCalendarEntries)); + } -XCCalendarMonthView::XCCalendarMonthView(XCCalendarMonthViewGrid *grid) +XCCalendarMonthView::XCCalendarMonthView(XCCalendarMonthViewGrid *grid, CalendarDataStorage *dataStorage, std::vector *hideAccounts, std::vector *hideCalendars) : 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); @@ -89,7 +97,7 @@ XCCalendarMonthView::XCCalendarMonthView(XCCalendarMonthViewGrid *grid) WindowSizer->Add(SaturdayText, 1, wxEXPAND|wxALL, 0); WindowSizer->Add(SundayText, 1, wxEXPAND|wxALL, 0); - ProcessGrid(grid); + ProcessGrid(grid, hideAccounts, hideCalendars); // Setup the days. @@ -118,7 +126,7 @@ XCCalendarMonthView::~XCCalendarMonthView(){ } -void XCCalendarMonthView::ProcessGrid(XCCalendarMonthViewGrid *grid){ +void XCCalendarMonthView::ProcessGrid(XCCalendarMonthViewGrid *grid, std::vector *hideAccounts, std::vector *hideCalendars){ // TODO: Delete the old calendar entries. @@ -140,7 +148,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, hideAccounts, hideCalendars); CalendarDayList.push_back(CalendarDayItem); WindowSizer->Add(CalendarDayItem, 1, wxEXPAND, 5); @@ -199,4 +207,60 @@ void XCCalendarMonthView::DeselectOthersEvent(wxCommandEvent &DeselectEvent){ } +} + +void XCCalendarMonthView::HideAccountEntries(wxCommandEvent &accountData){ + + for (vector::iterator DayIter = CalendarDayList.begin(); + DayIter != CalendarDayList.end(); DayIter++){ + + wxCommandEvent HideEvent(XCCALENDARDAY_HIDEACCOUNTENTRIES); + HideEvent.SetInt(accountData.GetInt()); + HideEvent.SetId(ID_HIDEENTRIES); + wxPostEvent((*DayIter), HideEvent); + + } + +} + +void XCCalendarMonthView::ShowAccountEntries(wxCommandEvent &accountData){ + + for (vector::iterator DayIter = CalendarDayList.begin(); + DayIter != CalendarDayList.end(); DayIter++){ + + wxCommandEvent ShowEvent(XCCALENDARDAY_SHOWACCOUNTENTRIES); + ShowEvent.SetInt(accountData.GetInt()); + ShowEvent.SetId(ID_SHOWENTRIES); + wxPostEvent((*DayIter), ShowEvent); + + } + +} + +void XCCalendarMonthView::HideCalendarEntries(wxCommandEvent &accountData){ + + for (vector::iterator DayIter = CalendarDayList.begin(); + DayIter != CalendarDayList.end(); DayIter++){ + + wxCommandEvent HideEvent(XCCALENDARDAY_HIDECALENDARENTRIES); + HideEvent.SetInt(accountData.GetInt()); + HideEvent.SetId(ID_HIDECALENDARENTRIES); + wxPostEvent((*DayIter), HideEvent); + + } + +} + +void XCCalendarMonthView::ShowCalendarEntries(wxCommandEvent &accountData){ + + for (vector::iterator DayIter = CalendarDayList.begin(); + DayIter != CalendarDayList.end(); DayIter++){ + + wxCommandEvent HideEvent(XCCALENDARDAY_SHOWCALENDARENTRIES); + HideEvent.SetInt(accountData.GetInt()); + HideEvent.SetId(ID_SHOWCALENDARENTRIES); + wxPostEvent((*DayIter), HideEvent); + + } + } \ No newline at end of file