Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
XCCalendarDay/XCCalendarMonthView: Fixed browse after deleting event
[xestiacalendar/.git] / source / widgets / XCCalendarDay.cpp
1 // XCCalendarDay.cpp - Xestia Calendar XCCalendarDay widget class.
2 //
3 // (c) 2016 Xestia Software Development.
4 //
5 // This file is part of Xestia Calendar.
6 //
7 // Xestia Address Book is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
10 //
11 // Xestia Address Book is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Calendar. If not, see <http://www.gnu.org/licenses/>
19 #include "XCCalendarDay.h"
21 using namespace std;
23 BEGIN_EVENT_TABLE(XCCalendarDay, wxPanel)
24 EVT_PAINT(XCCalendarDay::PaintFrameEvent)
25 EVT_SIZE(XCCalendarDay::ResizeFrameEvent)
26 END_EVENT_TABLE()
28 XCCalendarDay::XCCalendarDay(wxWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size)
29         : wxPanel(parent, wxID_ANY, pos, size, wxTAB_TRAVERSAL, title){
31         this->SetMinSize( wxSize( 100,100 ) );
32         
33         // Setip the icons.
34                 
35         wxMemoryInputStream alerticon(icons_alert32_png, sizeof(icons_alert32_png));
36         wxMemoryInputStream priorityicon(icons_priority32_png, sizeof(icons_priority32_png));
37         
38         wxImage icons_alert_png(alerticon, wxBITMAP_TYPE_PNG);
39         wxBitmap imgAlertIcon(icons_alert_png, -1);
41         wxImage icons_priority_png(priorityicon, wxBITMAP_TYPE_PNG);
42         wxBitmap imgPriorityIcon(icons_priority_png, -1);
43         
44         alertIcon->SetBitmap(imgAlertIcon);
45         highPriorityIcon->SetBitmap(imgPriorityIcon);
46         
47         windowSizer->AddGrowableCol(0);
48         windowSizer->AddGrowableRow(1);
49         windowSizer->SetFlexibleDirection( wxBOTH );
50         windowSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
51         
52         numberText = new wxStaticText(this, wxID_ANY, wxT("09"), wxDefaultPosition, wxDefaultSize, 0);
53         numberText->SetFont(wxFont(24, 70, 90, 92, false, wxEmptyString));
54         
55         topSectionSizer->Add(highPriorityIcon, 0, wxALL|wxALIGN_CENTER_VERTICAL, 0);
56         topSectionSizer->Add(alertIcon, 0, wxALL|wxALIGN_CENTER_VERTICAL, 0);
57         topSectionSizer->Add(0, 0, 1, wxEXPAND, 5);
58         topSectionSizer->Add(numberText, 0, wxALL|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5);
60         // Setup the scrollable section.
61         
62         Colour eventColour;
63         eventColour.red = 40; eventColour.green = 80; eventColour.blue = 80;
64         
65         eventListFrame->SetSizer(eventListFrameSizer);
67         eventListFrame->SetScrollRate(0,1);
68         //EventListFrameSizer->FitInside(EventListFrame);
69         eventListFrameSizer->Fit(eventListFrame);
70         eventListFrameSizer->Layout();
71         windowSizer->Fit(this);
73         // Setup the scroll window.
74         
75         mainSectionSizer->Add(eventListFrame, 1, wxGROW | wxALL, 10);
76         
77         windowSizer->Add(topSectionSizer, 1, wxEXPAND, 5);
78         windowSizer->Add(mainSectionSizer, 1, wxEXPAND, 5);
80         this->SetSizer(windowSizer);
81         this->SetSize(size);
82         this->Layout();
83         this->SetBackgroundStyle(wxBG_STYLE_PAINT);
84         this->Centre(wxBOTH);
85         
86         UpdateTopIcons();
87         
88         Connect(ID_DESELECTOTHERENTRIES, XCCALENDARDAY_DESELECTOTHERENTRIES, wxCommandEventHandler(XCCalendarDay::DeselectOthersEvent));
89         Connect(ID_DESELECTALLITEMS, XCCALENDARDAY_DESELECTALLENTRIES, wxCommandEventHandler(XCCalendarDay::DeselectAllEvent));
90         Connect(ID_HIDEENTRIES, XCCALENDARDAY_HIDEACCOUNTENTRIES, wxCommandEventHandler(XCCalendarDay::HideAccountEntries));
91         Connect(ID_SHOWENTRIES, XCCALENDARDAY_SHOWACCOUNTENTRIES, wxCommandEventHandler(XCCalendarDay::ShowAccountEntries));
92         Connect(ID_HIDECALENDARENTRIES, XCCALENDARDAY_HIDECALENDARENTRIES, wxCommandEventHandler(XCCalendarDay::HideCalendarEntries));
93         Connect(ID_SHOWCALENDARENTRIES, XCCALENDARDAY_SHOWCALENDARENTRIES, wxCommandEventHandler(XCCalendarDay::ShowCalendarEntries));
94         Connect(ID_DELETECALENDARENTRIES, XCCALENDARDAY_DELETECALENDARENTRIES, wxCommandEventHandler(XCCalendarDay::DeleteCalendarEntries));
95         Connect(ID_DELETEENTRY, XCCALENDARDAY_DELETEENTRY, wxCommandEventHandler(XCCalendarDay::DeleteCalendarEntry));
96         Connect(ID_ADDENTRY, XCCALENDARDAY_ADDENTRY, wxCommandEventHandler(XCCalendarDay::AddCalendarEntry));
97         Connect(ID_UPDATEENTRY, XCCALENDARDAY_UPDATEENTRY, wxCommandEventHandler(XCCalendarDay::UpdateCalendarEntry));
98         Connect(ID_UPDATECOLOUR, XCCALENDARDAY_UPDATECALENDARCOLOUR, wxCommandEventHandler(XCCalendarDay::UpdateCalendarColour));
102 XCCalendarDay::~XCCalendarDay(){
103         
104         // Destory the controls from the widget.
105         
106         for (vector<XCCalendarDayEntry*>::iterator calendarEntryIter = calendarEntryList.begin();
107                 calendarEntryIter != calendarEntryList.end(); calendarEntryIter++){
108                         
109                 delete((*calendarEntryIter));
110                         
111         }
113         delete alertIcon;
114         alertIcon = nullptr;
115         
116         delete highPriorityIcon;
117         highPriorityIcon = nullptr;
118         
119         delete eventListFrame;
120         eventListFrame = nullptr;
121         
122         calendarEntryList.clear();
123         
126 void XCCalendarDay::Repaint(){
127         
128         wxPaintDC dc(this);
129         wxPaintDC eventListFrameDC(eventListFrame);
130         
131         // Get the wxSizerItem for the top date and the entries part.
133         wxSizerItem *topSectionSizerItem = windowSizer->GetItem((size_t)0);
134         wxSizerItem *mainSectionSizerItem = windowSizer->GetItem((size_t)1);
135         wxRect topSizer = wxRect(windowSizer->GetPosition(), windowSizer->GetSize());
136         
137         if (isInMonth == true){
138         
139                 dc.SetPen(wxPen(wxColor(255,255,255), 0, wxPENSTYLE_TRANSPARENT));
140                 dc.SetBrush(wxBrush(wxColor(255,255,255)));
141                 dc.DrawRectangle(topSectionSizerItem->GetRect());
142                 dc.SetBrush(wxBrush(wxColor(225,225,225)));
143                 dc.DrawRectangle(mainSectionSizerItem->GetRect());
144                 eventListFrameDC.SetPen(wxPen(wxColor(255,255,255), 0, wxPENSTYLE_TRANSPARENT));
145                 eventListFrameDC.SetBrush(wxBrush(wxColor(225,225,225)));
146                 eventListFrameDC.DrawRectangle(eventListFrame->GetClientRect());
147                 
148         } else {
150                 dc.SetPen(wxPen(wxColor(185,185,185), 0, wxPENSTYLE_TRANSPARENT));
151                 dc.SetBrush(wxBrush(wxColor(185,185,185)));
152                 dc.DrawRectangle(topSectionSizerItem->GetRect());
153                 dc.SetBrush(wxBrush(wxColor(155,155,155)));
154                 dc.DrawRectangle(mainSectionSizerItem->GetRect());
155                 eventListFrameDC.SetPen(wxPen(wxColor(255,255,255), 0, wxPENSTYLE_TRANSPARENT));
156                 eventListFrameDC.SetBrush(wxBrush(wxColor(155,155,155)));
157                 eventListFrameDC.DrawRectangle(eventListFrame->GetClientRect());
158                 
159         }
160         
161         // Draw the border.
163         //dc.SetBrush(wxBrush(wxColor(0,0,0), wxBRUSHSTYLE_TRANSPARENT));
165         this->Layout();
166         
169 void XCCalendarDay::UpdateTopIcons(){
170         
171         bool alarmFound = false;
172         bool highPriorityFound = false;
173         
174         for (vector<XCCalendarDayEntry*>::iterator entryIter = calendarEntryList.begin();
175                 entryIter != calendarEntryList.end(); entryIter++){
177                 if ((*entryIter)->GetDisplayAlarm() == true){
178                         
179                         alarmFound = true;
180                         
181                 }
183                 if ((*entryIter)->GetDisplayHighPriority() == true){
184                         
185                         highPriorityFound = true;
186                         
187                 }
188                 
189                 if (alarmFound == true && highPriorityFound == true){
190                         
191                         break;
192                         
193                 }
194                 
195         }
196         
197         alertIcon->Show(alarmFound);
198         highPriorityIcon->Show(highPriorityFound);
199         
202 void XCCalendarDay::PaintFrameEvent(wxPaintEvent &paintEvent)
205         Repaint();
206         
209 void XCCalendarDay::ResizeFrameEvent(wxSizeEvent &sizeEvent)
212         // TODO: Check if window size is less than 120 pixels and if it is,
213         // switch to the small block mode.
214         
215         // Refresh the window.
216         
217         this->Refresh();
218         
221 void XCCalendarDay::DeselectOthersEvent(wxCommandEvent &deselectEvent)
223         
224         int selectedEntryID = deselectEvent.GetInt();
226         wxCommandEvent deselectEntryEvent(XCCALENDARDAYENTRY_DESELECT);
227         deselectEntryEvent.SetId(ID_ENTRYDESELECT);
228         
229         for (vector<XCCalendarDayEntry*>::iterator entryIter = calendarEntryList.begin();
230                 entryIter != calendarEntryList.end(); entryIter++){
231                         
232                 if ((*entryIter)->GetID() != selectedEntryID){
233                         
234                         wxPostEvent((*entryIter), deselectEntryEvent);
235                         
236                 }
237                         
238         }
239         
240         // Send event notification to deselect the other calendar entries.
241         
242         if (this->monthViewPointer != nullptr){
243                 
244                 wxCommandEvent deselectEvent(XCCALENDARMONTH_DESELECTOTHERENTRIES);
245                 deselectEvent.SetClientData(this);
246                 deselectEvent.SetId(ID_MONTHVIEWCLEARSELECTION);
247                 wxPostEvent(this->monthViewPointer, deselectEvent);
248                 
249         }
250         
253 void XCCalendarDay::DeselectAllEvent(wxCommandEvent &deselectEvent)
255         
256         int selectedEntryID = deselectEvent.GetInt();
257         
258         wxCommandEvent deselectEntryEvent(XCCALENDARDAYENTRY_DESELECT);
259         deselectEntryEvent.SetId(ID_ENTRYDESELECT);
260         
261         for (vector<XCCalendarDayEntry*>::iterator entryIter = calendarEntryList.begin();
262                 entryIter != calendarEntryList.end(); entryIter++){
264                 wxPostEvent((*entryIter), deselectEntryEvent);
265                         
266         }
267         
270 void XCCalendarDay::SetupControl(int setupDay, int setupMonth, int setupYear, bool setupIsInMonth, XCCalendarMonthView *monthViewPointer, CalendarDataStorage *dataStorage, vector<int> *hideAccounts, vector<int> *hideCalendars)
272         
273         this->dataStorage = dataStorage;
274         
275         // Set the day
276         
277         numberText->SetLabel(wxString::Format("%02i", setupDay));
278         calendarDay = setupDay;
279         
280         // Set the month
282         calendarMonth = setupMonth;
283         
284         // Set the year.
286         calendarYear = setupYear;
287         
288         // Setup the Is In Month value.
289         
290         isInMonth = setupIsInMonth;
291         
292         // Setup the month view pointer.
293         
294         this->monthViewPointer = monthViewPointer;
295         
296         // Setup the calendar items.
297         
298         CDSEntryList calendarItems = dataStorage->GetEventListByDate(setupYear, setupMonth, setupDay);
299         
300         for (int entrySeek = 0; entrySeek < calendarItems.entryList.size(); entrySeek++){
301                 
302                 // Get the information about the calendar entry.
303                 
304                 CDSGetCalendarEntryInfo newEntryInfo = dataStorage->GetEvent(calendarItems.entryList[entrySeek]);
305                 CDSGetCalendarInfo newEntryCalendarInfo = dataStorage->GetCalendar(newEntryInfo.calendarID);
306                 
307                 // Setup the calendar entry.
308                 
309                 XCCalendarDayEntry *newEntry = new XCCalendarDayEntry(eventListFrame, newEntryInfo.entryName, wxDefaultPosition, wxDefaultSize, calendarItems.entryList[entrySeek]);
310                 
311                 newEntry->SetColour(&newEntryCalendarInfo.calendarColour);
312                 newEntry->SetTime(newEntryInfo.entryStartHour, newEntryInfo.entryStartMinute, newEntryInfo.entryStartSecond);
313                 newEntry->SetEntryIDs(newEntryCalendarInfo.accountID, newEntryInfo.calendarID, newEntryInfo.calendarEntryID);           
314                 
315                 eventListFrameSizer->Add(newEntry, 0, wxEXPAND, 5);
316                 wxSizerItem *afterSpacer = eventListFrameSizer->Add(0, 5, 0, 0, 5);
317                 
318                 newEntry->SetAfterSpacer(afterSpacer);
319                 
320                 // Go through the list of calendar entries to hide by account.
321                 
322                 for (vector<int>::iterator hideAccountsItem = hideAccounts->begin();
323                         hideAccountsItem != hideAccounts->end(); hideAccountsItem++){
324                                 
325                         if (*hideAccountsItem == newEntryCalendarInfo.accountID){
326                                 newEntry->Show(false);
327                                 newEntry->GetAfterSpacer()->Show(false);
328                         }
329                                 
330                 }
331                 
332                 // Go through the list of calendar entries to hide by calendar.
333                 
334                 for (vector<int>::iterator hideCalendarsItem = hideCalendars->begin();
335                         hideCalendarsItem != hideCalendars->end(); hideCalendarsItem++){
336                                 
337                         if (*hideCalendarsItem == newEntryInfo.calendarID){
338                                 newEntry->Show(false);
339                                 newEntry->GetAfterSpacer()->Show(false);
340                         }
341                                 
342                 }
343                 
344                 calendarEntryList.push_back(newEntry);
345         }
346         
349 void XCCalendarDay::HideAccountEntries(wxCommandEvent &accountData){
350         
351         // Go through each of the controls and hide the controls (and spacing) that
352         // have the matched account IDs.
353         
354         int sizerPosition = 0;
355         
356         for (vector<XCCalendarDayEntry*>::iterator calendarEntryIter = calendarEntryList.begin();
357                 calendarEntryIter != calendarEntryList.end(); calendarEntryIter++){
358                 
359                 (*calendarEntryIter)->SetShowAccountStatus(false);
360                         
361                 if ((*calendarEntryIter)->GetAccountID() == accountData.GetInt()){
362                         
363                         wxSizerItem *calendarItem = eventListFrameSizer->GetItem((*calendarEntryIter));
364                         (*calendarEntryIter)->Show(false);
365                         
366                         // Get the spacing and hide it as well.
367                         
368                         wxSizerItem *afterSpacer = (*calendarEntryIter)->GetAfterSpacer();
369                         afterSpacer->Show(false);
370                         
371                 }
372                         
373         }
374         
375         this->Refresh();
376         Repaint();
377         
380 void XCCalendarDay::ShowAccountEntries(wxCommandEvent &accountData){
381         
382         // Go through each of the controls and hide the controls (and spacing) that
383         // have the matched account IDs.
384         
385         int sizerPosition = 0;
386         
387         for (vector<XCCalendarDayEntry*>::iterator calendarEntryIter = calendarEntryList.begin();
388                 calendarEntryIter != calendarEntryList.end(); calendarEntryIter++){
389                 
390                 (*calendarEntryIter)->SetShowAccountStatus(true);
391                         
392                 if ((*calendarEntryIter)->GetShowCalendarStatus() == false){
393                         continue;
394                 }
395                         
396                 if ((*calendarEntryIter)->GetAccountID() == accountData.GetInt()){
397                         
398                         wxSizerItem *calendarItem = eventListFrameSizer->GetItem((*calendarEntryIter));
399                         (*calendarEntryIter)->Show(true);
400                         
401                         // Get the spacing and hide it as well.
402                         
403                         wxSizerItem *afterSpacer = (*calendarEntryIter)->GetAfterSpacer();
404                         afterSpacer->Show(true);
405                         
406                 }
407                 
408         }
409         
410         this->Refresh();
411         Repaint();
412         
415 void XCCalendarDay::HideCalendarEntries(wxCommandEvent &calendarData){
416         
417         // Go through each of the controls and hide the controls (and spacing) that
418         // have the matched account IDs.
419         
420         int sizerPosition = 0;
421         
422         for (vector<XCCalendarDayEntry*>::iterator calendarEntryIter = calendarEntryList.begin();
423                 calendarEntryIter != calendarEntryList.end(); calendarEntryIter++){
424                         
425                 if ((*calendarEntryIter)->GetCalendarID() == calendarData.GetInt()){
426                         
427                         (*calendarEntryIter)->SetShowCalendarStatus(false);
428                         
429                         wxSizerItem *calendarItem = eventListFrameSizer->GetItem((*calendarEntryIter));
430                         (*calendarEntryIter)->Show(false);
431                         
432                         // Get the spacing and hide it as well.
433                         
434                         wxSizerItem *afterSpacer = (*calendarEntryIter)->GetAfterSpacer();
435                         afterSpacer->Show(false);
436                         
437                 }
438                         
439         }
440         
441         this->Refresh();
442         Repaint();
443         
446 void XCCalendarDay::ShowCalendarEntries(wxCommandEvent &calendarData){
447         
448         // Go through each of the controls and hide the controls (and spacing) that
449         // have the matched account IDs.
450         
451         int sizerPosition = 0;
452         
453         for (vector<XCCalendarDayEntry*>::iterator calendarEntryIter = calendarEntryList.begin();
454                 calendarEntryIter != calendarEntryList.end(); calendarEntryIter++){
455                         
456                 if ((*calendarEntryIter)->GetCalendarID() == calendarData.GetInt()){
457                         
458                         (*calendarEntryIter)->SetShowCalendarStatus(true);
459                         
460                         if ((*calendarEntryIter)->GetShowAccountStatus() == false){
461                                 
462                                 // Don't show the calendar entry because the account status
463                                 // is set to hidden. Continue to the next one.
464                                 
465                                 continue;
466                                 
467                         }
468                         
469                         wxSizerItem *calendarItem = eventListFrameSizer->GetItem((*calendarEntryIter));
470                         (*calendarEntryIter)->Show(true);
471                         
472                         // Get the spacing and hide it as well.
473                         
474                         wxSizerItem *afterSpacer = (*calendarEntryIter)->GetAfterSpacer();
475                         afterSpacer->Show(true);
476                         
477                 }
478                         
479         }
480         
481         this->Refresh();
482         Repaint();
483         
486 void XCCalendarDay::DeleteCalendarEntries(wxCommandEvent &calendarData){
487         
488         vector<vector<XCCalendarDayEntry*>::iterator> deleteEntriesList;
489         
490         for (vector<XCCalendarDayEntry*>::iterator calendarEntryIter = calendarEntryList.begin();
491                 calendarEntryIter != calendarEntryList.end(); calendarEntryIter++){
492         
493                 if ((*calendarEntryIter)->GetCalendarID() == calendarData.GetInt()){
494                         
495                         wxSizerItem *calendarItem = eventListFrameSizer->GetItem((*calendarEntryIter));
496                         (*calendarEntryIter)->Show(false);
497                         
498                         // Get the spacing and hide it as well.
499                         
500                         /*wxSizerItem *afterSpacer = (*calendarEntryIter)->GetAfterSpacer();
501                         afterSpacer->Show(false);
502                         afterSpacer->DetachSizer();
503                         
504                         delete afterSpacer;
505                         afterSpacer = nullptr;*/
506         
507                         delete (*calendarEntryIter);
508                         deleteEntriesList.push_back(calendarEntryIter);
509                         
510                 }               
511                         
512         }
513         
514         this->Refresh();
515         Repaint();
516         
517         for (auto deleteIter : deleteEntriesList){
518                 calendarEntryList.erase(deleteIter);
519         }
520         
523 void XCCalendarDay::DeleteCalendarEntry(wxCommandEvent &eventData){
524         
525         vector<vector<XCCalendarDayEntry*>::iterator> deleteEntriesList;
526         
527         for (vector<XCCalendarDayEntry*>::iterator calendarEntryIter = calendarEntryList.begin();
528                 calendarEntryIter != calendarEntryList.end(); calendarEntryIter++){
529         
530                 if ((*calendarEntryIter)->GetEventID() == eventData.GetInt()){
531                         
532                         wxSizerItem *calendarItem = eventListFrameSizer->GetItem((*calendarEntryIter));
533                         (*calendarEntryIter)->Show(false);
534                         
535                         // Get the spacing and hide it as well.
536                         
537                         /*wxSizerItem *afterSpacer = (*calendarEntryIter)->GetAfterSpacer();
538                         afterSpacer->Show(false);
539                         afterSpacer->DetachSizer();
540                         
541                         delete afterSpacer;
542                         afterSpacer = nullptr;*/
543                         
544                         delete (*calendarEntryIter);
545                         deleteEntriesList.push_back(calendarEntryIter);                 
546                         
547                 }               
548                         
549         }
550         
551         for (auto deleteIter : deleteEntriesList){
552                 calendarEntryList.erase(deleteIter);
553         }
554         
555         this->Refresh();
556         Repaint();
557         
560 void XCCalendarDay::AddCalendarEntry(wxCommandEvent &eventData){
561         
562         EventProperties *eventInfo = (EventProperties*)eventData.GetClientData();
563         
564         XCCalendarDayEntry *newEntry = new XCCalendarDayEntry(eventListFrame, eventInfo->eventName, wxDefaultPosition, wxDefaultSize, eventInfo->eventID);
565                 
566         CDSGetCalendarInfo calendarInfo = dataStorage->GetCalendar(eventInfo->calendarID);
567         
568         newEntry->SetColour(&calendarInfo.calendarColour);
569         newEntry->SetTime(eventInfo->eventHour, eventInfo->eventMinute, eventInfo->eventSecond);
570         newEntry->SetEntryIDs(calendarInfo.accountID, eventInfo->calendarID, eventInfo->eventID);               
571                 
572         eventListFrameSizer->Add(newEntry, 0, wxEXPAND, 5);
573         wxSizerItem *afterSpacer = eventListFrameSizer->Add(0, 5, 0, 0, 5);
574                 
575         newEntry->SetAfterSpacer(afterSpacer);
576         
577         // Go through the list of calendar entries to hide by account.
578                 
579         for (vector<int>::iterator hideAccountsItem = eventInfo->hideAccountsList.begin();
580                 hideAccountsItem != eventInfo->hideAccountsList.end(); hideAccountsItem++){
581                                 
582                 if (*hideAccountsItem = calendarInfo.accountID){
583                         newEntry->Show(false);
584                         newEntry->GetAfterSpacer()->Show(false);
585                 }
586                                 
587         }
588                 
589         // Go through the list of calendar entries to hide by calendar.
590                 
591         for (vector<int>::iterator hideCalendarsItem = eventInfo->hideCalendarsList.begin();
592                 hideCalendarsItem != eventInfo->hideCalendarsList.end(); hideCalendarsItem++){
593                                 
594                 if (*hideCalendarsItem == eventInfo->calendarID){
595                         newEntry->Show(false);
596                         newEntry->GetAfterSpacer()->Show(false);
597                 }                       
598                                 
599         }
600                 
601         calendarEntryList.push_back(newEntry);
602         
603         this->Refresh();
604         Repaint();
605         
608 void XCCalendarDay::UpdateCalendarEntry(wxCommandEvent &eventData){
609         
610         // Go thorugh each of the entries in the day and
611         // then update it.
612         
613         EventProperties *eventInfo = (EventProperties*)eventData.GetClientData();
614         
615         for (vector<XCCalendarDayEntry*>::iterator calendarEntryIter = calendarEntryList.begin();
616                 calendarEntryIter != calendarEntryList.end(); calendarEntryIter++){
617                 
618                 if ((*calendarEntryIter)->GetEventID() == eventInfo->eventID){
619                         
620                         (*calendarEntryIter)->SetEventName(eventInfo->eventName);
621                         (*calendarEntryIter)->SetTime(eventInfo->eventHour, eventInfo->eventMinute, eventInfo->eventSecond);
622                         
623                         
624                 }
625                         
626         }
627         
628         delete eventInfo;
629         eventInfo = nullptr;
630         
633 void XCCalendarDay::UpdateCalendarColour(wxCommandEvent &colourData){
634         
635         // Go thorugh each of the entries in the day and
636         // then update it.
637         
638         ColourUpdateProperties *colourInfo = (ColourUpdateProperties*)colourData.GetClientData();
639         
640         for (vector<XCCalendarDayEntry*>::iterator calendarEntryIter = calendarEntryList.begin();
641                 calendarEntryIter != calendarEntryList.end(); calendarEntryIter++){
642                 
643                 if ((*calendarEntryIter)->GetCalendarID() == colourInfo->calendarID){
644                         
645                         (*calendarEntryIter)->SetColour(&colourInfo->newColour);
646                         
647                 }
648                         
649         }
650         
653 int XCCalendarDay::GetCalendarDay(){
654         
655         return calendarDay;
656         
659 int XCCalendarDay::GetCalendarMonth(){
660         
661         return calendarMonth;
662         
665 int XCCalendarDay::GetCalendarYear(){
666         
667         return calendarYear;
668         
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