Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
widgets: Cleanup objects in destructors and minor code cleanup
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Fri, 2 Feb 2018 00:05:18 +0000 (00:05 +0000)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Fri, 2 Feb 2018 00:05:18 +0000 (00:05 +0000)
16 files changed:
source/widgets/XCCalendarCtrl.cpp
source/widgets/XCCalendarDay.cpp
source/widgets/XCCalendarDayEntry.cpp
source/widgets/XCCalendarDayEntry.h
source/widgets/XCCalendarList.cpp
source/widgets/XCCalendarListAccountCtrl.cpp
source/widgets/XCCalendarListCalendarCtrl.cpp
source/widgets/XCCalendarManipulator.cpp
source/widgets/XCCalendarMenu.cpp
source/widgets/XCCalendarMenu.h
source/widgets/XCCalendarMonthSelect.cpp
source/widgets/XCCalendarMonthView.cpp
source/widgets/XCCalendarMonthView.h
source/widgets/XCCalendarMonthViewDayTitle.cpp
source/widgets/XCEventMenu.cpp
source/widgets/XCEventMenu.h

index 5a9e598..8bd5696 100644 (file)
@@ -85,6 +85,30 @@ XCCalendarCtrl::XCCalendarCtrl(wxWindow *parent, CalendarDataStorage *dataStorag
 XCCalendarCtrl::~XCCalendarCtrl(){
        
        // Destory the controls in the XCCalendarCtrl class.
+
+       Unbind(XCCALENDARCTRL_CHANGEGRID, &XCCalendarCtrl::UpdateGrid, this, ID_CHANGEGRID);
+       Unbind(XCCALENDARCTRL_HIDEACCOUNTENTRIES, &XCCalendarCtrl::HideAccountEntries, this, ID_HIDEENTRIES);
+       Unbind(XCCALENDARCTRL_SHOWACCOUNTENTRIES, &XCCalendarCtrl::ShowAccountEntries, this, ID_SHOWENTRIES);
+       Unbind(XCCALENDARCTRL_HIDECALENDARENTRIES, &XCCalendarCtrl::HideCalendarEntries, this, ID_HIDECALENDARENTRIES);
+       Unbind(XCCALENDARCTRL_SHOWCALENDARENTRIES, &XCCalendarCtrl::ShowCalendarEntries, this, ID_SHOWCALENDARENTRIES);
+       Unbind(XCCALENDARCTRL_DELETECALENDARENTRIES, &XCCalendarCtrl::DeleteCalendarEntries, this, ID_DELETECALENDARENTRIES);
+       Unbind(XCCALENDARCTRL_DELETEENTRY, &XCCalendarCtrl::DeleteCalendarEntry, this, ID_DELETEENTRY);
+       Unbind(XCCALENDARCTRL_ADDENTRY, &XCCalendarCtrl::AddCalendarEntry, this, ID_ADDENTRY);
+       Unbind(XCCALENDARCTRL_UPDATEENTRY, &XCCalendarCtrl::UpdateCalendarEntry, this, ID_UPDATEENTRY);
+       Unbind(XCCALENDARCTRL_DELETEENTRY, &XCCalendarCtrl::DeleteCalendarEntry, this, ID_DELETEENTRY);
+       Unbind(XCCALENDARCTRL_UPDATECALENDARCOLOUR, &XCCalendarCtrl::UpdateCalendarColour, this, ID_UPDATECOLOUR);
+       
+       szrMain->Clear();
+       
+       delete monthViewCtrl;
+       monthViewCtrl = nullptr;
+       
+       delete manipulatorCtrl;
+       manipulatorCtrl = nullptr;
+       
+       calendarStorage = nullptr;
+       
+       this->SetSizer(nullptr, true);
        
 }
 
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);
                        
-                       
                }
                        
        }
