X-Git-Url: http://Server1/repobrowser/?p=xestiacalendar%2F.git;a=blobdiff_plain;f=source%2Fwidgets%2FXCCalendarDayEntry.cpp;h=034e5e725c09fa50cb8054d44b39f7e27c893c7c;hp=491c9883b6586d3df835313296d9aa17ffbf3f12;hb=902d948e5e45ad483c8e235690dda8f2bf596ad5;hpb=e09672385792a1594700f03e06d1293e352dcd83 diff --git a/source/widgets/XCCalendarDayEntry.cpp b/source/widgets/XCCalendarDayEntry.cpp index 491c988..034e5e7 100644 --- a/source/widgets/XCCalendarDayEntry.cpp +++ b/source/widgets/XCCalendarDayEntry.cpp @@ -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(){ @@ -244,7 +283,8 @@ void XCCalendarDayEntry::SetTime(int timeHour, int timeMinute, int timeSecond){ void XCCalendarDayEntry::SetColour(Colour *colourIn){ calendarColour->SetBackgroundColour(wxColour(colourIn->red, colourIn->green, colourIn->blue, colourIn->alpha)); - + this->Refresh(); + } void XCCalendarDayEntry::SetDisplayAlarm(bool displayValue){ @@ -349,7 +389,7 @@ void XCCalendarDayEntry::SetAfterSpacer(wxSizerItem *afterSpacer){ void XCCalendarDayEntry::SetEventName(string eventName){ - eventText->SetLabel((wxString)eventName); + eventText->SetLabel(wxString(eventName)); }