Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
XCCalendarDay: Removed unused code and added code to add event controls
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Thu, 29 Dec 2016 19:52:00 +0000 (19:52 +0000)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Thu, 29 Dec 2016 19:52:00 +0000 (19:52 +0000)
source/widgets/XCCalendarDay.cpp
source/widgets/XCCalendarDay.h

index bc8dc46..13b01d4 100644 (file)
@@ -66,44 +66,6 @@ XCCalendarDay::XCCalendarDay(wxWindow *parent, const wxString& title, const wxPo
        EventColour.red = 40; EventColour.green = 80; EventColour.blue = 80;
        
        EventListFrame->SetSizer(EventListFrameSizer);
-       /*CalendarEntry1->SetColour(&EventColour);
-       CalendarEntry1->SetDisplayAlarm(false);
-       CalendarEntry1->SetDisplayHighPriority(false);
-       EventListFrameSizer->Add(CalendarEntry1, 0, wxEXPAND, 5);
-       EventListFrameSizer->Add(0, 5, 0, 0, 5);
-       
-       EventColour.red = 255; EventColour.green = 0; EventColour.blue = 0;
-       CalendarEntry2->SetColour(&EventColour);
-       CalendarEntry2->SetDisplayAlarm(true);
-       CalendarEntry2->SetDisplayHighPriority(false);
-       EventListFrameSizer->Add(CalendarEntry2, 0, wxEXPAND, 5);
-       EventListFrameSizer->Add(0, 5, 0, 0, 5);
-       
-       EventColour.red = 0; EventColour.green = 255; EventColour.blue = 0;
-       CalendarEntry3->SetColour(&EventColour);
-       CalendarEntry3->SetDisplayAlarm(false);
-       CalendarEntry3->SetDisplayHighPriority(false);
-       EventListFrameSizer->Add(CalendarEntry3, 0, wxEXPAND, 5);
-       EventListFrameSizer->Add(0, 5, 0, 0, 5);
-
-       EventColour.red = 0; EventColour.green = 0; EventColour.blue = 255;
-       CalendarEntry4->SetColour(&EventColour);
-       CalendarEntry4->SetDisplayAlarm(false);
-       CalendarEntry4->SetDisplayHighPriority(false);
-       EventListFrameSizer->Add(CalendarEntry4, 0, wxEXPAND, 5);
-       EventListFrameSizer->Add(0, 5, 0, 0, 5);
-       
-       EventListFrameSizer->Add(CalendarEntry5, 0, wxEXPAND, 5);
-       EventListFrameSizer->Add(0, 5, 0, 0, 5);
-       EventListFrameSizer->Add(CalendarEntry6, 0, wxEXPAND, 5);
-       EventListFrameSizer->Add(0, 5, 0, 0, 5);
-       EventListFrameSizer->Add(CalendarEntry7, 0, wxEXPAND, 5);
-       EventListFrameSizer->Add(0, 5, 0, 0, 5);
-       EventListFrameSizer->Add(CalendarEntry8, 0, wxEXPAND, 5);
-       EventListFrameSizer->Add(0, 5, 0, 0, 5);
-       EventListFrameSizer->Add(CalendarEntry9, 0, wxEXPAND, 5);
-       EventListFrameSizer->Add(0, 5, 0, 0, 5);
-       EventListFrameSizer->Add(CalendarEntry10, 0, wxEXPAND, 5);*/
 
        EventListFrame->SetScrollRate(0,1);
        //EventListFrameSizer->FitInside(EventListFrame);
@@ -113,9 +75,10 @@ XCCalendarDay::XCCalendarDay(wxWindow *parent, const wxString& title, const wxPo
 
        // Setup the scroll window.
        
+       MainSectionSizer->Add(EventListFrame, 1, wxGROW | wxALL, 10);
+       
        WindowSizer->Add(TopSectionSizer, 1, wxEXPAND, 5);
        WindowSizer->Add(MainSectionSizer, 1, wxEXPAND, 5);
-       MainSectionSizer->Add(EventListFrame, 1, wxGROW | wxALL, 10);
 
        this->SetSizer(WindowSizer);
        this->SetSize(size);
@@ -123,17 +86,6 @@ XCCalendarDay::XCCalendarDay(wxWindow *parent, const wxString& title, const wxPo
        this->SetBackgroundStyle(wxBG_STYLE_PAINT);
        this->Centre(wxBOTH);
        
-       /*CalendarEntryList.push_back(CalendarEntry1);
-       CalendarEntryList.push_back(CalendarEntry2);
-       CalendarEntryList.push_back(CalendarEntry3);
-       CalendarEntryList.push_back(CalendarEntry4);
-       CalendarEntryList.push_back(CalendarEntry5);
-       CalendarEntryList.push_back(CalendarEntry6);
-       CalendarEntryList.push_back(CalendarEntry7);
-       CalendarEntryList.push_back(CalendarEntry8);
-       CalendarEntryList.push_back(CalendarEntry9);
-       CalendarEntryList.push_back(CalendarEntry10);*/
-       
        UpdateTopIcons();
        
 }
@@ -286,16 +238,21 @@ void XCCalendarDay::DeselectAllEvent(wxCommandEvent &DeselectEvent)
        
 }
 
-void XCCalendarDay::SetupControl(int SetupDay, int SetupMonth, int SetupYear, bool SetupIsInMonth, XCCalendarMonthView *MonthViewPointer)
+void XCCalendarDay::SetupControl(int SetupDay, int SetupMonth, int SetupYear, bool SetupIsInMonth, XCCalendarMonthView *MonthViewPointer, CalendarDataStorage *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.
        
@@ -305,4 +262,31 @@ void XCCalendarDay::SetupControl(int SetupDay, int SetupMonth, int SetupYear, bo
        
        this->MonthViewPointer = MonthViewPointer;
        
-}
\ No newline at end of file
+       // 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);
+               
+               CalendarEntryList.push_back(newEntry);
+       }
+       
+}
index 580c4cf..5bdf7ed 100644 (file)
@@ -29,6 +29,7 @@
 #include "../common/events.h"
 #include "../bitmaps.h"
 
+#include "../libraries/CalendarDataStorage/CalendarDataStorage.h"
 class XCCalendarMonthView;
 
 class XCCalendarDay: public wxPanel
@@ -46,6 +47,9 @@ class XCCalendarDay: public wxPanel
                wxStaticText *NumberText = nullptr;
                wxScrolledWindow *EventListFrame = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
                int CalendarEntrySeekNumber = 0;
+               int calendarDay = 0;
+               int calendarMonth = 0;
+               int calendarYear = 0;
                bool IsInMonth = false;
        
                vector<XCCalendarDayEntry*> CalendarEntryList;
@@ -60,7 +64,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);
+               void SetupControl(int SetupDay, int SetupMonth, int SetupYear, bool SetupIsInMonth, XCCalendarMonthView *MonthViewPointer, CalendarDataStorage *dataStorage);
        
        DECLARE_EVENT_TABLE()
 
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