X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Fwidgets%2FXCCalendarDay.cpp;h=64b58e7a3f887ab66095af56d8269b438e88231a;hb=0efd41cdb657851e3a008aa7e3a7b9e46a62235d;hp=5d484726b36ef371dccbebfe735d7b1a0e549d16;hpb=1fe6e43892e5c572949a293a9e19704b5debadad;p=xestiacalendar%2F.git diff --git a/source/widgets/XCCalendarDay.cpp b/source/widgets/XCCalendarDay.cpp index 5d48472..64b58e7 100644 --- a/source/widgets/XCCalendarDay.cpp +++ b/source/widgets/XCCalendarDay.cpp @@ -20,6 +20,18 @@ using namespace std; +wxDEFINE_EVENT(XCCALENDARDAY_DESELECTOTHERENTRIES, wxCommandEvent); +wxDEFINE_EVENT(XCCALENDARDAY_DESELECTALLENTRIES, wxCommandEvent); +wxDEFINE_EVENT(XCCALENDARDAY_HIDEACCOUNTENTRIES, wxCommandEvent); +wxDEFINE_EVENT(XCCALENDARDAY_SHOWACCOUNTENTRIES, wxCommandEvent); +wxDEFINE_EVENT(XCCALENDARDAY_HIDECALENDARENTRIES, wxCommandEvent); +wxDEFINE_EVENT(XCCALENDARDAY_SHOWCALENDARENTRIES, wxCommandEvent); +wxDEFINE_EVENT(XCCALENDARDAY_DELETECALENDARENTRIES, wxCommandEvent); +wxDEFINE_EVENT(XCCALENDARDAY_DELETEENTRY, wxCommandEvent); +wxDEFINE_EVENT(XCCALENDARDAY_ADDENTRY, wxCommandEvent); +wxDEFINE_EVENT(XCCALENDARDAY_UPDATEENTRY, wxCommandEvent); +wxDEFINE_EVENT(XCCALENDARDAY_UPDATECALENDARCOLOUR, wxCommandEvent); + BEGIN_EVENT_TABLE(XCCalendarDay, wxPanel) EVT_PAINT(XCCalendarDay::PaintFrameEvent) EVT_SIZE(XCCalendarDay::ResizeFrameEvent) @@ -27,7 +39,6 @@ END_EVENT_TABLE() XCCalendarDay::XCCalendarDay(wxWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size) : wxPanel(parent, wxID_ANY, pos, size, wxTAB_TRAVERSAL, title){ - this->SetMinSize( wxSize( 100,100 ) ); // Setip the icons. @@ -65,7 +76,6 @@ XCCalendarDay::XCCalendarDay(wxWindow *parent, const wxString& title, const wxPo eventListFrame->SetSizer(eventListFrameSizer); eventListFrame->SetScrollRate(0,1); - //EventListFrameSizer->FitInside(EventListFrame); eventListFrameSizer->Fit(eventListFrame); eventListFrameSizer->Layout(); windowSizer->Fit(this); @@ -85,18 +95,19 @@ XCCalendarDay::XCCalendarDay(wxWindow *parent, const wxString& title, const wxPo UpdateTopIcons(); - Connect(ID_DESELECTOTHERENTRIES, XCCALENDARDAY_DESELECTOTHERENTRIES, wxCommandEventHandler(XCCalendarDay::DeselectOthersEvent)); - Connect(ID_DESELECTALLITEMS, XCCALENDARDAY_DESELECTALLENTRIES, wxCommandEventHandler(XCCalendarDay::DeselectAllEvent)); - Connect(ID_HIDEENTRIES, XCCALENDARDAY_HIDEACCOUNTENTRIES, wxCommandEventHandler(XCCalendarDay::HideAccountEntries)); - Connect(ID_SHOWENTRIES, XCCALENDARDAY_SHOWACCOUNTENTRIES, wxCommandEventHandler(XCCalendarDay::ShowAccountEntries)); - Connect(ID_HIDECALENDARENTRIES, XCCALENDARDAY_HIDECALENDARENTRIES, wxCommandEventHandler(XCCalendarDay::HideCalendarEntries)); - Connect(ID_SHOWCALENDARENTRIES, XCCALENDARDAY_SHOWCALENDARENTRIES, wxCommandEventHandler(XCCalendarDay::ShowCalendarEntries)); - Connect(ID_DELETECALENDARENTRIES, XCCALENDARDAY_DELETECALENDARENTRIES, wxCommandEventHandler(XCCalendarDay::DeleteCalendarEntries)); - Connect(ID_DELETEENTRY, XCCALENDARDAY_DELETEENTRY, wxCommandEventHandler(XCCalendarDay::DeleteCalendarEntry)); - Connect(ID_ADDENTRY, XCCALENDARDAY_ADDENTRY, wxCommandEventHandler(XCCalendarDay::AddCalendarEntry)); - Connect(ID_UPDATEENTRY, XCCALENDARDAY_UPDATEENTRY, wxCommandEventHandler(XCCalendarDay::UpdateCalendarEntry)); - Connect(ID_UPDATECOLOUR, XCCALENDARDAY_UPDATECALENDARCOLOUR, wxCommandEventHandler(XCCalendarDay::UpdateCalendarColour)); - + // Bind events to the control. + + Bind(XCCALENDARDAY_DESELECTOTHERENTRIES, &XCCalendarDay::DeselectOthersEvent, this, ID_DESELECTOTHERENTRIES); + Bind(XCCALENDARDAY_DESELECTALLENTRIES, &XCCalendarDay::DeselectAllEvent, this, ID_DESELECTALLITEMS); + Bind(XCCALENDARDAY_HIDEACCOUNTENTRIES, &XCCalendarDay::HideAccountEntries, this, ID_HIDEENTRIES); + Bind(XCCALENDARDAY_SHOWACCOUNTENTRIES, &XCCalendarDay::ShowAccountEntries, this, ID_SHOWENTRIES); + Bind(XCCALENDARDAY_HIDECALENDARENTRIES, &XCCalendarDay::HideCalendarEntries, this, ID_HIDECALENDARENTRIES); + Bind(XCCALENDARDAY_SHOWCALENDARENTRIES, &XCCalendarDay::ShowCalendarEntries, this, ID_SHOWCALENDARENTRIES); + Bind(XCCALENDARDAY_DELETECALENDARENTRIES, &XCCalendarDay::DeleteCalendarEntries, this, ID_DELETECALENDARENTRIES); + Bind(XCCALENDARDAY_DELETEENTRY, &XCCalendarDay::DeleteCalendarEntry, this, ID_DELETEENTRY); + Bind(XCCALENDARDAY_ADDENTRY, &XCCalendarDay::AddCalendarEntry, this, ID_ADDENTRY); + Bind(XCCALENDARDAY_UPDATEENTRY, &XCCalendarDay::UpdateCalendarEntry, this, ID_UPDATEENTRY); + Bind(XCCALENDARDAY_UPDATECALENDARCOLOUR, &XCCalendarDay::UpdateCalendarColour, this, ID_UPDATECOLOUR); } XCCalendarDay::~XCCalendarDay(){ @@ -105,14 +116,21 @@ XCCalendarDay::~XCCalendarDay(){ for (vector::iterator calendarEntryIter = calendarEntryList.begin(); calendarEntryIter != calendarEntryList.end(); calendarEntryIter++){ - + delete((*calendarEntryIter)); } + + delete alertIcon; + alertIcon = nullptr; - calendarEntryList.clear(); + delete highPriorityIcon; + highPriorityIcon = nullptr; - this->Refresh(); + delete eventListFrame; + eventListFrame = nullptr; + + calendarEntryList.clear(); } @@ -227,7 +245,7 @@ void XCCalendarDay::DeselectOthersEvent(wxCommandEvent &deselectEvent) wxPostEvent((*entryIter), deselectEntryEvent); } - + } // Send event notification to deselect the other calendar entries. @@ -490,12 +508,12 @@ void XCCalendarDay::DeleteCalendarEntries(wxCommandEvent &calendarData){ // Get the spacing and hide it as well. - wxSizerItem *afterSpacer = (*calendarEntryIter)->GetAfterSpacer(); + /*wxSizerItem *afterSpacer = (*calendarEntryIter)->GetAfterSpacer(); afterSpacer->Show(false); afterSpacer->DetachSizer(); delete afterSpacer; - afterSpacer = nullptr; + afterSpacer = nullptr;*/ delete (*calendarEntryIter); deleteEntriesList.push_back(calendarEntryIter); @@ -527,12 +545,12 @@ void XCCalendarDay::DeleteCalendarEntry(wxCommandEvent &eventData){ // Get the spacing and hide it as well. - wxSizerItem *afterSpacer = (*calendarEntryIter)->GetAfterSpacer(); + /*wxSizerItem *afterSpacer = (*calendarEntryIter)->GetAfterSpacer(); afterSpacer->Show(false); afterSpacer->DetachSizer(); delete afterSpacer; - afterSpacer = nullptr; + afterSpacer = nullptr;*/ delete (*calendarEntryIter); deleteEntriesList.push_back(calendarEntryIter);