Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
frmMain: Implemented code to hide/show calendar entries
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sat, 31 Dec 2016 20:57:29 +0000 (20:57 +0000)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sat, 31 Dec 2016 20:57:29 +0000 (20:57 +0000)
Implemented code to hide/show calendar entries based on account or
calendar.

19 files changed:
source/common/events.h
source/libraries/CalendarDataStorage/CalendarDataStorage.cpp
source/widgets/XCCalendarCtrl.cpp
source/widgets/XCCalendarCtrl.h
source/widgets/XCCalendarDay.cpp
source/widgets/XCCalendarDay.h
source/widgets/XCCalendarDayEntry.cpp
source/widgets/XCCalendarDayEntry.h
source/widgets/XCCalendarList.cpp
source/widgets/XCCalendarList.h
source/widgets/XCCalendarListAccountCtrl.cpp
source/widgets/XCCalendarListAccountCtrl.h
source/widgets/XCCalendarListCalendarCtrl.cpp
source/widgets/XCCalendarListCalendarCtrl.h
source/widgets/XCCalendarManipulator.cpp
source/widgets/XCCalendarManipulator.h
source/widgets/XCCalendarMonthSelect.cpp
source/widgets/XCCalendarMonthView.cpp
source/widgets/XCCalendarMonthView.h

index 66db69e..0b679b1 100644 (file)
@@ -23,7 +23,58 @@ DECLARE_EVENT_TYPE(XCCALENDARMANIPULATOR_CHANGEGRID, wxID_ANY)
 DEFINE_EVENT_TYPE(XCCALENDARCTRL_CHANGEGRID);
 DECLARE_EVENT_TYPE(XCCALENDARCTRL_CHANGEGRID, wxID_ANY)
 
+DEFINE_EVENT_TYPE(XCCALENDARCTRL_HIDEACCOUNTENTRIES);
+DECLARE_EVENT_TYPE(XCCALENDARCTRL_HIDEACCOUNTENTRIES, wxID_ANY)
+
+DEFINE_EVENT_TYPE(XCCALENDARCTRL_SHOWACCOUNTENTRIES);
+DECLARE_EVENT_TYPE(XCCALENDARCTRL_SHOWACCOUNTENTRIES, wxID_ANY)
+
+DEFINE_EVENT_TYPE(XCCALENDARMONTH_HIDEACCOUNTENTRIES);
+DECLARE_EVENT_TYPE(XCCALENDARMONTH_HIDEACCOUNTENTRIES, wxID_ANY)
+
+DEFINE_EVENT_TYPE(XCCALENDARMONTH_SHOWACCOUNTENTRIES);
+DECLARE_EVENT_TYPE(XCCALENDARMONTH_SHOWACCOUNTENTRIES, wxID_ANY)
+
+DEFINE_EVENT_TYPE(XCCALENDARDAY_HIDEACCOUNTENTRIES);
+DECLARE_EVENT_TYPE(XCCALENDARDAY_HIDEACCOUNTENTRIES, wxID_ANY)
+
+DEFINE_EVENT_TYPE(XCCALENDARDAY_SHOWACCOUNTENTRIES);
+DECLARE_EVENT_TYPE(XCCALENDARDAY_SHOWACCOUNTENTRIES, wxID_ANY)
+
+DEFINE_EVENT_TYPE(XCCALENDARDAYENTRY_HIDEACCOUNTENTRIES);
+DECLARE_EVENT_TYPE(XCCALENDARDAYENTRY_HIDEACCOUNTENTRIES, wxID_ANY)
+
+DEFINE_EVENT_TYPE(XCCALENDARDAYENTRY_SHOWACCOUNTENTRIES);
+DECLARE_EVENT_TYPE(XCCALENDARDAYENTRY_SHOWACCOUNTENTRIES, wxID_ANY)
+
+DEFINE_EVENT_TYPE(XCCALENDARCTRL_HIDECALENDARENTRIES);
+DECLARE_EVENT_TYPE(XCCALENDARCTRL_HIDECALENDARENTRIES, wxID_ANY)
+
+DEFINE_EVENT_TYPE(XCCALENDARCTRL_SHOWCALENDARENTRIES);
+DECLARE_EVENT_TYPE(XCCALENDARCTRL_SHOWCALENDARENTRIES, wxID_ANY)
+
+DEFINE_EVENT_TYPE(XCCALENDARDAY_HIDECALENDARENTRIES);
+DECLARE_EVENT_TYPE(XCCALENDARDAY_HIDECALENDARENTRIES, wxID_ANY)
+
+DEFINE_EVENT_TYPE(XCCALENDARDAY_SHOWCALENDARENTRIES);
+DECLARE_EVENT_TYPE(XCCALENDARDAY_SHOWCALENDARENTRIES, wxID_ANY)
+
+DEFINE_EVENT_TYPE(XCCALENDARMONTH_SHOWCALENDARENTRIES);
+DECLARE_EVENT_TYPE(XCCALENDARMONTH_SHOWCALENDARENTRIES, wxID_ANY)
+
+DEFINE_EVENT_TYPE(XCCALENDARMONTH_HIDECALENDARENTRIES);
+DECLARE_EVENT_TYPE(XCCALENDARMONTH_HIDECALENDARENTRIES, wxID_ANY)
+
+
+
 #define ID_MONTHVIEWCLEARSELECTION 7000
 #define ID_DESELECTALLITEMS 7001
+#define ID_HIDEENTRIES 7002
+#define ID_SHOWENTRIES 7003
+#define ID_HIDECALENDARENTRIES 7004
+#define ID_SHOWCALENDARENTRIES 7005
+#define ID_CHANGEGRID 7006
+#define ID_ENTRYDESELECT 7007
+#define ID_DESELECTOTHERENTRIES 7008
 
 #endif
\ No newline at end of file
index ba82027..a47a354 100644 (file)
@@ -1380,7 +1380,7 @@ CDSGetCalendarEntryInfo CalendarDataStorage::GetEvent(int calendarEntryID)
        " entrystartyear, entrystartmonth, entrystartday, entrystarthour, entrystartminute, entrystartsecond,"
        " entryendyear, entryendmonth, entryendday, entryendhour, entryendminute, entryendsecond, "
        " entrydurationweek, entrydurationday, entrydurationhour, entrydurationminute, entrydurationsecond, "
