Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
widgets: Cleanup objects in destructors and minor code cleanup
[xestiacalendar/.git] / source / widgets / XCCalendarDay.cpp
index 78c1687..656ad75 100644 (file)
@@ -118,6 +118,18 @@ XCCalendarDay::~XCCalendarDay(){
        
        // Destory the controls from the widget.
        
+       Unbind(XCCALENDARDAY_DESELECTOTHERENTRIES, &XCCalendarDay::DeselectOthersEvent, this, ID_DESELECTOTHERENTRIES);
+       Unbind(XCCALENDARDAY_DESELECTALLENTRIES, &XCCalendarDay::DeselectAllEvent, this, ID_DESELECTALLITEMS);
+       Unbind(XCCALENDARDAY_HIDEACCOUNTENTRIES, &XCCalendarDay::HideAccountEntries, this, ID_HIDEENTRIES);
+       Unbind(XCCALENDARDAY_SHOWACCOUNTENTRIES, &XCCalendarDay::ShowAccountEntries, this, ID_SHOWENTRIES);
+       Unbind(XCCALENDARDAY_HIDECALENDARENTRIES, &XCCalendarDay::HideCalendarEntries, this, ID_HIDECALENDARENTRIES);
+       Unbind(XCCALENDARDAY_SHOWCALENDARENTRIES, &XCCalendarDay::ShowCalendarEntries, this, ID_SHOWCALENDARENTRIES);
+       Unbind(XCCALENDARDAY_DELETECALENDARENTRIES, &XCCalendarDay::DeleteCalendarEntries, this, ID_DELETECALENDARENTRIES);
+       Unbind(XCCALENDARDAY_DELETEENTRY, &XCCalendarDay::DeleteCalendarEntry, this, ID_DELETEENTRY);
+       Unbind(XCCALENDARDAY_ADDENTRY, &XCCalendarDay::AddCalendarEntry, this, ID_ADDENTRY);
+       Unbind(XCCALENDARDAY_UPDATEENTRY, &XCCalendarDay::UpdateCalendarEntry, this, ID_UPDATEENTRY);
+       Unbind(XCCALENDARDAY_UPDATECALENDARCOLOUR, &XCCalendarDay::UpdateCalendarColour, this, ID_UPDATECOLOUR);
+       
        for (vector<XCCalendarDayEntry*>::iterator calendarEntryIter = calendarEntryList.begin();
                calendarEntryIter != calendarEntryList.end(); calendarEntryIter++){
                        
@@ -125,6 +137,14 @@ XCCalendarDay::~XCCalendarDay(){
                        
        }
 
+       eventListFrameSizer->Clear();
+       
+       eventListFrame->SetSizer(nullptr, true);
+       
+       mainSectionSizer->Clear();
+       topSectionSizer->Clear();
+       windowSizer->Clear();
+
        delete alertIcon;
        alertIcon = nullptr;
        
@@ -134,8 +154,22 @@ XCCalendarDay::~XCCalendarDay(){
        delete eventListFrame;
        eventListFrame = nullptr;
        
+       delete numberText;
+       numberText = nullptr;
+
+       delete topPanel;
+       topPanel = nullptr;
+
+       delete mainPanel;
+       mainPanel = nullptr;
+       
        calendarEntryList.clear();
        
+       this->SetSizer(nullptr, true);
+       
+       monthViewPointer = nullptr;
+       dataStorage = nullptr;
+       
 }
 
 void XCCalendarDay::UpdateTopIcons(){
@@ -538,7 +572,8 @@ void XCCalendarDay::AddCalendarEntry(wxCommandEvent &eventData){
        
        EventProperties *eventInfo = (EventProperties*)eventData.GetClientData();
        
-       XCCalendarDayEntry *newEntry = new XCCalendarDayEntry(eventListFrame, eventInfo->eventName, wxDefaultPosition, wxDefaultSize, eventInfo->eventID);
+       // TODO: Fix conversion from string to wxString
+       XCCalendarDayEntry *newEntry = new XCCalendarDayEntry(eventListFrame, wxString(eventInfo->eventName.c_str(), wxConvUTF8), wxDefaultPosition, wxDefaultSize, eventInfo->eventID);
                
        CDSGetCalendarInfo calendarInfo = dataStorage->GetCalendar(eventInfo->calendarID);
        
@@ -599,7 +634,6 @@ void XCCalendarDay::UpdateCalendarEntry(wxCommandEvent &eventData){
                        (*calendarEntryIter)->SetEventName(eventInfo->eventName);
                        (*calendarEntryIter)->SetTime(eventInfo->eventHour, eventInfo->eventMinute, eventInfo->eventSecond);
                        
-                       
                }
                        
        }
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