index 82b8b9c..034e5e7 100644 (file)
@@ -101,6 +101,45 @@ XCCalendarDayEntry::~XCCalendarDayEntry(){
        
        // Destory the controls from the widget.
        
+       // Disconnect and unbind.
+       
+       calendarColour->Disconnect(wxEVT_LEFT_UP, wxMouseEventHandler(XCCalendarDayEntry::LeftClick), NULL, this);
+       alarmIcon->Disconnect(wxEVT_LEFT_UP, wxMouseEventHandler(XCCalendarDayEntry::LeftClick), NULL, this);
+       highPriorityIcon->Disconnect(wxEVT_LEFT_UP, wxMouseEventHandler(XCCalendarDayEntry::LeftClick), NULL, this);
+       eventText->Disconnect(wxEVT_LEFT_UP, wxMouseEventHandler(XCCalendarDayEntry::LeftClick), NULL, this);
+       eventTime->Disconnect(wxEVT_LEFT_UP, wxMouseEventHandler(XCCalendarDayEntry::LeftClick), NULL, this);
+       dayPanel->Disconnect(wxEVT_LEFT_UP, wxMouseEventHandler(XCCalendarDayEntry::LeftClick), NULL, this);
+
+       calendarColour->Disconnect(wxEVT_RIGHT_UP, wxMouseEventHandler(XCCalendarDayEntry::RightClick), NULL, this);
+       alarmIcon->Disconnect(wxEVT_RIGHT_UP, wxMouseEventHandler(XCCalendarDayEntry::RightClick), NULL, this);
+       highPriorityIcon->Disconnect(wxEVT_RIGHT_UP, wxMouseEventHandler(XCCalendarDayEntry::RightClick), NULL, this);
+       eventText->Disconnect(wxEVT_RIGHT_UP, wxMouseEventHandler(XCCalendarDayEntry::RightClick), NULL, this);
+       eventTime->Disconnect(wxEVT_RIGHT_UP, wxMouseEventHandler(XCCalendarDayEntry::RightClick), NULL, this);
+       dayPanel->Disconnect(wxEVT_RIGHT_UP, wxMouseEventHandler(XCCalendarDayEntry::RightClick), NULL, this);
+       
+       Unbind(XCCALENDARDAYENTRY_DESELECT, &XCCalendarDayEntry::Deselect, this, ID_ENTRYDESELECT);
+       
+       // Delete the controls.
+       
+       mainSizer->Clear();
+       
+       delete eventText;
+       eventText = nullptr;
+       
+       delete eventTime;
+       eventTime = nullptr;
+       
+       delete calendarColour;
+       calendarColour = nullptr;
+       
+       delete mainPanel;
+       mainPanel = nullptr;
+       
+       delete highPriorityIcon;
+       delete alarmIcon;
+       
+       this->SetSizer(nullptr, true);
+       
 }
 
 void XCCalendarDayEntry::UpdateInformation(){
@@ -350,7 +389,7 @@ void XCCalendarDayEntry::SetAfterSpacer(wxSizerItem *afterSpacer){
 
 void XCCalendarDayEntry::SetEventName(string eventName){
        
-       eventText->SetLabel((wxString)eventName);
+       eventText->SetLabel(wxString(eventName));
        
 }
 
index c82faf2..823a44c 100644 (file)
@@ -48,7 +48,6 @@ class XCCalendarDayEntry: public wxPanel
                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 );
                wxBoxSizer *mainSizer = nullptr;
-               wxBoxSizer *borderSizer = nullptr;
                wxSizerItem *afterSpacer = nullptr;
                wxBitmap alarmIconBitmap;
                wxBitmap priorityIconBitmap;
index 9dae3fc..92e7c50 100644 (file)
@@ -31,6 +31,19 @@ XCCalendarList::XCCalendarList(wxWindow *parent)
 
 XCCalendarList::~XCCalendarList(){
        
+       // Delete the calendar lists.
+       
+       for (vector<XCCalendarListAccountCtrl*>::iterator accountCtrlIter = accountControlList.begin();
+               accountCtrlIter != accountControlList.end(); accountCtrlIter++){
+               
+               delete *accountCtrlIter;
+                       
+       }
+       
+       accountControlList.clear();
+       
+       this->SetSizer(nullptr, true);
+       
 }
 
 void XCCalendarList::UpdateCalendarList(CalendarDataStorage *dataStorage){
index 46d0e36..dbd105e 100644 (file)
@@ -37,7 +37,7 @@ XCCalendarListAccountCtrl::XCCalendarListAccountCtrl(wxWindow* parent, string ac
        
        // Setup the label.
        
-       lblAccountName = new wxStaticText(this, wxID_ANY, wxString(accountName), wxDefaultPosition, wxDefaultSize, 0, "");
+       lblAccountName = new wxStaticText(this, wxID_ANY, wxString(accountName.c_str(), wxConvUTF8), wxDefaultPosition, wxDefaultSize, 0, "");
                
        // Setup the font.
                
@@ -61,6 +61,12 @@ XCCalendarListAccountCtrl::~XCCalendarListAccountCtrl(){
        
        // Delete the calendar controls.
        
+       // Unbind the controls.
+       
+       chkShowAll->Disconnect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxMouseEventHandler(XCCalendarListAccountCtrl::ShowAllCheckboxClick), NULL, this);
+       
+       // Delete the calendar list controls.
+       
        for (std::vector<XCCalendarListCalendarCtrl*>::iterator calendarIter = calendarControlList.begin();
                calendarIter != calendarControlList.end(); calendarIter++){
        
@@ -73,6 +79,14 @@ XCCalendarListAccountCtrl::~XCCalendarListAccountCtrl(){
        calendarControlList.clear();
        
        // Clear the widget controls.
+
+       delete chkShowAll;
+       chkShowAll = nullptr;
+       
+       delete lblAccountName;
+       lblAccountName = nullptr;
+
+       this->SetSizer(nullptr, true);
        
 }
 
index 3729231..371b123 100644 (file)
@@ -34,7 +34,7 @@ XCCalendarListCalendarCtrl::XCCalendarListCalendarCtrl(wxWindow* parent, string
        
        // Setup the label.
        
-       lblCalendarName = new wxStaticText(this, wxID_ANY, wxString(calendarName), wxDefaultPosition, wxDefaultSize, 0, "");
+       lblCalendarName = new wxStaticText(this, wxID_ANY, wxString(calendarName.c_str(), wxConvUTF8), wxDefaultPosition, wxDefaultSize, 0, "");
        
        // Setup the colour.
                
@@ -68,6 +68,31 @@ XCCalendarListCalendarCtrl::XCCalendarListCalendarCtrl(wxWindow* parent, string
 XCCalendarListCalendarCtrl::~XCCalendarListCalendarCtrl(){
        
        // Delete the controls.
+
+       chkShowCalendar->Disconnect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxMouseEventHandler(XCCalendarListCalendarCtrl::ShowAllCheckboxClick), NULL, this);
+       chkShowCalendar->Disconnect(wxEVT_RIGHT_UP, wxMouseEventHandler(XCCalendarListCalendarCtrl::PopupMenu), NULL, this);
+       lblCalendarName->Disconnect(wxEVT_RIGHT_UP, wxMouseEventHandler(XCCalendarListCalendarCtrl::PopupMenu), NULL, this);
+       pnlColour->Disconnect(wxEVT_RIGHT_UP, wxMouseEventHandler(XCCalendarListCalendarCtrl::PopupMenu), NULL, this);
+       Disconnect(wxEVT_RIGHT_UP, wxMouseEventHandler(XCCalendarListCalendarCtrl::PopupMenu), NULL, this);
+       
+       szrMain->Clear();
+       
+       delete chkShowCalendar;
+       chkShowCalendar = nullptr;
+       
+       delete lblCalendarName;
+       lblCalendarName = nullptr;
+       
+       delete imgCalendarIcon;
+       imgCalendarIcon = nullptr;
+
+       delete calendarMenu;
+       calendarMenu = nullptr;
+
+       delete pnlColour;
+       pnlColour = nullptr;
+
+       this->SetSizer(nullptr, true);
        
 }
 
index 79ed65e..81843b5 100644 (file)
@@ -137,6 +137,62 @@ XCCalendarManipulator::XCCalendarManipulator(wxWindow* parent, const wxString& t
 XCCalendarManipulator::~XCCalendarManipulator(){
        
        // Destory the controls from the widget.
+
+       dateButton->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(XCCalendarManipulator::DateTextClick), NULL, this);
+       nextButton->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(XCCalendarManipulator::NextMonth), NULL, this);
+       calendarsButton->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(XCCalendarManipulator::ShowCalendarsList), NULL, this);
+       previousButton->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(XCCalendarManipulator::PreviousMonth), NULL, this);
+       
+#if defined(WIN32)
+       dateButton->Disconnect(wxEVT_ENTER_WINDOW, wxMouseEventHandler(XCCalendarManipulator::ButtonMouseover), NULL, this);
+       dateButton->Disconnect(wxEVT_LEAVE_WINDOW, wxMouseEventHandler(XCCalendarManipulator::ButtonMouseout), NULL, this);
+       nextButton->Disconnect(wxEVT_ENTER_WINDOW, wxMouseEventHandler(XCCalendarManipulator::ButtonMouseover), NULL, this);
+       nextButton->Disconnect(wxEVT_LEAVE_WINDOW, wxMouseEventHandler(XCCalendarManipulator::ButtonMouseout), NULL, this);
+       calendarsButton->Disconnect(wxEVT_ENTER_WINDOW, wxMouseEventHandler(XCCalendarManipulator::ButtonMouseover), NULL, this);
+       calendarsButton->Disconnect(wxEVT_LEAVE_WINDOW, wxMouseEventHandler(XCCalendarManipulator::ButtonMouseout), NULL, this);
+       previousButton->Disconnect(wxEVT_ENTER_WINDOW, wxMouseEventHandler(XCCalendarManipulator::ButtonMouseover), NULL, this);
+       previousButton->Disconnect(wxEVT_LEAVE_WINDOW, wxMouseEventHandler(XCCalendarManipulator::ButtonMouseout), NULL, this);
+#endif
+       
+       Unbind(XCCALENDARMANIPULATOR_CHANGEGRID, &XCCalendarManipulator::ChangeGrid, this, ID_CHANGEGRID);
+
+       // Delete the buttons in pnlMain.
+       
+       szrNavigation->Clear();
+       
+       delete previousButton;
+       previousButton = nullptr;
+       
+       delete nextButton;
+       nextButton = nullptr;
+       
+       delete calendarsButton;
+       calendarsButton = nullptr;
+       
+       delete dateButton;
+       dateButton = nullptr;
+       
+       // Delete szrNavigation.
+       
+       szrMain->Clear();
+       pnlMain->SetSizer(nullptr, true);
+       
+       // Delete pnlMain itself;
+       
+       delete pnlMain;
+       pnlMain = nullptr;
+
+       delete moo;
+       moo = nullptr;
+
+       delete calendarList;
+       calendarList = nullptr;
+       
+       // Delete szrMain itself;
+       
+       this->SetSizer(nullptr, true);
+
+       dataStorage = nullptr;
        
 }
 
index 1ca0550..2cb9a7c 100644 (file)
@@ -31,22 +31,12 @@ XCCalendarMenu::~XCCalendarMenu(){
 
        // Destory the XCCalendarMenu object.
        
-       // Delete the menu items.
-       
-       for (std::map<std::string, wxMenuItem*>::iterator menuItemIter = menuItems.begin(); 
-               menuItemIter != menuItems.end(); ++menuItemIter){
-       
-               // Delete the wxMenuItem object.
-               
-               this->Disconnect(menuItemIter->second->GetId(), wxEVT_COMMAND_MENU_SELECTED, 
-                       wxCommandEventHandler(XCCalendarMenu::ProcessMenuItemClick) );
-               delete(menuItemIter->second);
-               menuItemIter->second = NULL;
-       
-       }
+       // Delete the list of items in menuItems (not the menu items themselves).
        
        menuItems.clear();
        
+       // Menu items are deleted through ~wxMenuBase()
+       
 }
 
 void XCCalendarMenu::AppendMenuItem(wxString objectName, 
index 7d440ac..403735f 100644 (file)
@@ -46,7 +46,6 @@ class XCCalendarMenu : public XCCalendarMenuADT
 {
        private:
                std::map<std::string, wxMenuItem*> menuItems = {};
-               wxListCtrl *contactListCtrl = NULL;
                wxWindow *windowPtr = NULL;
                wxPopupTransientWindow *popupPtr = NULL;
                bool enableAccountSettings = FALSE;
index 6c46280..cb45c1b 100644 (file)
@@ -65,7 +65,19 @@ XCCalendarMonthSelect::XCCalendarMonthSelect(wxWindow *parent)
 
 XCCalendarMonthSelect::~XCCalendarMonthSelect(){
        
+       szrMain->Clear();
        
+       delete cmbMonth;
+       cmbMonth = nullptr;
+       
+       delete spcYear;
+       spcYear = nullptr;
+       
+       btnChange->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(XCCalendarMonthSelect::UpdateMonthView), NULL, this);
+       delete btnChange;
+       btnChange = nullptr;
+       
+       this->SetSizer(nullptr, true);
        
 }
 
index 6f801e5..941a484 100644 (file)
@@ -91,6 +91,7 @@ XCCalendarMonthView::XCCalendarMonthView(wxWindow *parent, const wxString& title
        Bind(XCCALENDARMONTH_ADDENTRY, &XCCalendarMonthView::AddCalendarEntry, this, ID_ADDENTRY);
        Bind(XCCALENDARMONTH_UPDATEENTRY, &XCCalendarMonthView::UpdateCalendarEntry, this, ID_UPDATEENTRY);
        Bind(XCCALENDARMONTH_UPDATECALENDARCOLOUR, &XCCalendarMonthView::UpdateCalendarColour, this, ID_UPDATECOLOUR);
+       
 }
 
 XCCalendarMonthView::~XCCalendarMonthView(){
@@ -110,6 +111,27 @@ XCCalendarMonthView::~XCCalendarMonthView(){
                        
        }
        
+       delete eventMenu;
+       this->SetSizer(nullptr, true);
+       
+       // Unbind events from control
+       
+       Unbind(XCCALENDARMONTH_DESELECTOTHERENTRIES, &XCCalendarMonthView::DeselectOthersEvent, this);
+       Unbind(XCCALENDARMONTH_HIDEACCOUNTENTRIES, &XCCalendarMonthView::HideAccountEntries, this);
+       Unbind(XCCALENDARMONTH_SHOWACCOUNTENTRIES, &XCCalendarMonthView::ShowAccountEntries, this);
+       Unbind(XCCALENDARMONTH_HIDECALENDARENTRIES, &XCCalendarMonthView::HideCalendarEntries, this);
+       Unbind(XCCALENDARMONTH_SHOWCALENDARENTRIES, &XCCalendarMonthView::ShowCalendarEntries, this);
+       Unbind(XCCALENDARMONTH_DELETECALENDARENTRIES, &XCCalendarMonthView::DeleteCalendarEntries, this);
+       Unbind(XCCALENDARMONTH_DISPLAYEVENTMENU, &XCCalendarMonthView::ShowEventMenu, this);
+       Unbind(XCCALENDARMONTH_DELETEENTRY, &XCCalendarMonthView::DeleteCalendarEntry, this);
+       Unbind(XCCALENDARMONTH_ADDENTRY, &XCCalendarMonthView::AddCalendarEntry, this);
+       Unbind(XCCALENDARMONTH_UPDATEENTRY, &XCCalendarMonthView::UpdateCalendarEntry, this);
+       Unbind(XCCALENDARMONTH_UPDATECALENDARCOLOUR, &XCCalendarMonthView::UpdateCalendarColour, this);
+       
+       // Don't delete CalendarDataStorage object (used elsewhere).
+       
+       calendarStorage = nullptr;
+       
 }
 
 void XCCalendarMonthView::ProcessGrid(XCCalendarMonthViewGrid *grid, std::vector<int> *hideAccounts, std::vector<int> *hideCalendars){
index 5eb3253..35e2054 100644 (file)
@@ -43,7 +43,6 @@ class XCCalendarMonthView: public wxPanel
        private:
                wxFlexGridSizer *windowSizer = new wxFlexGridSizer(0, 7, 1, 1);
                vector<XCCalendarDay*> calendarDayList;
-               wxStaticText *numberText = nullptr;
                XCCalendarMonthViewDayTitle *mondayText = nullptr;
                XCCalendarMonthViewDayTitle *tuesdayText = nullptr;
                XCCalendarMonthViewDayTitle *wednesdayText = nullptr;
index c2fb6d5..0b638f9 100644 (file)
@@ -39,4 +39,16 @@ XCCalendarMonthViewDayTitle::~XCCalendarMonthViewDayTitle()
        
        // Delete the objects.
        
+       daySizer->Remove(0);
+       delete dayText;
+       dayText = nullptr;
+
+       dayPanel->SetSizer(nullptr, true);
+       
+       windowSizer->Remove(windowSizer);
+       delete dayPanel;
+       dayPanel = nullptr;
+
+       this->SetSizer(nullptr, true);
+       
 }
\ No newline at end of file
index 6c02caa..ac3b5ec 100644 (file)
@@ -31,22 +31,12 @@ XCEventMenu::~XCEventMenu(){
 
        // Destory the XCEventMenu object.
        
-       // Delete the menu items.
-       
-       for (std::map<std::string, wxMenuItem*>::iterator menuItemIter = menuItems.begin(); 
-               menuItemIter != menuItems.end(); ++menuItemIter){
-       
-               // Delete the wxMenuItem object.
-               
-               this->Disconnect(menuItemIter->second->GetId(), wxEVT_COMMAND_MENU_SELECTED, 
-                       wxCommandEventHandler(XCEventMenu::ProcessMenuItemClick) );
-               delete(menuItemIter->second);
-               menuItemIter->second = NULL;
-       
-       }
+       // Remove items from list (but don't delete).
        
        menuItems.clear();
        
+       // Menu items are deleted through ~wxMenuBase()
+       
 }
 
 void XCEventMenu::AppendMenuItem(wxString objectName, 
index 02662f2..dab6023 100644 (file)
@@ -36,9 +36,6 @@ class XCEventMenuADT : public wxMenu
                
        protected:
                virtual void ProcessMenuItemClick(wxCommandEvent& event) {event.Skip();};
-       public:
-               XCEventMenuADT(){};
-               ~XCEventMenuADT(){};
 
 };
 
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