+ this->Refresh();
+
+}
+
+void XCCalendarDay::ShowAccountEntries(wxCommandEvent &accountData){
+
+ // Go through each of the controls and hide the controls (and spacing) that
+ // have the matched account IDs.
+
+ int sizerPosition = 0;
+
+ for (vector<XCCalendarDayEntry*>::iterator calendarEntryIter = calendarEntryList.begin();
+ calendarEntryIter != calendarEntryList.end(); calendarEntryIter++){
+
+ (*calendarEntryIter)->SetShowAccountStatus(true);
+
+ if ((*calendarEntryIter)->GetShowCalendarStatus() == false){
+ continue;
+ }
+
+ if ((*calendarEntryIter)->GetAccountID() == accountData.GetInt()){
+
+ wxSizerItem *calendarItem = eventListFrameSizer->GetItem((*calendarEntryIter));
+ (*calendarEntryIter)->Show(true);
+
+ // Get the spacing and hide it as well.
+
+ wxSizerItem *afterSpacer = (*calendarEntryIter)->GetAfterSpacer();
+ afterSpacer->Show(true);
+
+ }
+
+ }
+
+ this->Refresh();
+
+}
+
+void XCCalendarDay::HideCalendarEntries(wxCommandEvent &calendarData){
+
+ // Go through each of the controls and hide the controls (and spacing) that
+ // have the matched account IDs.
+
+ int sizerPosition = 0;
+
+ for (vector<XCCalendarDayEntry*>::iterator calendarEntryIter = calendarEntryList.begin();
+ calendarEntryIter != calendarEntryList.end(); calendarEntryIter++){
+
+ if ((*calendarEntryIter)->GetCalendarID() == calendarData.GetInt()){
+
+ (*calendarEntryIter)->SetShowCalendarStatus(false);
+
+ wxSizerItem *calendarItem = eventListFrameSizer->GetItem((*calendarEntryIter));
+ (*calendarEntryIter)->Show(false);
+
+ // Get the spacing and hide it as well.
+
+ wxSizerItem *afterSpacer = (*calendarEntryIter)->GetAfterSpacer();
+ afterSpacer->Show(false);
+
+ }
+
+ }
+
+ this->Refresh();
+
+}
+
+void XCCalendarDay::ShowCalendarEntries(wxCommandEvent &calendarData){
+
+ // Go through each of the controls and hide the controls (and spacing) that
+ // have the matched account IDs.
+
+ int sizerPosition = 0;
+
+ for (vector<XCCalendarDayEntry*>::iterator calendarEntryIter = calendarEntryList.begin();
+ calendarEntryIter != calendarEntryList.end(); calendarEntryIter++){
+
+ if ((*calendarEntryIter)->GetCalendarID() == calendarData.GetInt()){
+
+ (*calendarEntryIter)->SetShowCalendarStatus(true);
+
+ if ((*calendarEntryIter)->GetShowAccountStatus() == false){
+
+ // Don't show the calendar entry because the account status
+ // is set to hidden. Continue to the next one.
+
+ continue;
+
+ }
+
+ wxSizerItem *calendarItem = eventListFrameSizer->GetItem((*calendarEntryIter));
+ (*calendarEntryIter)->Show(true);
+
+ // Get the spacing and hide it as well.
+
+ wxSizerItem *afterSpacer = (*calendarEntryIter)->GetAfterSpacer();
+ afterSpacer->Show(true);
+
+ }
+
+ }
+
+ this->Refresh();
+
+}
+
+void XCCalendarDay::DeleteCalendarEntries(wxCommandEvent &calendarData){
+
+ vector<vector<XCCalendarDayEntry*>::iterator> deleteEntriesList;
+
+ for (vector<XCCalendarDayEntry*>::iterator calendarEntryIter = calendarEntryList.begin();
+ calendarEntryIter != calendarEntryList.end(); calendarEntryIter++){
+
+ if ((*calendarEntryIter)->GetCalendarID() == calendarData.GetInt()){
+
+ wxSizerItem *calendarItem = eventListFrameSizer->GetItem((*calendarEntryIter));
+ (*calendarEntryIter)->Show(false);
+
+ // Get the spacing and hide it as well.
+
+ wxSizerItem *afterSpacer = (*calendarEntryIter)->GetAfterSpacer();
+ afterSpacer->Show(false);
+
+ delete afterSpacer;
+ afterSpacer = nullptr;
+
+ delete (*calendarEntryIter);
+ deleteEntriesList.push_back(calendarEntryIter);
+
+ }
+
+ }
+
+ this->Refresh();
+ mainPanel->Layout();
+ eventListFrame->Layout();
+ eventListFrameSizer->Layout();
+
+ for (auto deleteIter : deleteEntriesList){
+ calendarEntryList.erase(deleteIter);
+ }
+
+}
+
+void XCCalendarDay::DeleteCalendarEntry(wxCommandEvent &eventData){
+
+ vector<vector<XCCalendarDayEntry*>::iterator> deleteEntriesList;
+
+ for (vector<XCCalendarDayEntry*>::iterator calendarEntryIter = calendarEntryList.begin();
+ calendarEntryIter != calendarEntryList.end(); calendarEntryIter++){
+
+ if ((*calendarEntryIter)->GetEventID() == eventData.GetInt()){
+
+ wxSizerItem *calendarItem = eventListFrameSizer->GetItem((*calendarEntryIter));
+ (*calendarEntryIter)->Show(false);
+
+ // Get the spacing and hide it as well.
+
+ wxSizerItem *afterSpacer = (*calendarEntryIter)->GetAfterSpacer();
+ afterSpacer->Show(false);
+
+ delete (*calendarEntryIter);
+ deleteEntriesList.push_back(calendarEntryIter);
+
+ }
+
+ }
+
+ for (auto deleteIter : deleteEntriesList){
+ calendarEntryList.erase(deleteIter);
+ }
+
+ this->Refresh();
+ this->Layout();
+ eventListFrame->Layout();
+ eventListFrameSizer->Layout();
+
+}
+
+void XCCalendarDay::AddCalendarEntry(wxCommandEvent &eventData){
+
+ EventProperties *eventInfo = (EventProperties*)eventData.GetClientData();
+
+ XCCalendarDayEntry *newEntry = new XCCalendarDayEntry(eventListFrame, eventInfo->eventName, wxDefaultPosition, wxDefaultSize, eventInfo->eventID);
+
+ CDSGetCalendarInfo calendarInfo = dataStorage->GetCalendar(eventInfo->calendarID);
+
+ newEntry->SetColour(&calendarInfo.calendarColour);
+ newEntry->SetTime(eventInfo->eventHour, eventInfo->eventMinute, eventInfo->eventSecond);
+ newEntry->SetEntryIDs(calendarInfo.accountID, eventInfo->calendarID, eventInfo->eventID);
+
+ eventListFrameSizer->Add(newEntry, 0, wxEXPAND, 5);
+ wxSizerItem *afterSpacer = eventListFrameSizer->Add(0, 5, 0, 0, 5);
+
+ newEntry->SetAfterSpacer(afterSpacer);
+
+ // Go through the list of calendar entries to hide by account.
+
+ for (vector<int>::iterator hideAccountsItem = eventInfo->hideAccountsList.begin();
+ hideAccountsItem != eventInfo->hideAccountsList.end(); hideAccountsItem++){
+
+ if (*hideAccountsItem = calendarInfo.accountID){
+ newEntry->Show(false);
+ newEntry->GetAfterSpacer()->Show(false);
+ }
+
+ }
+
+ // Go through the list of calendar entries to hide by calendar.
+
+ for (vector<int>::iterator hideCalendarsItem = eventInfo->hideCalendarsList.begin();
+ hideCalendarsItem != eventInfo->hideCalendarsList.end(); hideCalendarsItem++){
+
+ if (*hideCalendarsItem == eventInfo->calendarID){
+ newEntry->Show(false);
+ newEntry->GetAfterSpacer()->Show(false);
+ }
+
+ }
+
+ calendarEntryList.push_back(newEntry);
+
+ this->Refresh();
+ mainPanel->Layout();
+ eventListFrame->Layout();
+ eventListFrameSizer->Layout();
+
+}
+
+void XCCalendarDay::UpdateCalendarEntry(wxCommandEvent &eventData){
+
+ // Go thorugh each of the entries in the day and
+ // then update it.
+
+ EventProperties *eventInfo = (EventProperties*)eventData.GetClientData();
+
+ for (vector<XCCalendarDayEntry*>::iterator calendarEntryIter = calendarEntryList.begin();
+ calendarEntryIter != calendarEntryList.end(); calendarEntryIter++){
+
+ if ((*calendarEntryIter)->GetEventID() == eventInfo->eventID){
+
+ (*calendarEntryIter)->SetEventName(eventInfo->eventName);
+ (*calendarEntryIter)->SetTime(eventInfo->eventHour, eventInfo->eventMinute, eventInfo->eventSecond);
+
+
+ }
+
+ }
+
+ delete eventInfo;
+ eventInfo = nullptr;
+
+}
+
+void XCCalendarDay::UpdateCalendarColour(wxCommandEvent &colourData){
+
+ // Go thorugh each of the entries in the day and
+ // then update it.
+
+ ColourUpdateProperties *colourInfo = (ColourUpdateProperties*)colourData.GetClientData();
+
+ for (vector<XCCalendarDayEntry*>::iterator calendarEntryIter = calendarEntryList.begin();
+ calendarEntryIter != calendarEntryList.end(); calendarEntryIter++){
+
+ if ((*calendarEntryIter)->GetCalendarID() == colourInfo->calendarID){
+
+ (*calendarEntryIter)->SetColour(&colourInfo->newColour);
+
+ }
+
+ }
+
+}
+
+int XCCalendarDay::GetCalendarDay(){
+
+ return calendarDay;
+
+}
+
+int XCCalendarDay::GetCalendarMonth(){
+
+ return calendarMonth;
+
+}
+
+int XCCalendarDay::GetCalendarYear(){
+
+ return calendarYear;
+