+
+ int selectedEntryID = deselectEvent.GetInt();
+
+ wxCommandEvent deselectEntryEvent(XCCALENDARDAYENTRY_DESELECT);
+ deselectEntryEvent.SetId(ID_ENTRYDESELECT);
+
+ for (vector<XCCalendarDayEntry*>::iterator entryIter = calendarEntryList.begin();
+ entryIter != calendarEntryList.end(); entryIter++){
+
+ if ((*entryIter)->GetID() != selectedEntryID){
+
+ wxPostEvent((*entryIter), deselectEntryEvent);
+
+ }
+
+ }
+
+ // Send event notification to deselect the other calendar entries.
+
+ if (this->monthViewPointer != nullptr){
+
+ wxCommandEvent deselectEvent(XCCALENDARMONTH_DESELECTOTHERENTRIES);
+ deselectEvent.SetClientData(this);
+ deselectEvent.SetId(ID_MONTHVIEWCLEARSELECTION);
+ wxPostEvent(this->monthViewPointer, deselectEvent);
+
+ }
+
+}
+
+void XCCalendarDay::DeselectAllEvent(wxCommandEvent &deselectEvent)
+{
+
+ int selectedEntryID = deselectEvent.GetInt();
+
+ wxCommandEvent deselectEntryEvent(XCCALENDARDAYENTRY_DESELECT);
+ deselectEntryEvent.SetId(ID_ENTRYDESELECT);
+
+ for (vector<XCCalendarDayEntry*>::iterator entryIter = calendarEntryList.begin();
+ entryIter != calendarEntryList.end(); entryIter++){
+
+ wxPostEvent((*entryIter), deselectEntryEvent);
+
+ }
+
+}
+
+void XCCalendarDay::SetupControl(int setupDay, int setupMonth, int setupYear, bool setupIsInMonth, XCCalendarMonthView *monthViewPointer, CalendarDataStorage *dataStorage, vector<int> *hideAccounts, vector<int> *hideCalendars)
+{
+
+ this->dataStorage = dataStorage;
+
+ // Set the day
+
+ numberText->SetLabel(wxString::Format("%02i", setupDay));
+ calendarDay = setupDay;
+
+ // Set the month
+
+ calendarMonth = setupMonth;
+
+ // Set the year.
+
+ calendarYear = setupYear;
+
+ // Setup the Is In Month value.
+
+ isInMonth = setupIsInMonth;
+
+ // Setup the month view pointer.
+
+ this->monthViewPointer = monthViewPointer;
+
+ // Setup the calendar items.
+
+ CDSEntryList calendarItems = dataStorage->GetEventListByDate(setupYear, setupMonth, setupDay);
+
+ for (int entrySeek = 0; entrySeek < calendarItems.entryList.size(); entrySeek++){
+
+ // Get the information about the calendar entry.
+
+ CDSGetCalendarEntryInfo newEntryInfo = dataStorage->GetEvent(calendarItems.entryList[entrySeek]);
+ CDSGetCalendarInfo newEntryCalendarInfo = dataStorage->GetCalendar(newEntryInfo.calendarID);
+
+ // Setup the calendar entry.
+
+ XCCalendarDayEntry *newEntry = new XCCalendarDayEntry(eventListFrame, newEntryInfo.entryName, wxDefaultPosition, wxDefaultSize, calendarItems.entryList[entrySeek]);
+
+ newEntry->SetColour(&newEntryCalendarInfo.calendarColour);
+ newEntry->SetTime(newEntryInfo.entryStartHour, newEntryInfo.entryStartMinute, newEntryInfo.entryStartSecond);
+ newEntry->SetEntryIDs(newEntryCalendarInfo.accountID, newEntryInfo.calendarID, newEntryInfo.calendarEntryID);
+
+ 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 = hideAccounts->begin();
+ hideAccountsItem != hideAccounts->end(); hideAccountsItem++){
+
+ if (*hideAccountsItem == newEntryCalendarInfo.accountID){
+ newEntry->Show(false);
+ newEntry->GetAfterSpacer()->Show(false);
+ }
+
+ }
+
+ // Go through the list of calendar entries to hide by calendar.
+
+ for (vector<int>::iterator hideCalendarsItem = hideCalendars->begin();
+ hideCalendarsItem != hideCalendars->end(); hideCalendarsItem++){
+
+ if (*hideCalendarsItem == newEntryInfo.calendarID){
+ newEntry->Show(false);
+ newEntry->GetAfterSpacer()->Show(false);
+ }
+
+ }
+
+ calendarEntryList.push_back(newEntry);
+ }
+
+}
+
+void XCCalendarDay::HideAccountEntries(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(false);
+
+ if ((*calendarEntryIter)->GetAccountID() == accountData.GetInt()){
+
+ 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();
+ Repaint();
+
+}
+
+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();
+ Repaint();
+
+}