-       " calendarid"
+       " calendarid, id"
        " FROM calendarentries WHERE id=(?1)";
        
        resultCode = sqlite3_prepare_v2(db, sqlParameter.c_str(), -1, &statementHandle, nullptr);
@@ -1435,6 +1435,7 @@ CDSGetCalendarEntryInfo CalendarDataStorage::GetEvent(int calendarEntryID)
                entryResult.entryDurationMinutes = sqlite3_column_int(statementHandle, 17);
                entryResult.entryDurationSeconds = sqlite3_column_int(statementHandle, 18);
                entryResult.calendarID = sqlite3_column_int(statementHandle, 19);
+               entryResult.calendarEntryID = sqlite3_column_int(statementHandle, 20);
                
        } else if (resultCode == SQLITE_DONE) {
                entryResult.getEventResult = CDSENTRY_NOCALENDAR;
index 2619242..b4fe633 100644 (file)
@@ -52,10 +52,21 @@ XCCalendarCtrl::XCCalendarCtrl(wxWindow *parent, CalendarDataStorage *dataStorag
        XCCalendarMonthViewGrid CurrentMonthGrid = GenerateMonthGrid(currentMonth, currentYear);
        szrMain->Add(ManipulatorCtrl, 1, wxEXPAND, 5);
                
-       MonthViewCtrl = new XCCalendarMonthView(this, "XCCalendarMonthView Test", wxDefaultPosition, wxDefaultSize, &CurrentMonthGrid, calendarStorage);
+       // TODO: Get the list of hidden accounts and calendars.
+               
+       vector<int> hideAccountsList = ManipulatorCtrl->GetHiddenAccountsList();
+       vector<int> hideCalendarsList = ManipulatorCtrl->GetHiddenCalendarsList();
+               
+       MonthViewCtrl = new XCCalendarMonthView(this, "XCCalendarMonthView Test", wxDefaultPosition, wxDefaultSize, &CurrentMonthGrid, calendarStorage, &hideAccountsList, &hideCalendarsList);
        szrMain->Add(MonthViewCtrl, 1, wxEXPAND, 5);
        
-       Connect(wxID_ANY, XCCALENDARCTRL_CHANGEGRID, wxCommandEventHandler(XCCalendarCtrl::UpdateGrid));
+       // Connect events to the control.
+       
+       Connect(ID_CHANGEGRID, XCCALENDARCTRL_CHANGEGRID, wxCommandEventHandler(XCCalendarCtrl::UpdateGrid));
+       Connect(ID_HIDEENTRIES, XCCALENDARCTRL_HIDEACCOUNTENTRIES, wxCommandEventHandler(XCCalendarCtrl::HideAccountEntries));
+       Connect(ID_SHOWENTRIES, XCCALENDARCTRL_SHOWACCOUNTENTRIES, wxCommandEventHandler(XCCalendarCtrl::ShowAccountEntries));
+       Connect(ID_HIDECALENDARENTRIES, XCCALENDARCTRL_HIDECALENDARENTRIES, wxCommandEventHandler(XCCalendarCtrl::HideCalendarEntries));
+       Connect(ID_SHOWCALENDARENTRIES, XCCALENDARCTRL_SHOWCALENDARENTRIES, wxCommandEventHandler(XCCalendarCtrl::ShowCalendarEntries));
        
 }
 
@@ -73,10 +84,15 @@ void XCCalendarCtrl::UpdateGrid(wxCommandEvent &event){
 
        OldGrid = MonthViewCtrl;
        
+       // Get the list of hidden accounts and calendars.
+               
+       vector<int> hideAccountsList = ManipulatorCtrl->GetHiddenAccountsList();
+       vector<int> hideCalendarsList = ManipulatorCtrl->GetHiddenCalendarsList();
+       
        // Create a new grid.
        
        XCCalendarMonthViewGrid NewGrid = GenerateMonthGrid(ManipulatorCtrl->GetMonth(), ManipulatorCtrl->GetYear());
-       MonthViewCtrl = new XCCalendarMonthView(this, _(""), wxDefaultPosition, wxDefaultSize, &NewGrid, calendarStorage);
+       MonthViewCtrl = new XCCalendarMonthView(this, _(""), wxDefaultPosition, wxDefaultSize, &NewGrid, calendarStorage, &hideAccountsList, &hideCalendarsList);
 
        // Detach the old grid and attach the new one.
        
@@ -90,4 +106,52 @@ void XCCalendarCtrl::UpdateGrid(wxCommandEvent &event){
        delete OldGrid;
        OldGrid = nullptr;
        
+}
+
+void XCCalendarCtrl::HideAccountEntries(wxCommandEvent &accountData){
+       
+       // Get the list of calendar IDs for the account and go through 
+       // the list of entries in each day control.
+       
+       wxCommandEvent event(XCCALENDARMONTH_HIDEACCOUNTENTRIES);
+       event.SetInt(accountData.GetInt());
+       event.SetId(ID_HIDEENTRIES);
+       wxPostEvent(MonthViewCtrl, event);
+       
+}
+
+void XCCalendarCtrl::ShowAccountEntries(wxCommandEvent &accountData){
+       
+       // Get the list of calendar IDs for the account and go through 
+       // the list of entries in each day control.
+       
+       wxCommandEvent event(XCCALENDARMONTH_SHOWACCOUNTENTRIES);
+       event.SetInt(accountData.GetInt());
+       event.SetId(ID_SHOWENTRIES);
+       wxPostEvent(MonthViewCtrl, event);
+       
+}
+
+void XCCalendarCtrl::HideCalendarEntries(wxCommandEvent &calendarData){
+       
+       // Get the list of calendar IDs for the account and go through 
+       // the list of entries in each day control.
+       
+       wxCommandEvent event(XCCALENDARMONTH_HIDECALENDARENTRIES);
+       event.SetInt(calendarData.GetInt());
+       event.SetId(ID_HIDECALENDARENTRIES);
+       wxPostEvent(MonthViewCtrl, event);
+       
+}
+
+void XCCalendarCtrl::ShowCalendarEntries(wxCommandEvent &calendarData){
+       
+       // Get the list of calendar IDs for the account and go through 
+       // the list of entries in each day control.
+       
+       wxCommandEvent event(XCCALENDARMONTH_SHOWCALENDARENTRIES);
+       event.SetInt(calendarData.GetInt());
+       event.SetId(ID_SHOWCALENDARENTRIES);
+       wxPostEvent(MonthViewCtrl, event);
+       
 }
\ No newline at end of file
index 9626a53..d153a69 100644 (file)
@@ -40,6 +40,10 @@ class XCCalendarCtrl: public wxPanel
        
        protected:
                void UpdateGrid(wxCommandEvent &event);
+               void HideAccountEntries(wxCommandEvent &accountData);
+               void ShowAccountEntries(wxCommandEvent &accountData);
+               void HideCalendarEntries(wxCommandEvent &calendarData);
+               void ShowCalendarEntries(wxCommandEvent &calendarData);
        
        public:
                XCCalendarCtrl(wxWindow *parent, CalendarDataStorage *storage);
index 13b01d4..bde3504 100644 (file)
@@ -27,9 +27,6 @@ END_EVENT_TABLE()
 
 XCCalendarDay::XCCalendarDay(wxWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size)
         : wxPanel(parent, wxID_ANY, pos, size, wxTAB_TRAVERSAL, title){
-       
-       Connect(wxID_ANY, XCCALENDARDAY_DESELECTOTHERENTRIES, wxCommandEventHandler(XCCalendarDay::DeselectOthersEvent));
-       Connect(ID_DESELECTALLITEMS, XCCALENDARDAY_DESELECTALLENTRIES, wxCommandEventHandler(XCCalendarDay::DeselectAllEvent));
 
        this->SetMinSize( wxSize( 100,100 ) );
        
@@ -88,12 +85,30 @@ XCCalendarDay::XCCalendarDay(wxWindow *parent, const wxString& title, const wxPo
        
        UpdateTopIcons();
        
+       Connect(ID_DESELECTOTHERENTRIES, XCCALENDARDAY_DESELECTOTHERENTRIES, wxCommandEventHandler(XCCalendarDay::DeselectOthersEvent));
+       Connect(ID_DESELECTALLITEMS, XCCALENDARDAY_DESELECTALLENTRIES, wxCommandEventHandler(XCCalendarDay::DeselectAllEvent));
+       Connect(ID_HIDEENTRIES, XCCALENDARDAY_HIDEACCOUNTENTRIES, wxCommandEventHandler(XCCalendarDay::HideAccountEntries));
+       Connect(ID_SHOWENTRIES, XCCALENDARDAY_SHOWACCOUNTENTRIES, wxCommandEventHandler(XCCalendarDay::ShowAccountEntries));
+       Connect(ID_HIDECALENDARENTRIES, XCCALENDARDAY_HIDECALENDARENTRIES, wxCommandEventHandler(XCCalendarDay::HideCalendarEntries));
+       Connect(ID_SHOWCALENDARENTRIES, XCCALENDARDAY_SHOWCALENDARENTRIES, wxCommandEventHandler(XCCalendarDay::ShowCalendarEntries));
+       
 }
 
 XCCalendarDay::~XCCalendarDay(){
        
        // Destory the controls from the widget.
        
+       for (vector<XCCalendarDayEntry*>::iterator CalendarEntryIter = CalendarEntryList.begin();
+               CalendarEntryIter != CalendarEntryList.end(); CalendarEntryIter++){
+       
+               delete((*CalendarEntryIter));
+                       
+       }
+       
+       CalendarEntryList.clear();
+       
+       this->Refresh();
+       
 }
 
 void XCCalendarDay::Repaint(){
@@ -193,10 +208,11 @@ void XCCalendarDay::ResizeFrameEvent(wxSizeEvent &SizeEvent)
 
 void XCCalendarDay::DeselectOthersEvent(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++){
@@ -226,8 +242,9 @@ 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++){
@@ -238,7 +255,7 @@ void XCCalendarDay::DeselectAllEvent(wxCommandEvent &DeselectEvent)
        
 }
 
-void XCCalendarDay::SetupControl(int SetupDay, int SetupMonth, int SetupYear, bool SetupIsInMonth, XCCalendarMonthView *MonthViewPointer, CalendarDataStorage *dataStorage)
+void XCCalendarDay::SetupControl(int SetupDay, int SetupMonth, int SetupYear, bool SetupIsInMonth, XCCalendarMonthView *MonthViewPointer, CalendarDataStorage *dataStorage, vector<int> *hideAccounts, vector<int> *hideCalendars)
 {
        
        // Set the day
@@ -279,14 +296,175 @@ void XCCalendarDay::SetupControl(int SetupDay, int SetupMonth, int SetupYear, bo
                
                newEntry->SetColour(&newEntryCalendarInfo.calendarColour);
                newEntry->SetTime(newEntryInfo.entryStartHour, newEntryInfo.entryStartMinute, newEntryInfo.entryStartSecond);
-               newEntry->SetEntryIDs(newEntryCalendarInfo.accountID, newEntryInfo.calendarID, newEntryInfo.calendarEntryID);
+               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();
+       
+}
+
+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();
+       Repaint();
+       
+}
+
+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();
+       Repaint();
+       
+}
\ No newline at end of file
index 5bdf7ed..6ce2186 100644 (file)
@@ -30,6 +30,7 @@
 #include "../bitmaps.h"
 
 #include "../libraries/CalendarDataStorage/CalendarDataStorage.h"
+
 class XCCalendarMonthView;
 
 class XCCalendarDay: public wxPanel
@@ -53,9 +54,16 @@ class XCCalendarDay: public wxPanel
                bool IsInMonth = false;
        
                vector<XCCalendarDayEntry*> CalendarEntryList;
+               vector<size_t> CalendarEntryListIndex;
        
                void Repaint();
        
+       protected:
+               void HideAccountEntries(wxCommandEvent &accountData);
+               void ShowAccountEntries(wxCommandEvent &accountData);
+               void HideCalendarEntries(wxCommandEvent &calendarData);
+               void ShowCalendarEntries(wxCommandEvent &calendarData);
+       
        public:
                XCCalendarDay(wxWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size);
                ~XCCalendarDay();
@@ -64,7 +72,7 @@ class XCCalendarDay: public wxPanel
                void DeselectOthersEvent(wxCommandEvent &DeselectEvent);
                void DeselectAllEvent(wxCommandEvent &DeselectEvent);
                void UpdateTopIcons();
-               void SetupControl(int SetupDay, int SetupMonth, int SetupYear, bool SetupIsInMonth, XCCalendarMonthView *MonthViewPointer, CalendarDataStorage *dataStorage);
+               void SetupControl(int SetupDay, int SetupMonth, int SetupYear, bool SetupIsInMonth, XCCalendarMonthView *MonthViewPointer, CalendarDataStorage *dataStorage, std::vector<int> *hideAccounts, std::vector<int> *hideCalendars);
        
        DECLARE_EVENT_TABLE()
 
index 047bc4a..d2d9483 100644 (file)
@@ -30,12 +30,17 @@ XCCalendarDayEntry::XCCalendarDayEntry(wxWindow* parent, const wxString& title,
         : wxPanel(parent, wxID_ANY, pos, size, wxTAB_TRAVERSAL, title){
        
        DayPanel = parent->GetParent();
-       EntryID = id;
+       entryID = id;
        
        this->SetMinSize(wxSize(65, 30));
        
        EventTextData = title.mb_str();
-       EventText = new wxStaticText(this, wxID_ANY, title, wxPoint(49, 8), wxDefaultSize, wxST_ELLIPSIZE_END);
+       EventText = new wxStaticText(this, wxID_ANY, title, wxPoint(49, 14), wxDefaultSize, wxST_ELLIPSIZE_END);
+       EventTime = new wxStaticText(this, wxID_ANY, wxT("Time"), wxPoint(49,3), wxDefaultSize, 0);
+               
+       wxFont eventTimeFont = EventTime->GetFont();
+       eventTimeFont.MakeBold();
+       EventTime->SetFont(eventTimeFont);
 
        wxMemoryInputStream alerticon(icons_alert_png, sizeof(icons_alert_png));
        wxMemoryInputStream priorityicon(icons_priority_png, sizeof(icons_priority_png));
@@ -49,10 +54,12 @@ XCCalendarDayEntry::XCCalendarDayEntry(wxWindow* parent, const wxString& title,
        AlarmIcon->SetBitmap(AlarmIconBitmap);
        HighPriorityIcon->SetBitmap(PriorityIconBitmap);
 
-       Connect(wxID_ANY, XCCALENDARDAYENTRY_DESELECT, wxCommandEventHandler(XCCalendarDayEntry::Deselect));
-       AlarmIcon->Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(XCCalendarDayEntry::LeftClick), NULL, this);
-       HighPriorityIcon->Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(XCCalendarDayEntry::LeftClick), NULL, this);
-       EventText->Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(XCCalendarDayEntry::LeftClick), NULL, this);
+       Connect(ID_ENTRYDESELECT, XCCALENDARDAYENTRY_DESELECT, wxCommandEventHandler(XCCalendarDayEntry::Deselect));
+       AlarmIcon->Connect(wxEVT_LEFT_UP, wxMouseEventHandler(XCCalendarDayEntry::LeftClick), NULL, this);
+       HighPriorityIcon->Connect(wxEVT_LEFT_UP, wxMouseEventHandler(XCCalendarDayEntry::LeftClick), NULL, this);
+       EventText->Connect(wxEVT_LEFT_UP, wxMouseEventHandler(XCCalendarDayEntry::LeftClick), NULL, this);
+       EventTime->Connect(wxEVT_LEFT_UP, wxMouseEventHandler(XCCalendarDayEntry::LeftClick), NULL, this);
+       DayPanel->Connect(wxEVT_LEFT_UP, wxMouseEventHandler(XCCalendarDayEntry::LeftClick), NULL, this);
        
        UpdateInformation();
        
@@ -140,13 +147,16 @@ void XCCalendarDayEntry::UpdateInformation(){
        
        switch(PositionMode){
                case 0:
-                       EventText->SetPosition(wxPoint(FirstPosition,8));
+                       EventText->SetPosition(wxPoint(FirstPosition,14));
+                       EventTime->SetPosition(wxPoint(FirstPosition,3));
                        break;
                case 1:
-                       EventText->SetPosition(wxPoint(SecondPosition,8));
+                       EventText->SetPosition(wxPoint(SecondPosition,14));
+                       EventTime->SetPosition(wxPoint(FirstPosition,3));
                        break;
                case 2:
-                       EventText->SetPosition(wxPoint(ThirdPosition,8));
+                       EventText->SetPosition(wxPoint(ThirdPosition,14));
+                       EventTime->SetPosition(wxPoint(FirstPosition,3));
                        break;
        }
        
@@ -165,12 +175,15 @@ void XCCalendarDayEntry::ResizeFrameEvent(wxSizeEvent &SizeEvent){
        switch(PositionMode){
                case 0:
                        EventText->SetSize(wxSize((this->GetClientRect().width - FirstPosition - 5),15));
+                       EventTime->SetSize(wxSize((this->GetClientRect().width - FirstPosition - 5),15));
                        break;
                case 1:
                        EventText->SetSize(wxSize((this->GetClientRect().width - SecondPosition - 5),15));
+                       EventTime->SetSize(wxSize((this->GetClientRect().width - SecondPosition - 5),15));
                        break;
                case 2:
-                       EventText->SetSize(wxSize((this->GetClientRect().width - ThirdPosition - 5),15));
+                       EventText->SetSize(wxSize((this->GetClientRect().width - ThirdPosition - 5),14));
+                       EventTime->SetSize(wxSize((this->GetClientRect().width - ThirdPosition - 5),15));
                        break;
        }
        
@@ -187,7 +200,8 @@ void XCCalendarDayEntry::LeftClick(wxMouseEvent &MouseEvent){
        
        this->SetBackgroundColour(wxColor(255,215,0));
        wxCommandEvent DeselectOthersEvent(XCCALENDARDAY_DESELECTOTHERENTRIES);
-       DeselectOthersEvent.SetInt(EntryID);
+       DeselectOthersEvent.SetInt(entryID);
+       DeselectOthersEvent.SetId(ID_DESELECTOTHERENTRIES);
        wxPostEvent(DayPanel, DeselectOthersEvent);
        
 }
@@ -198,9 +212,21 @@ void XCCalendarDayEntry::Deselect(wxCommandEvent &DeselectEvent){
        
 }
 
+void XCCalendarDayEntry::SetTime(int timeHour, int timeMinute, int timeSecond){
+       
+       this->timeHour = timeHour;
+       this->timeMinute = timeMinute;
+       this->timeSecond = timeSecond;
+       
+       string timeOutput = BuildEventTime(timeHour, timeMinute);
+       EventTime->SetLabel(timeOutput);
+       
+}
+
 void XCCalendarDayEntry::SetColour(Colour *ColourIn){
        
        EntryColour = *ColourIn;
+       Repaint();
        
 }
 
@@ -232,6 +258,98 @@ bool XCCalendarDayEntry::GetDisplayHighPriority(){
 
 int XCCalendarDayEntry::GetID(){
        
-       return EntryID;
+       return entryID;
+       
+}
+
+int XCCalendarDayEntry::GetCalendarID(){
+       
+       return calendarID;
+       
+}
+
+int XCCalendarDayEntry::GetAccountID(){
+       
+       return accountID;
+       
+}
+
+string XCCalendarDayEntry::BuildEventTime(int timeHour, int timeMinute){
+       
+       string timeOutput;
+       
+       if (timeHour > 12){
+               
+               timeOutput += to_string(timeHour - 12);
+               
+       } else if (timeHour > 0){
+               
+               timeOutput += to_string(timeHour);
+               
+       } else if (timeHour == 0){
+       
+               timeOutput += to_string(12);
+               
+       }
+       
+       timeOutput += ":";
+       
+       if (timeMinute < 10){
+               timeOutput += "0";
+       }       
+       
+       timeOutput += to_string(timeMinute);
+       
+       if (timeHour < 12){
+               timeOutput += "am";
+       } else {
+               timeOutput += "pm";
+       }
+       
+       return timeOutput;
+       
+}
+
+void XCCalendarDayEntry::SetEntryIDs(int accountID, int calendarID, int entryID){
+       
+       this->accountID = accountID;
+       this->calendarID = calendarID;
+       this->entryID = entryID;
+       
+}
+
+void XCCalendarDayEntry::SetAfterSpacer(wxSizerItem *afterSpacer){
+       
+       this->afterSpacer = afterSpacer;
+       
+}
+
+wxSizerItem* XCCalendarDayEntry::GetAfterSpacer(){
+       
+       return afterSpacer;
+       
+}
+
+bool XCCalendarDayEntry::SetShowAccountStatus(bool statusInput){
+       
+       showAccount = statusInput;
+       
+}
+
+bool XCCalendarDayEntry::SetShowCalendarStatus(bool statusInput){
+
+       showCalendar = statusInput;
+       
+}
+
+bool XCCalendarDayEntry::GetShowAccountStatus(){
+       
+       return showAccount;
+       
+}
+
+bool XCCalendarDayEntry::GetShowCalendarStatus(){
+
+       return showCalendar;
        
 }
\ No newline at end of file
index 33a18ca..4a74af7 100644 (file)
@@ -38,18 +38,30 @@ class XCCalendarDayEntry: public wxPanel
        private:
                wxWindow *DayPanel = nullptr;
                string EventTextData = "";
+               wxStaticText *EventTime = nullptr;
                wxStaticText *EventText = nullptr;
                wxStaticBitmap *HighPriorityIcon = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxPoint(14,7), wxDefaultSize, 0 );
                wxStaticBitmap *AlarmIcon = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxPoint(30,7), wxDefaultSize, 0 );
+               wxSizerItem *afterSpacer = nullptr;
                wxBitmap AlarmIconBitmap;
                wxBitmap PriorityIconBitmap;
        
                Colour EntryColour;
        
+               int timeHour = 0;
+               int timeMinute = 0;
+               int timeSecond = 0;
+       
                bool HasAlarm = false;
                bool HasHighPriority = false;
                int PositionMode = 0;
-               int EntryID = 0;
+       
+               int entryID = 0;
+               int accountID = 0;
+               int calendarID =0;
+               bool showAccount = true;
+               bool showCalendar = true;
+       
                const int FirstPosition = 14;
                const int SecondPosition = 30;
                const int ThirdPosition = 49;
@@ -58,6 +70,10 @@ class XCCalendarDayEntry: public wxPanel
                void RepaintSelected();
        
                void UpdateInformation();
+               
+               string BuildEventTime(int timeHour, int timeMinute);
+       
+       protected:
        
        public:
                XCCalendarDayEntry(wxWindow* parent, const wxString& title, const wxPoint& pos, const wxSize& size, const int id);
@@ -68,12 +84,22 @@ class XCCalendarDayEntry: public wxPanel
                void LeftClick(wxMouseEvent &MouseEvent);
                void Deselect(wxCommandEvent &DeselectEvent);
        
+               void SetTime(int timeHour, int timeMinute, int timeSecond);
                void SetColour(Colour *ColourIn);
                void SetDisplayAlarm(bool DisplayValue);
                void SetDisplayHighPriority(bool DisplayValue);
+               void SetEntryIDs(int accountID, int calendarID, int entryID);
+               void SetAfterSpacer(wxSizerItem *afterSpacer);
                int GetID();
+               int GetCalendarID();
+               int GetAccountID();
+               wxSizerItem* GetAfterSpacer();
                bool GetDisplayAlarm();
                bool GetDisplayHighPriority();
+               bool SetShowAccountStatus(bool statusInput);
+               bool SetShowCalendarStatus(bool statusInput);
+               bool GetShowAccountStatus();
+               bool GetShowCalendarStatus();
        
        DECLARE_EVENT_TABLE()
 };
index 6fc7f7a..84662bd 100644 (file)
@@ -75,6 +75,7 @@ void XCCalendarList::UpdateCalendarList(CalendarDataStorage *dataStorage){
                // Create the control and add it to the list.
                
                XCCalendarListAccountCtrl *newAccountCtrl = new XCCalendarListAccountCtrl(this, accountListData.accountList[AccountSeek].accountName);
+               newAccountCtrl->SetAccountID(accountListData.accountList[AccountSeek].accountID);
                
                szrMain->Add(newAccountCtrl, 0, wxEXPAND, 5);
                
@@ -89,6 +90,7 @@ void XCCalendarList::UpdateCalendarList(CalendarDataStorage *dataStorage){
                        CDSGetCalendarInfo calendarInfo = dataStorage->GetCalendar(accountListData.accountList[AccountSeek].accountName, accountCalendarList.calendarListTextID[calendarSeek]);
                        
                        XCCalendarListCalendarCtrl *newCalendarCtrl = new XCCalendarListCalendarCtrl(this, calendarInfo.calendarName, calendarInfo.calendarColour);
+                       newCalendarCtrl->SetCalendarID(accountCalendarList.calendarList[calendarSeek]);
                        
                        newAccountCtrl->AddCalendar(newCalendarCtrl);
 
@@ -102,4 +104,60 @@ void XCCalendarList::UpdateCalendarList(CalendarDataStorage *dataStorage){
        
        checksumUpdate = currentChecksum.checksumValue;
        
+}
+
+std::vector<int> XCCalendarList::GetHiddenAccountsList(){
+       
+       std::vector<int> accountList;
+       
+       // Go through each of the account controls and work
+       // out which entries should be hidden based on account.
+       
+       for (std::vector<XCCalendarListAccountCtrl*>::iterator accountListIter = accountControlList.begin();
+               accountListIter != accountControlList.end(); accountListIter++){
+       
+               if ((*accountListIter)->GetShowCheckboxState() == wxCHK_UNCHECKED){
+                       
+                       accountList.push_back((*accountListIter)->GetAccountID());
+                       
+               }
+                       
+       }
+       
+       return accountList;
+       
+}
+
+std::vector<int> XCCalendarList::GetHiddenCalendarsList(){
+
+       std::vector<int> calendarList;
+       
+       // Go through each of the calendar controls and
+       // work out which entries should be hidden based on
+       // calendar.
+
+       for (std::vector<XCCalendarListAccountCtrl*>::iterator accountListIter = accountControlList.begin();
+               accountListIter != accountControlList.end(); accountListIter++){
+       
+               // Get the list of hidden calendars.
+               
+               vector<int> calendarHiddenList = (*accountListIter)->GetHiddenCalendarList();
+                       
+               for (vector<int>::iterator calendarHiddenIter = calendarHiddenList.begin();
+                       calendarHiddenIter != calendarHiddenList.end(); calendarHiddenIter++){
+               
+                       vector<int>::iterator calendarHiddenFind = find(calendarList.begin(), calendarList.end(), *calendarHiddenIter);
+                       
+                       if (calendarHiddenFind == calendarList.end()){
+
+                               calendarList.push_back(*calendarHiddenIter);
+                               
+                       }
+                               
+               }
+                       
+       }
+       
+       return calendarList;
+       
 }
\ No newline at end of file
index e05f697..eaac1d0 100644 (file)
@@ -45,9 +45,12 @@ class XCCalendarList: public wxPopupTransientWindow
        protected:
        public:
                XCCalendarList(wxWindow *parent);
-               void UpdateCalendarList(CalendarDataStorage *dataStorage);
                ~XCCalendarList();
        
+               void UpdateCalendarList(CalendarDataStorage *dataStorage);
+               std::vector<int> GetHiddenAccountsList();
+               std::vector<int> GetHiddenCalendarsList();
+       
 };
 
 #endif
index 7ae30f8..5674da7 100644 (file)
@@ -18,6 +18,9 @@
 
 #include "XCCalendarListAccountCtrl.h"
 
+BEGIN_EVENT_TABLE(XCCalendarListAccountCtrl, wxPanel)
+END_EVENT_TABLE()
+
 using namespace std;
 
 XCCalendarListAccountCtrl::XCCalendarListAccountCtrl(wxWindow* parent, string accountName) : 
@@ -42,6 +45,11 @@ XCCalendarListAccountCtrl::XCCalendarListAccountCtrl(wxWindow* parent, string ac
        accountFont.MakeBold();
        lblAccountName->SetFont(accountFont);
                
+       // Connect events to the controls.
+       
+       chkShowAll->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxMouseEventHandler(XCCalendarListAccountCtrl::ShowAllCheckboxClick), NULL, this);
+       chkShowAll->SetValue(wxCHK_CHECKED);
+       
        // Connect them to the sizer.
        
        szrMain->Add(chkShowAll, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5);
@@ -53,6 +61,19 @@ XCCalendarListAccountCtrl::~XCCalendarListAccountCtrl(){
        
        // Delete the calendar controls.
        
+       for (std::vector<XCCalendarListCalendarCtrl*>::iterator calendarIter = calendarControlList.begin();
+               calendarIter != calendarControlList.end(); calendarIter++){
+       
+               delete *calendarIter;
+                       
+       }
+       
+       // Clear the list of deleted controls.
+       
+       calendarControlList.clear();
+       
+       // Clear the widget controls.
+       
 }
 
 void XCCalendarListAccountCtrl::AddCalendar(XCCalendarListCalendarCtrl *calendarControl){
@@ -65,4 +86,61 @@ void XCCalendarListAccountCtrl::AddCalendar(XCCalendarListCalendarCtrl *calendar
        
        calendarControlList.push_back(calendarControl);
        
+}
+
+void XCCalendarListAccountCtrl::ShowAllCheckboxClick( wxMouseEvent &mouseEvent ){
+       
+       if (chkShowAll->Get3StateValue() == wxCHK_CHECKED){
+               
+               wxCommandEvent event(XCCALENDARCTRL_SHOWACCOUNTENTRIES);
+               event.SetInt(accountID);
+               event.SetId(ID_SHOWENTRIES);
+               wxPostEvent(this->GetParent()->GetParent()->GetParent(), event);
+               
+       } else {
+               
+               wxCommandEvent event(XCCALENDARCTRL_HIDEACCOUNTENTRIES);
+               event.SetInt(accountID);
+               event.SetId(ID_HIDEENTRIES);
+               wxPostEvent(this->GetParent()->GetParent()->GetParent(), event);
+               
+       }
+       
+}
+
+wxCheckBoxState XCCalendarListAccountCtrl::GetShowCheckboxState(){
+       
+       return chkShowAll->Get3StateValue();
+       
+}
+
+int XCCalendarListAccountCtrl::GetAccountID(){
+       
+       return accountID;
+       
+}
+
+void XCCalendarListAccountCtrl::SetAccountID(int accountID){
+       
+       this->accountID = accountID;
+       
+}
+
+vector<int> XCCalendarListAccountCtrl::GetHiddenCalendarList(){
+       
+       vector<int> calendarList;
+       
+       for (vector<XCCalendarListCalendarCtrl*>::iterator calendarControlListIter = calendarControlList.begin(); 
+               calendarControlListIter != calendarControlList.end(); calendarControlListIter++){
+               
+               if ((*calendarControlListIter)->GetShowCheckboxState() == wxCHK_UNCHECKED){
+                       
+                       calendarList.push_back((*calendarControlListIter)->GetCalendarID());
+                       
+               }
+                       
+       }
+       
+       return calendarList;
+       
 }
\ No newline at end of file
index ae94b6e..da782bb 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "types.h"
 #include "colour.h"
+#include "events.h"
 #include "XCCalendarListCalendarCtrl.h"
 
 class XCCalendarListAccountCtrl: public wxPanel{
@@ -40,10 +41,18 @@ class XCCalendarListAccountCtrl: public wxPanel{
                AccountType accountType = ACCOUNTTYPE_UNKNOWN;
                std::string accountName = "";
                bool showAccounts = true;
+       
+               void ShowAllCheckboxClick( wxMouseEvent &mouseEvent );
        public:
                XCCalendarListAccountCtrl(wxWindow* parent, string accountName);
                ~XCCalendarListAccountCtrl();
                void AddCalendar(XCCalendarListCalendarCtrl *calendarControl);
+               wxCheckBoxState GetShowCheckboxState();
+               int GetAccountID();
+               void SetAccountID(int accountID);
+               std::vector<int> GetHiddenCalendarList();
+
+       DECLARE_EVENT_TABLE();
        
 };
 
index bdf1b6a..758fb4b 100644 (file)
@@ -50,6 +50,11 @@ XCCalendarListCalendarCtrl::XCCalendarListCalendarCtrl(wxWindow* parent, string
        szrMain->Add(lblCalendarName, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5);
        szrMain->Add(pnlColour, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5);
        
+       // Connect the events to the controls.
+       
+       chkShowCalendar->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxMouseEventHandler(XCCalendarListCalendarCtrl::ShowAllCheckboxClick), NULL, this);
+       chkShowCalendar->SetValue(wxCHK_CHECKED);
+       
 }
 
 XCCalendarListCalendarCtrl::~XCCalendarListCalendarCtrl(){
@@ -57,3 +62,41 @@ XCCalendarListCalendarCtrl::~XCCalendarListCalendarCtrl(){
        // Delete the controls.
        
 }
+
+wxCheckBoxState XCCalendarListCalendarCtrl::GetShowCheckboxState(){
+       
+       return chkShowCalendar->Get3StateValue();
+       
+}
+
+int XCCalendarListCalendarCtrl::GetCalendarID(){
+       
+       return calendarID;
+       
+}
+
+void XCCalendarListCalendarCtrl::SetCalendarID(int calendarID){
+       
+       this->calendarID = calendarID;
+       
+}
+
+void XCCalendarListCalendarCtrl::ShowAllCheckboxClick( wxMouseEvent &mouseEvent ){
+       
+       if (chkShowCalendar->Get3StateValue() == wxCHK_CHECKED){
+               
+               wxCommandEvent event(XCCALENDARCTRL_SHOWCALENDARENTRIES);
+               event.SetInt(calendarID);
+               event.SetId(ID_SHOWCALENDARENTRIES);
+               wxPostEvent(this->GetParent()->GetParent()->GetParent(), event);
+               
+       } else {
+               
+               wxCommandEvent event(XCCALENDARCTRL_HIDECALENDARENTRIES);
+               event.SetInt(calendarID);
+               event.SetId(ID_HIDECALENDARENTRIES);
+               wxPostEvent(this->GetParent()->GetParent()->GetParent(), event);
+               
+       }
+       
+}
\ No newline at end of file
index 9df84cd..3463f94 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "types.h"
 #include "colour.h"
+#include "events.h"
 
 class XCCalendarListCalendarCtrl: public wxPanel{
 
@@ -38,9 +39,13 @@ class XCCalendarListCalendarCtrl: public wxPanel{
                int calendarID = 0;
                std::string calendarName = "";
                bool showCalendar = true;
+               void ShowAllCheckboxClick( wxMouseEvent &mouseEvent );
        public:
                XCCalendarListCalendarCtrl(wxWindow* parent, string calendarName, Colour calendarColour);
                ~XCCalendarListCalendarCtrl();
+               wxCheckBoxState GetShowCheckboxState();
+               int GetCalendarID();
+               void SetCalendarID(int calendarID);
        
 };
  
index 7337a71..bc00983 100644 (file)
@@ -80,7 +80,7 @@ XCCalendarManipulator::XCCalendarManipulator(wxWindow* parent, const wxString& t
        CalendarsButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(XCCalendarManipulator::ShowCalendarsList), NULL, this);
        PreviousButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(XCCalendarManipulator::PreviousMonth), NULL, this);
        
-       Connect(wxID_ANY, XCCALENDARMANIPULATOR_CHANGEGRID, wxCommandEventHandler(XCCalendarManipulator::ChangeGrid));
+       Connect(ID_CHANGEGRID, XCCALENDARMANIPULATOR_CHANGEGRID, wxCommandEventHandler(XCCalendarManipulator::ChangeGrid));
        
        // Setup the manipulator control.
 
@@ -140,6 +140,7 @@ void XCCalendarManipulator::ChangeGrid(wxCommandEvent &event){
        // Post an event to the parent control to update the grid.
        
        wxCommandEvent ChangeGrid(XCCALENDARCTRL_CHANGEGRID);
+       ChangeGrid.SetId(ID_CHANGEGRID);
        wxPostEvent(this->GetParent(), ChangeGrid);
        
        UpdateDateButtonText();
@@ -171,6 +172,7 @@ void XCCalendarManipulator::NextMonth(wxCommandEvent &event){
        // Post an event to the parent control to update the grid.
        
        wxCommandEvent ChangeGrid(XCCALENDARCTRL_CHANGEGRID);
+       ChangeGrid.SetId(ID_CHANGEGRID);
        wxPostEvent(this->GetParent(), ChangeGrid);
 
        UpdateDateButtonText();
@@ -202,6 +204,7 @@ void XCCalendarManipulator::PreviousMonth(wxCommandEvent &event){
        // Post an event to the parent control to update the grid.
        
        wxCommandEvent ChangeGrid(XCCALENDARCTRL_CHANGEGRID);
+       ChangeGrid.SetId(ID_CHANGEGRID);
        wxPostEvent(this->GetParent(), ChangeGrid);
        
        UpdateDateButtonText();
@@ -282,4 +285,16 @@ int XCCalendarManipulator::GetYear(){
        
        return Year;
        
+}
+
+vector<int> XCCalendarManipulator::GetHiddenAccountsList(){
+       
+       return calendarList->GetHiddenAccountsList();
+       
+}
+
+vector<int> XCCalendarManipulator::GetHiddenCalendarsList(){
+       
+       return calendarList->GetHiddenCalendarsList();
+       
 }
\ No newline at end of file
index 1a69bc1..1b13488 100644 (file)
@@ -20,6 +20,7 @@
 #define __WIDGETS_XCCALENDARMANIPULATOR_H__
 
 #include <string>
+#include <vector>
 
 #include <wx/wx.h>
 #include <wx/dcbuffer.h>
@@ -65,6 +66,8 @@ class XCCalendarManipulator: public wxPanel
                ~XCCalendarManipulator();
                int GetMonth();
                int GetYear();
+               std::vector<int> GetHiddenAccountsList();
+               std::vector<int> GetHiddenCalendarsList();
        
        DECLARE_EVENT_TABLE()
        
index 94e9421..5f87172 100644 (file)
@@ -82,6 +82,7 @@ void XCCalendarMonthSelect::UpdateMonthView(wxCommandEvent &event){
        
        this->Dismiss();
        wxCommandEvent UpdateGrid(XCCALENDARMANIPULATOR_CHANGEGRID);
+       UpdateGrid.SetId(ID_CHANGEGRID);
        wxPostEvent(this->GetParent(), UpdateGrid);
        
 }
index 479f59c..ffc2346 100644 (file)
@@ -24,11 +24,9 @@ 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, CalendarDataStorage *dataStorage)
+XCCalendarMonthView::XCCalendarMonthView(wxWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size, XCCalendarMonthViewGrid *grid, CalendarDataStorage *dataStorage, std::vector<int> *hideAccounts, std::vector<int> *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);
@@ -47,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.
        
@@ -68,9 +66,15 @@ 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, CalendarDataStorage *dataStorage)
+XCCalendarMonthView::XCCalendarMonthView(XCCalendarMonthViewGrid *grid, CalendarDataStorage *dataStorage, std::vector<int> *hideAccounts, std::vector<int> *hideCalendars)
         : wxPanel(NULL, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL){
        
        Connect(ID_MONTHVIEWCLEARSELECTION, XCCALENDARMONTH_DESELECTOTHERENTRIES, wxCommandEventHandler(XCCalendarMonthView::DeselectOthersEvent));
@@ -93,7 +97,7 @@ XCCalendarMonthView::XCCalendarMonthView(XCCalendarMonthViewGrid *grid, Calendar
        WindowSizer->Add(SaturdayText, 1, wxEXPAND|wxALL, 0);   
        WindowSizer->Add(SundayText, 1, wxEXPAND|wxALL, 0);
        
-       ProcessGrid(grid);
+       ProcessGrid(grid, hideAccounts, hideCalendars);
        
        // Setup the days.
        
@@ -122,7 +126,7 @@ XCCalendarMonthView::~XCCalendarMonthView(){
        
 }
 
-void XCCalendarMonthView::ProcessGrid(XCCalendarMonthViewGrid *grid){
+void XCCalendarMonthView::ProcessGrid(XCCalendarMonthViewGrid *grid, std::vector<int> *hideAccounts, std::vector<int> *hideCalendars){
        
        // TODO: Delete the old calendar entries.
        
@@ -144,7 +148,7 @@ void XCCalendarMonthView::ProcessGrid(XCCalendarMonthViewGrid *grid){
                                
                        // Setup the control.
                                
-                       CalendarDayItem->SetupControl((*DayIter).Day, (*DayIter).Month, (*DayIter).Year, (*DayIter).IsInMonth, this, calendarStorage);
+                       CalendarDayItem->SetupControl((*DayIter).Day, (*DayIter).Month, (*DayIter).Year, (*DayIter).IsInMonth, this, calendarStorage, hideAccounts, hideCalendars);
                                
                        CalendarDayList.push_back(CalendarDayItem);
                        WindowSizer->Add(CalendarDayItem, 1, wxEXPAND, 5);
@@ -203,4 +207,60 @@ void XCCalendarMonthView::DeselectOthersEvent(wxCommandEvent &DeselectEvent){
                        
        }
        
+}
+
+void XCCalendarMonthView::HideAccountEntries(wxCommandEvent &accountData){
+       
+       for (vector<XCCalendarDay*>::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<XCCalendarDay*>::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<XCCalendarDay*>::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<XCCalendarDay*>::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
index 3a91fd8..b0bc5ea 100644 (file)
@@ -50,13 +50,19 @@ class XCCalendarMonthView: public wxPanel
                XCCalendarMonthViewDayTitle *SaturdayText = nullptr;
                XCCalendarMonthViewDayTitle *SundayText = nullptr;
                CalendarDataStorage *calendarStorage = nullptr;
-               void ProcessGrid(XCCalendarMonthViewGrid *grid);
+               void ProcessGrid(XCCalendarMonthViewGrid *grid, std::vector<int> *hideAccounts, std::vector<int> *hideCalendars);
        
                void Repaint();
        
+       protected:
+               void HideAccountEntries(wxCommandEvent &accountData);
+               void ShowAccountEntries(wxCommandEvent &accountData);
+               void HideCalendarEntries(wxCommandEvent &calendarData);
+               void ShowCalendarEntries(wxCommandEvent &calendarData);
+       
        public:
-               XCCalendarMonthView(wxWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size, XCCalendarMonthViewGrid *grid, CalendarDataStorage *dataStorage);
-               XCCalendarMonthView(XCCalendarMonthViewGrid *grid, CalendarDataStorage *dataStorage);
+               XCCalendarMonthView(wxWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size, XCCalendarMonthViewGrid *grid, CalendarDataStorage *dataStorage, std::vector<int> *hideAccounts, std::vector<int> *hideCalendars);
+               XCCalendarMonthView(XCCalendarMonthViewGrid *grid, CalendarDataStorage *dataStorage, std::vector<int> *hideAccounts, std::vector<int> *hideCalendars);
                ~XCCalendarMonthView();
        
                void PaintFrameEvent(wxPaintEvent &PaintEvent);
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy