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);
}
// 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++){
}
+ eventListFrameSizer->Clear();
+
+ eventListFrame->SetSizer(nullptr, true);
+
+ mainSectionSizer->Clear();
+ topSectionSizer->Clear();
+ windowSizer->Clear();
+
delete alertIcon;
alertIcon = nullptr;
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(){
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);
(*calendarEntryIter)->SetEventName(eventInfo->eventName);
(*calendarEntryIter)->SetTime(eventInfo->eventHour, eventInfo->eventMinute, eventInfo->eventSecond);
-
}
}
// 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(){
void XCCalendarDayEntry::SetEventName(string eventName){
- eventText->SetLabel((wxString)eventName);
+ eventText->SetLabel(wxString(eventName));
}
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;
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){
// 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.
// 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++){
calendarControlList.clear();
// Clear the widget controls.
+
+ delete chkShowAll;
+ chkShowAll = nullptr;
+
+ delete lblAccountName;
+ lblAccountName = nullptr;
+
+ this->SetSizer(nullptr, true);
}
// 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.
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);
}
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;
}
// 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,
{
private:
std::map<std::string, wxMenuItem*> menuItems = {};
- wxListCtrl *contactListCtrl = NULL;
wxWindow *windowPtr = NULL;
wxPopupTransientWindow *popupPtr = NULL;
bool enableAccountSettings = FALSE;
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);
}
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(){
}
+ 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){
private:
wxFlexGridSizer *windowSizer = new wxFlexGridSizer(0, 7, 1, 1);
vector<XCCalendarDay*> calendarDayList;
- wxStaticText *numberText = nullptr;
XCCalendarMonthViewDayTitle *mondayText = nullptr;
XCCalendarMonthViewDayTitle *tuesdayText = nullptr;
XCCalendarMonthViewDayTitle *wednesdayText = nullptr;
// 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
// 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,
protected:
virtual void ProcessMenuItemClick(wxCommandEvent& event) {event.Skip();};
- public:
- XCEventMenuADT(){};
- ~XCEventMenuADT(){};
};