Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
camelCase: Converted remaining code that was missed
[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         }
112         
113         calendarEntryList.clear();
114         
115         this->Refresh();
116         
119 void XCCalendarDay::Repaint(){
120         
121         wxPaintDC dc(this);
122         wxPaintDC eventListFrameDC(eventListFrame);
123         
124         // Get the wxSizerItem for the top date and the entries part.
126         wxSizerItem *topSectionSizerItem = windowSizer->GetItem((size_t)0);
127         wxSizerItem *mainSectionSizerItem = windowSizer->GetItem((size_t)1);
128         wxRect topSizer = wxRect(windowSizer->GetPosition(), windowSizer->GetSize());
129         
130         if (isInMonth == true){
131         
132                 dc.SetPen(wxPen(wxColor(255,255,255), 0, wxPENSTYLE_TRANSPARENT));
133                 dc.SetBrush(wxBrush(wxColor(255,255,255)));
134                 dc.DrawRectangle(topSectionSizerItem->GetRect());
135                 dc.SetBrush(wxBrush(wxColor(225,225,225)));
136                 dc.DrawRectangle(mainSectionSizerItem->GetRect());
137                 eventListFrameDC.SetPen(wxPen(wxColor(255,255,255), 0, wxPENSTYLE_TRANSPARENT));
138                 eventListFrameDC.SetBrush(wxBrush(wxColor(225,225,225)));
139                 eventListFrameDC.DrawRectangle(eventListFrame->GetClientRect());
140                 
141         } else {
143                 dc.SetPen(wxPen(wxColor(185,185,185), 0, wxPENSTYLE_TRANSPARENT));
144                 dc.SetBrush(wxBrush(wxColor(185,185,185)));
145                 dc.DrawRectangle(topSectionSizerItem->GetRect());
146                 dc.SetBrush(wxBrush(wxColor(155,155,155)));
147                 dc.DrawRectangle(mainSectionSizerItem->GetRect());
148                 eventListFrameDC.SetPen(wxPen(wxColor(255,255,255), 0, wxPENSTYLE_TRANSPARENT));
149                 eventListFrameDC.SetBrush(wxBrush(wxColor(155,155,155)));
150                 eventListFrameDC.DrawRectangle(eventListFrame->GetClientRect());
151                 
152         }
153         
154         // Draw the border.
156         //dc.SetBrush(wxBrush(wxColor(0,0,0), wxBRUSHSTYLE_TRANSPARENT));
158         this->Layout();
159         
162 void XCCalendarDay::UpdateTopIcons(){
163         
164         bool alarmFound = false;
165         bool highPriorityFound = false;
166         
167         for (vector<XCCalendarDayEntry*>::iterator entryIter = calendarEntryList.begin();
168                 entryIter != calendarEntryList.end(); entryIter++){
170                 if ((*entryIter)->GetDisplayAlarm() == true){
171                         
172                         alarmFound = true;
173                         
174                 }
176                 if ((*entryIter)->GetDisplayHighPriority() == true){
177                         
178                         highPriorityFound = true;
179                         
180                 }
181                 
182                 if (alarmFound == true && highPriorityFound == true){
183                         
184                         break;
185                         
186                 }
187                 
188         }
189         
190         alertIcon->Show(alarmFound);
191         highPriorityIcon->Show(highPriorityFound);
192         
195 void XCCalendarDay::PaintFrameEvent(wxPaintEvent &paintEvent)
198         Repaint();
199         
202 void XCCalendarDay::ResizeFrameEvent(wxSizeEvent &sizeEvent)
205         // TODO: Check if window size is less than 120 pixels and if it is,
206         // switch to the small block mode.
207         
208         // Refresh the window.
209         
210         this->Refresh();
211         
214 void XCCalendarDay::DeselectOthersEvent(wxCommandEvent &deselectEvent)
216         
217         int selectedEntryID = deselectEvent.GetInt();
219         wxCommandEvent deselectEntryEvent(XCCALENDARDAYENTRY_DESELECT);
220         deselectEntryEvent.SetId(ID_ENTRYDESELECT);
221         
222         for (vector<XCCalendarDayEntry*>::iterator entryIter = calendarEntryList.begin();
223                 entryIter != calendarEntryList.end(); entryIter++){
224                         
225                 if ((*entryIter)->GetID() != selectedEntryID){
226                         
227                         wxPostEvent((*entryIter), deselectEntryEvent);
228                         
229                 }
230                         
231         }
232         
233         // Send event notification to deselect the other calendar entries.
234         
235         if (this->monthViewPointer != nullptr){
236                 
237                 wxCommandEvent deselectEvent(XCCALENDARMONTH_DESELECTOTHERENTRIES);
238                 deselectEvent.SetClientData(this);
239                 deselectEvent.SetId(ID_MONTHVIEWCLEARSELECTION);
240                 wxPostEvent(this->monthViewPointer, deselectEvent);
241                 
242         }
243         
246 void XCCalendarDay::DeselectAllEvent(wxCommandEvent &deselectEvent)
248         
249         int selectedEntryID = deselectEvent.GetInt();
250         
251         wxCommandEvent deselectEntryEvent(XCCALENDARDAYENTRY_DESELECT);
252         deselectEntryEvent.SetId(ID_ENTRYDESELECT);
253         
254         for (vector<XCCalendarDayEntry*>::iterator entryIter = calendarEntryList.begin();
255                 entryIter != calendarEntryList.end(); entryIter++){
257                 wxPostEvent((*entryIter), deselectEntryEvent);
258                         
259         }
260         
263 void XCCalendarDay::SetupControl(int setupDay, int setupMonth, int setupYear, bool setupIsInMonth, XCCalendarMonthView *monthViewPointer, CalendarDataStorage *dataStorage, vector<int> *hideAccounts, vector<int> *hideCalendars)
265         
266         this->dataStorage = dataStorage;
267         
268         // Set the day
269         
270         numberText->SetLabel(wxString::Format("%02i", setupDay));
271         calendarDay = setupDay;
272         
273         // Set the month
275         calendarMonth = setupMonth;
276         
277         // Set the year.
279         calendarYear = setupYear;
280         
281         // Setup the Is In Month value.
282         
283         isInMonth = setupIsInMonth;
284         
285         // Setup the month view pointer.
286         
287         this->monthViewPointer = monthViewPointer;
288         
289         // Setup the calendar items.
290         
291         CDSEntryList calendarItems = dataStorage->GetEventListByDate(setupYear, setupMonth, setupDay);
292         
293         for (int entrySeek = 0; entrySeek < calendarItems.entryList.size(); entrySeek++){
294                 
295                 // Get the information about the calendar entry.
296                 
297                 CDSGetCalendarEntryInfo newEntryInfo = dataStorage->GetEvent(calendarItems.entryList[entrySeek]);
298                 CDSGetCalendarInfo newEntryCalendarInfo = dataStorage->GetCalendar(newEntryInfo.calendarID);
299                 
300                 // Setup the calendar entry.
301                 
302                 XCCalendarDayEntry *newEntry = new XCCalendarDayEntry(eventListFrame, newEntryInfo.entryName, wxDefaultPosition, wxDefaultSize, calendarItems.entryList[entrySeek]);
303                 
304                 newEntry->SetColour(&newEntryCalendarInfo.calendarColour);
305                 newEntry->SetTime(newEntryInfo.entryStartHour, newEntryInfo.entryStartMinute, newEntryInfo.entryStartSecond);
306                 newEntry->SetEntryIDs(newEntryCalendarInfo.accountID, newEntryInfo.calendarID, newEntryInfo.calendarEntryID);           
307                 
308                 eventListFrameSizer->Add(newEntry, 0, wxEXPAND, 5);
309                 wxSizerItem *afterSpacer = eventListFrameSizer->Add(0, 5, 0, 0, 5);
310                 
311                 newEntry->SetAfterSpacer(afterSpacer);
312                 
313                 // Go through the list of calendar entries to hide by account.
314                 
315                 for (vector<int>::iterator hideAccountsItem = hideAccounts->begin();
316                         hideAccountsItem != hideAccounts->end(); hideAccountsItem++){
317                                 
318                         if (*hideAccountsItem == newEntryCalendarInfo.accountID){
319                                 newEntry->Show(false);
320                                 newEntry->GetAfterSpacer()->Show(false);
321                         }
322                                 
323                 }
324                 
325                 // Go through the list of calendar entries to hide by calendar.
326                 
327                 for (vector<int>::iterator hideCalendarsItem = hideCalendars->begin();
328                         hideCalendarsItem != hideCalendars->end(); hideCalendarsItem++){
329                                 
330                         if (*hideCalendarsItem == newEntryInfo.calendarID){
331                                 newEntry->Show(false);
332                                 newEntry->GetAfterSpacer()->Show(false);
333                         }
334                                 
335                 }
336                 
337                 calendarEntryList.push_back(newEntry);
338         }
339         
342 void XCCalendarDay::HideAccountEntries(wxCommandEvent &accountData){
343         
344         // Go through each of the controls and hide the controls (and spacing) that
345         // have the matched account IDs.
346         
347         int sizerPosition = 0;
348         
349         for (vector<XCCalendarDayEntry*>::iterator calendarEntryIter = calendarEntryList.begin();
350                 calendarEntryIter != calendarEntryList.end(); calendarEntryIter++){
351                 
352                 (*calendarEntryIter)->SetShowAccountStatus(false);
353                         
354                 if ((*calendarEntryIter)->GetAccountID() == accountData.GetInt()){
355                         
356                         wxSizerItem *calendarItem = eventListFrameSizer->GetItem((*calendarEntryIter));
357                         (*calendarEntryIter)->Show(false);
358                         
359                         // Get the spacing and hide it as well.
360                         
361                         wxSizerItem *afterSpacer = (*calendarEntryIter)->GetAfterSpacer();
362                         afterSpacer->Show(false);
363                         
364                 }
365                         
366         }
367         
368         this->Refresh();
369         Repaint();
370         
373 void XCCalendarDay::ShowAccountEntries(wxCommandEvent &accountData){
374         
375         // Go through each of the controls and hide the controls (and spacing) that
376         // have the matched account IDs.
377         
378         int sizerPosition = 0;
379         
380         for (vector<XCCalendarDayEntry*>::iterator calendarEntryIter = calendarEntryList.begin();
381                 calendarEntryIter != calendarEntryList.end(); calendarEntryIter++){
382                 
383                 (*calendarEntryIter)->SetShowAccountStatus(true);
384                         
385                 if ((*calendarEntryIter)->GetShowCalendarStatus() == false){
386                         continue;
387                 }
388                         
389                 if ((*calendarEntryIter)->GetAccountID() == accountData.GetInt()){
390                         
391                         wxSizerItem *calendarItem = eventListFrameSizer->GetItem((*calendarEntryIter));
392                         (*calendarEntryIter)->Show(true);
393                         
394                         // Get the spacing and hide it as well.
395                         
396                         wxSizerItem *afterSpacer = (*calendarEntryIter)->GetAfterSpacer();
397                         afterSpacer->Show(true);
398                         
399                 }
400                 
401         }
402         
403         this->Refresh();
404         Repaint();
405         
408 void XCCalendarDay::HideCalendarEntries(wxCommandEvent &calendarData){
409         
410         // Go through each of the controls and hide the controls (and spacing) that
411         // have the matched account IDs.
412         
413         int sizerPosition = 0;
414         
415         for (vector<XCCalendarDayEntry*>::iterator calendarEntryIter = calendarEntryList.begin();
416                 calendarEntryIter != calendarEntryList.end(); calendarEntryIter++){
417                         
418                 if ((*calendarEntryIter)->GetCalendarID() == calendarData.GetInt()){
419                         
420                         (*calendarEntryIter)->SetShowCalendarStatus(false);
421                         
422                         wxSizerItem *calendarItem = eventListFrameSizer->GetItem((*calendarEntryIter));
423                         (*calendarEntryIter)->Show(false);
424                         
425                         // Get the spacing and hide it as well.
426                         
427                         wxSizerItem *afterSpacer = (*calendarEntryIter)->GetAfterSpacer();
428                         afterSpacer->Show(false);
429                         
430                 }
431                         
432         }
433         
434         this->Refresh();
435         Repaint();
436         
439 void XCCalendarDay::ShowCalendarEntries(wxCommandEvent &calendarData){
440         
441         // Go through each of the controls and hide the controls (and spacing) that
442         // have the matched account IDs.
443         
444         int sizerPosition = 0;
445         
446         for (vector<XCCalendarDayEntry*>::iterator calendarEntryIter = calendarEntryList.begin();
447                 calendarEntryIter != calendarEntryList.end(); calendarEntryIter++){
448                         
449                 if ((*calendarEntryIter)->GetCalendarID() == calendarData.GetInt()){
450                         
451                         (*calendarEntryIter)->SetShowCalendarStatus(true);
452                         
453                         if ((*calendarEntryIter)->GetShowAccountStatus() == false){
454                                 
455                                 // Don't show the calendar entry because the account status
456                                 // is set to hidden. Continue to the next one.
457                                 
458                                 continue;
459                                 
460                         }
461                         
462                         wxSizerItem *calendarItem = eventListFrameSizer->GetItem((*calendarEntryIter));
463                         (*calendarEntryIter)->Show(true);
464                         
465                         // Get the spacing and hide it as well.
466                         
467                         wxSizerItem *afterSpacer = (*calendarEntryIter)->GetAfterSpacer();
468                         afterSpacer->Show(true);
469                         
470                 }
471                         
472         }
473         
474         this->Refresh();
475         Repaint();
476         
479 void XCCalendarDay::DeleteCalendarEntries(wxCommandEvent &calendarData){
480         
481         vector<vector<XCCalendarDayEntry*>::iterator> deleteEntriesList;
482         
483         for (vector<XCCalendarDayEntry*>::iterator calendarEntryIter = calendarEntryList.begin();
484                 calendarEntryIter != calendarEntryList.end(); calendarEntryIter++){
485         
486                 if ((*calendarEntryIter)->GetCalendarID() == calendarData.GetInt()){
487                         
488                         wxSizerItem *calendarItem = eventListFrameSizer->GetItem((*calendarEntryIter));
489                         (*calendarEntryIter)->Show(false);
490                         
491                         // Get the spacing and hide it as well.
492                         
493                         wxSizerItem *afterSpacer = (*calendarEntryIter)->GetAfterSpacer();
494                         afterSpacer->Show(false);
495                         afterSpacer->DetachSizer();
496                         
497                         delete afterSpacer;
498                         afterSpacer = nullptr;
499         
500                         delete (*calendarEntryIter);
501                         deleteEntriesList.push_back(calendarEntryIter);
502                         
503                 }               
504                         
505         }
506         
507         this->Refresh();
508         Repaint();
509         
510         for (auto deleteIter : deleteEntriesList){
511                 calendarEntryList.erase(deleteIter);
512         }
513         
516 void XCCalendarDay::DeleteCalendarEntry(wxCommandEvent &eventData){
517         
518         vector<vector<XCCalendarDayEntry*>::iterator> deleteEntriesList;
519         
520         for (vector<XCCalendarDayEntry*>::iterator calendarEntryIter = calendarEntryList.begin();
521                 calendarEntryIter != calendarEntryList.end(); calendarEntryIter++){
522         
523                 if ((*calendarEntryIter)->GetEventID() == eventData.GetInt()){
524                         
525                         wxSizerItem *calendarItem = eventListFrameSizer->GetItem((*calendarEntryIter));
526                         (*calendarEntryIter)->Show(false);
527                         
528                         // Get the spacing and hide it as well.
529                         
530                         wxSizerItem *afterSpacer = (*calendarEntryIter)->GetAfterSpacer();
531                         afterSpacer->Show(false);
532                         afterSpacer->DetachSizer();
533                         
534                         delete afterSpacer;
535                         afterSpacer = nullptr;
536                         
537                         delete (*calendarEntryIter);
538                         deleteEntriesList.push_back(calendarEntryIter);                 
539                         
540                 }               
541                         
542         }
543         
544         for (auto deleteIter : deleteEntriesList){
545                 calendarEntryList.erase(deleteIter);
546         }
547         
548         this->Refresh();
549         Repaint();
550         
553 void XCCalendarDay::AddCalendarEntry(wxCommandEvent &eventData){
554         
555         EventProperties *eventInfo = (EventProperties*)eventData.GetClientData();
556         
557         XCCalendarDayEntry *newEntry = new XCCalendarDayEntry(eventListFrame, eventInfo->eventName, wxDefaultPosition, wxDefaultSize, eventInfo->eventID);
558                 
559         CDSGetCalendarInfo calendarInfo = dataStorage->GetCalendar(eventInfo->calendarID);
560         
561         newEntry->SetColour(&calendarInfo.calendarColour);
562         newEntry->SetTime(eventInfo->eventHour, eventInfo->eventMinute, eventInfo->eventSecond);
563         newEntry->SetEntryIDs(calendarInfo.accountID, eventInfo->calendarID, eventInfo->eventID);               
564                 
565         eventListFrameSizer->Add(newEntry, 0, wxEXPAND, 5);
566         wxSizerItem *afterSpacer = eventListFrameSizer->Add(0, 5, 0, 0, 5);
567                 
568         newEntry->SetAfterSpacer(afterSpacer);
569         
570         // Go through the list of calendar entries to hide by account.
571                 
572         for (vector<int>::iterator hideAccountsItem = eventInfo->hideAccountsList.begin();
573                 hideAccountsItem != eventInfo->hideAccountsList.end(); hideAccountsItem++){
574                                 
575                 if (*hideAccountsItem = calendarInfo.accountID){
576                         newEntry->Show(false);
577                         newEntry->GetAfterSpacer()->Show(false);
578                 }
579                                 
580         }
581                 
582         // Go through the list of calendar entries to hide by calendar.
583                 
584         for (vector<int>::iterator hideCalendarsItem = eventInfo->hideCalendarsList.begin();
585                 hideCalendarsItem != eventInfo->hideCalendarsList.end(); hideCalendarsItem++){
586                                 
587                 if (*hideCalendarsItem == eventInfo->calendarID){
588                         newEntry->Show(false);
589                         newEntry->GetAfterSpacer()->Show(false);
590                 }                       
591                                 
592         }
593                 
594         calendarEntryList.push_back(newEntry);
595         
596         this->Refresh();
597         Repaint();
598         
601 void XCCalendarDay::UpdateCalendarEntry(wxCommandEvent &eventData){
602         
603         // Go thorugh each of the entries in the day and
604         // then update it.
605         
606         EventProperties *eventInfo = (EventProperties*)eventData.GetClientData();
607         
608         for (vector<XCCalendarDayEntry*>::iterator calendarEntryIter = calendarEntryList.begin();
609                 calendarEntryIter != calendarEntryList.end(); calendarEntryIter++){
610                 
611                 if ((*calendarEntryIter)->GetEventID() == eventInfo->eventID){
612                         
613                         (*calendarEntryIter)->SetEventName(eventInfo->eventName);
614                         (*calendarEntryIter)->SetTime(eventInfo->eventHour, eventInfo->eventMinute, eventInfo->eventSecond);
615                         
616                         
617                 }
618                         
619         }
620         
621         delete eventInfo;
622         eventInfo = nullptr;
623         
626 void XCCalendarDay::UpdateCalendarColour(wxCommandEvent &colourData){
627         
628         // Go thorugh each of the entries in the day and
629         // then update it.
630         
631         ColourUpdateProperties *colourInfo = (ColourUpdateProperties*)colourData.GetClientData();
632         
633         for (vector<XCCalendarDayEntry*>::iterator calendarEntryIter = calendarEntryList.begin();
634                 calendarEntryIter != calendarEntryList.end(); calendarEntryIter++){
635                 
636                 if ((*calendarEntryIter)->GetCalendarID() == colourInfo->calendarID){
637                         
638                         (*calendarEntryIter)->SetColour(&colourInfo->newColour);
639                         
640                 }
641                         
642         }
643         
646 int XCCalendarDay::GetCalendarDay(){
647         
648         return calendarDay;
649         
652 int XCCalendarDay::GetCalendarMonth(){
653         
654         return calendarMonth;
655         
658 int XCCalendarDay::GetCalendarYear(){
659         
660         return calendarYear;
661         
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