Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
random: Implemented Win32 version
[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 wxDEFINE_EVENT(XCCALENDARDAY_DESELECTOTHERENTRIES, wxCommandEvent);
24 wxDEFINE_EVENT(XCCALENDARDAY_DESELECTALLENTRIES, wxCommandEvent);
25 wxDEFINE_EVENT(XCCALENDARDAY_HIDEACCOUNTENTRIES, wxCommandEvent);
26 wxDEFINE_EVENT(XCCALENDARDAY_SHOWACCOUNTENTRIES, wxCommandEvent);
27 wxDEFINE_EVENT(XCCALENDARDAY_HIDECALENDARENTRIES, wxCommandEvent);
28 wxDEFINE_EVENT(XCCALENDARDAY_SHOWCALENDARENTRIES, wxCommandEvent);
29 wxDEFINE_EVENT(XCCALENDARDAY_DELETECALENDARENTRIES, wxCommandEvent);
30 wxDEFINE_EVENT(XCCALENDARDAY_DELETEENTRY, wxCommandEvent);
31 wxDEFINE_EVENT(XCCALENDARDAY_ADDENTRY, wxCommandEvent);
32 wxDEFINE_EVENT(XCCALENDARDAY_UPDATEENTRY, wxCommandEvent);
33 wxDEFINE_EVENT(XCCALENDARDAY_UPDATECALENDARCOLOUR, wxCommandEvent);
35 BEGIN_EVENT_TABLE(XCCalendarDay, wxPanel)
36 END_EVENT_TABLE()
38 XCCalendarDay::XCCalendarDay(wxWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size)
39         : wxPanel(parent, wxID_ANY, pos, size, wxTAB_TRAVERSAL, title){
40         this->SetMinSize( wxSize( 100,100 ) );
41         
42         // Setup the top panel.
43                 
44         topPanel = new wxPanel(this, wxID_ANY, wxPoint(0,0), wxSize(50, 40), wxTAB_TRAVERSAL);
45         mainPanel = new wxPanel(this, wxID_ANY, wxPoint(0,0), wxSize(200, 200), wxTAB_TRAVERSAL);
46                 
47         // Setip the icons.
48                 
49         highPriorityIcon = new wxStaticBitmap(topPanel, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize(32,32), 0);
50         alertIcon = new wxStaticBitmap(topPanel, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize(32,32), 0);
51                 
52         wxMemoryInputStream alerticon(icons_alert32_png, sizeof(icons_alert32_png));
53         wxMemoryInputStream priorityicon(icons_priority32_png, sizeof(icons_priority32_png));
54         
55         wxImage icons_alert_png(alerticon, wxBITMAP_TYPE_PNG);
56         wxBitmap imgAlertIcon(icons_alert_png, -1);
58         wxImage icons_priority_png(priorityicon, wxBITMAP_TYPE_PNG);
59         wxBitmap imgPriorityIcon(icons_priority_png, -1);
60         
61         alertIcon->SetBitmap(imgAlertIcon);
62         highPriorityIcon->SetBitmap(imgPriorityIcon);
63         
64         numberText = new wxStaticText(topPanel, wxID_ANY, wxT("09"), wxDefaultPosition, wxDefaultSize, 0);
65         numberText->SetFont(wxFont(24, 70, 90, 92, false, wxEmptyString));
66         
67         topSectionSizer->Add(highPriorityIcon, 0, wxALL|wxALIGN_CENTER_VERTICAL, 0);
68         topSectionSizer->Add(alertIcon, 0, wxALL|wxALIGN_CENTER_VERTICAL, 0);
69         topSectionSizer->Add(0, 0, 1, wxEXPAND, 5);
70         topSectionSizer->Add(numberText, 0, wxALL|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5);
72         // Setup the scrollable section.
73         
74         eventListFrame = new wxScrolledWindow(mainPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
75         
76         Colour eventColour;
77         eventColour.red = 40; eventColour.green = 80; eventColour.blue = 80;
78         
79         eventListFrame->SetSizer(eventListFrameSizer);
81         eventListFrame->SetScrollRate(0,1);
82         eventListFrameSizer->Fit(eventListFrame);
83         eventListFrameSizer->Layout();
85         // Setup the scroll window.
86         
87         mainSectionSizer->Add(eventListFrame, 1, wxGROW | wxALL, 5);
88         
89         topPanel->SetSizer(topSectionSizer);
90         mainPanel->SetSizer(mainSectionSizer);
91         
92         windowSizer->Add(topPanel, 1, wxEXPAND, 0);
93         windowSizer->Add(mainPanel, 1, wxEXPAND, 0);
95         this->SetSizer(windowSizer);
96         this->SetSize(size);
97         this->Layout();
98         this->Centre(wxBOTH);
99         
100         UpdateTopIcons();
101         
102         // Bind events to the control.
103         
104         Bind(XCCALENDARDAY_DESELECTOTHERENTRIES, &XCCalendarDay::DeselectOthersEvent, this, ID_DESELECTOTHERENTRIES);
105         Bind(XCCALENDARDAY_DESELECTALLENTRIES, &XCCalendarDay::DeselectAllEvent, this, ID_DESELECTALLITEMS);
106         Bind(XCCALENDARDAY_HIDEACCOUNTENTRIES, &XCCalendarDay::HideAccountEntries, this, ID_HIDEENTRIES);
107         Bind(XCCALENDARDAY_SHOWACCOUNTENTRIES, &XCCalendarDay::ShowAccountEntries, this, ID_SHOWENTRIES);
108         Bind(XCCALENDARDAY_HIDECALENDARENTRIES, &XCCalendarDay::HideCalendarEntries, this, ID_HIDECALENDARENTRIES);
109         Bind(XCCALENDARDAY_SHOWCALENDARENTRIES, &XCCalendarDay::ShowCalendarEntries, this, ID_SHOWCALENDARENTRIES);
110         Bind(XCCALENDARDAY_DELETECALENDARENTRIES, &XCCalendarDay::DeleteCalendarEntries, this, ID_DELETECALENDARENTRIES);
111         Bind(XCCALENDARDAY_DELETEENTRY, &XCCalendarDay::DeleteCalendarEntry, this, ID_DELETEENTRY);
112         Bind(XCCALENDARDAY_ADDENTRY, &XCCalendarDay::AddCalendarEntry, this, ID_ADDENTRY);
113         Bind(XCCALENDARDAY_UPDATEENTRY, &XCCalendarDay::UpdateCalendarEntry, this, ID_UPDATEENTRY);
114         Bind(XCCALENDARDAY_UPDATECALENDARCOLOUR, &XCCalendarDay::UpdateCalendarColour, this, ID_UPDATECOLOUR);
117 XCCalendarDay::~XCCalendarDay(){
118         
119         // Destory the controls from the widget.
120         
121         for (vector<XCCalendarDayEntry*>::iterator calendarEntryIter = calendarEntryList.begin();
122                 calendarEntryIter != calendarEntryList.end(); calendarEntryIter++){
123                         
124                 delete((*calendarEntryIter));
125                         
126         }
128         delete alertIcon;
129         alertIcon = nullptr;
130         
131         delete highPriorityIcon;
132         highPriorityIcon = nullptr;
133         
134         delete eventListFrame;
135         eventListFrame = nullptr;
136         
137         calendarEntryList.clear();
138         
141 void XCCalendarDay::UpdateTopIcons(){
142         
143         bool alarmFound = false;
144         bool highPriorityFound = false;
145         
146         for (vector<XCCalendarDayEntry*>::iterator entryIter = calendarEntryList.begin();
147                 entryIter != calendarEntryList.end(); entryIter++){
149                 if ((*entryIter)->GetDisplayAlarm() == true){
150                         
151                         alarmFound = true;
152                         
153                 }
155                 if ((*entryIter)->GetDisplayHighPriority() == true){
156                         
157                         highPriorityFound = true;
158                         
159                 }
160                 
161                 if (alarmFound == true && highPriorityFound == true){
162                         
163                         break;
164                         
165                 }
166                 
167         }
168         
169         alertIcon->Show(alarmFound);
170         highPriorityIcon->Show(highPriorityFound);
171         
174 void XCCalendarDay::ResizeFrameEvent(wxSizeEvent &sizeEvent)
177         // TODO: Check if window size is less than 120 pixels and if it is,
178         // switch to the small block mode.
179         
180         // Refresh the window.
181         
182         this->Refresh();
183         topPanel->Refresh();
184         mainPanel->Refresh();
185         topSectionSizer->Layout();
186         mainSectionSizer->Layout();
187         windowSizer->Layout();
188         
191 void XCCalendarDay::DeselectOthersEvent(wxCommandEvent &deselectEvent)
193         
194         int selectedEntryID = deselectEvent.GetInt();
196         wxCommandEvent deselectEntryEvent(XCCALENDARDAYENTRY_DESELECT);
197         deselectEntryEvent.SetId(ID_ENTRYDESELECT);
198         
199         for (vector<XCCalendarDayEntry*>::iterator entryIter = calendarEntryList.begin();
200                 entryIter != calendarEntryList.end(); entryIter++){
201                         
202                 if ((*entryIter)->GetID() != selectedEntryID){
203                         
204                         wxPostEvent((*entryIter), deselectEntryEvent);
205                         
206                 }
207                 
208         }
209         
210         // Send event notification to deselect the other calendar entries.
211         
212         if (this->monthViewPointer != nullptr){
213                 
214                 wxCommandEvent deselectMonthEvent(XCCALENDARMONTH_DESELECTOTHERENTRIES);
215                 deselectMonthEvent.SetClientData(this);
216                 deselectMonthEvent.SetId(ID_MONTHVIEWCLEARSELECTION);
217                 wxPostEvent(this->monthViewPointer, deselectMonthEvent);
218                 
219         }
220         
223 void XCCalendarDay::DeselectAllEvent(wxCommandEvent &deselectEvent)
225         
226         int selectedEntryID = deselectEvent.GetInt();
227         
228         wxCommandEvent deselectEntryEvent(XCCALENDARDAYENTRY_DESELECT);
229         deselectEntryEvent.SetId(ID_ENTRYDESELECT);
230         
231         for (vector<XCCalendarDayEntry*>::iterator entryIter = calendarEntryList.begin();
232                 entryIter != calendarEntryList.end(); entryIter++){
234                 wxPostEvent((*entryIter), deselectEntryEvent);
235                         
236         }
237         
240 void XCCalendarDay::SetupControl(int setupDay, int setupMonth, int setupYear, bool setupIsInMonth, XCCalendarMonthView *monthViewPointer, CalendarDataStorage *dataStorage, vector<int> *hideAccounts, vector<int> *hideCalendars)
242         
243         this->dataStorage = dataStorage;
244         
245         // Set the day
246         
247         numberText->SetLabel(wxString::Format("%02i", setupDay));
248         calendarDay = setupDay;
249         
250         // Set the month
252         calendarMonth = setupMonth;
253         
254         // Set the year.
256         calendarYear = setupYear;
257         
258         // Setup the Is In Month value.
259         
260         isInMonth = setupIsInMonth;
261         if (isInMonth)
262         {
263                 topPanel->SetBackgroundColour(wxColor(255,255,255));
264                 mainPanel->SetBackgroundColour(wxColor(225,225,225));
265                 eventListFrame->SetBackgroundColour(wxColor(225,225,225));
266         }
267         else
268         {
269                 topPanel->SetBackgroundColour(wxColor(185,185,185));
270                 mainPanel->SetBackgroundColour(wxColor(155,155,155));
271                 eventListFrame->SetBackgroundColour(wxColor(155,155,155));
272         }
273         
274         // Setup the month view pointer.
275         
276         this->monthViewPointer = monthViewPointer;
277         
278         // Setup the calendar items.
279         
280         CDSEntryList calendarItems = dataStorage->GetEventListByDate(setupYear, setupMonth, setupDay);
281         
282         for (int entrySeek = 0; entrySeek < calendarItems.entryList.size(); entrySeek++){
283                 
284                 // Get the information about the calendar entry.
285                 
286                 CDSGetCalendarEntryInfo newEntryInfo = dataStorage->GetEvent(calendarItems.entryList[entrySeek]);
287                 CDSGetCalendarInfo newEntryCalendarInfo = dataStorage->GetCalendar(newEntryInfo.calendarID);
288                 
289                 // Setup the calendar entry.
290                 
291                 XCCalendarDayEntry *newEntry = new XCCalendarDayEntry(eventListFrame, newEntryInfo.entryName, wxDefaultPosition, wxDefaultSize, calendarItems.entryList[entrySeek]);
292                 
293                 newEntry->SetColour(&newEntryCalendarInfo.calendarColour);
294                 newEntry->SetTime(newEntryInfo.entryStartHour, newEntryInfo.entryStartMinute, newEntryInfo.entryStartSecond);
295                 newEntry->SetEntryIDs(newEntryCalendarInfo.accountID, newEntryInfo.calendarID, newEntryInfo.calendarEntryID);           
296                 
297                 eventListFrameSizer->Add(newEntry, 0, wxEXPAND, 5);
298                 wxSizerItem *afterSpacer = eventListFrameSizer->Add(0, 5, 0, 0, 5);
299                 
300                 newEntry->SetAfterSpacer(afterSpacer);
301                 
302                 // Go through the list of calendar entries to hide by account.
303                 
304                 for (vector<int>::iterator hideAccountsItem = hideAccounts->begin();
305                         hideAccountsItem != hideAccounts->end(); hideAccountsItem++){
306                                 
307                         if (*hideAccountsItem == newEntryCalendarInfo.accountID){
308                                 newEntry->Show(false);
309                                 newEntry->GetAfterSpacer()->Show(false);
310                         }
311                                 
312                 }
313                 
314                 // Go through the list of calendar entries to hide by calendar.
315                 
316                 for (vector<int>::iterator hideCalendarsItem = hideCalendars->begin();
317                         hideCalendarsItem != hideCalendars->end(); hideCalendarsItem++){
318                                 
319                         if (*hideCalendarsItem == newEntryInfo.calendarID){
320                                 newEntry->Show(false);
321                                 newEntry->GetAfterSpacer()->Show(false);
322                         }
323                                 
324                 }
325                 
326                 calendarEntryList.push_back(newEntry);
327         }
328         
331 void XCCalendarDay::HideAccountEntries(wxCommandEvent &accountData){
332         
333         // Go through each of the controls and hide the controls (and spacing) that
334         // have the matched account IDs.
335         
336         int sizerPosition = 0;
337         
338         for (vector<XCCalendarDayEntry*>::iterator calendarEntryIter = calendarEntryList.begin();
339                 calendarEntryIter != calendarEntryList.end(); calendarEntryIter++){
340                 
341                 (*calendarEntryIter)->SetShowAccountStatus(false);
342                         
343                 if ((*calendarEntryIter)->GetAccountID() == accountData.GetInt()){
344                         
345                         wxSizerItem *calendarItem = eventListFrameSizer->GetItem((*calendarEntryIter));
346                         (*calendarEntryIter)->Show(false);
347                         
348                         // Get the spacing and hide it as well.
349                         
350                         wxSizerItem *afterSpacer = (*calendarEntryIter)->GetAfterSpacer();
351                         afterSpacer->Show(false);
352                         
353                 }
354                         
355         }
356         
357         this->Refresh();
358         
361 void XCCalendarDay::ShowAccountEntries(wxCommandEvent &accountData){
362         
363         // Go through each of the controls and hide the controls (and spacing) that
364         // have the matched account IDs.
365         
366         int sizerPosition = 0;
367         
368         for (vector<XCCalendarDayEntry*>::iterator calendarEntryIter = calendarEntryList.begin();
369                 calendarEntryIter != calendarEntryList.end(); calendarEntryIter++){
370                 
371                 (*calendarEntryIter)->SetShowAccountStatus(true);
372                         
373                 if ((*calendarEntryIter)->GetShowCalendarStatus() == false){
374                         continue;
375                 }
376                         
377                 if ((*calendarEntryIter)->GetAccountID() == accountData.GetInt()){
378                         
379                         wxSizerItem *calendarItem = eventListFrameSizer->GetItem((*calendarEntryIter));
380                         (*calendarEntryIter)->Show(true);
381                         
382                         // Get the spacing and hide it as well.
383                         
384                         wxSizerItem *afterSpacer = (*calendarEntryIter)->GetAfterSpacer();
385                         afterSpacer->Show(true);
386                         
387                 }
388                 
389         }
390         
391         this->Refresh();
392         
395 void XCCalendarDay::HideCalendarEntries(wxCommandEvent &calendarData){
396         
397         // Go through each of the controls and hide the controls (and spacing) that
398         // have the matched account IDs.
399         
400         int sizerPosition = 0;
401         
402         for (vector<XCCalendarDayEntry*>::iterator calendarEntryIter = calendarEntryList.begin();
403                 calendarEntryIter != calendarEntryList.end(); calendarEntryIter++){
404                         
405                 if ((*calendarEntryIter)->GetCalendarID() == calendarData.GetInt()){
406                         
407                         (*calendarEntryIter)->SetShowCalendarStatus(false);
408                         
409                         wxSizerItem *calendarItem = eventListFrameSizer->GetItem((*calendarEntryIter));
410                         (*calendarEntryIter)->Show(false);
411                         
412                         // Get the spacing and hide it as well.
413                         
414                         wxSizerItem *afterSpacer = (*calendarEntryIter)->GetAfterSpacer();
415                         afterSpacer->Show(false);
416                         
417                 }
418                         
419         }
420         
421         this->Refresh();
422         
425 void XCCalendarDay::ShowCalendarEntries(wxCommandEvent &calendarData){
426         
427         // Go through each of the controls and hide the controls (and spacing) that
428         // have the matched account IDs.
429         
430         int sizerPosition = 0;
431         
432         for (vector<XCCalendarDayEntry*>::iterator calendarEntryIter = calendarEntryList.begin();
433                 calendarEntryIter != calendarEntryList.end(); calendarEntryIter++){
434                         
435                 if ((*calendarEntryIter)->GetCalendarID() == calendarData.GetInt()){
436                         
437                         (*calendarEntryIter)->SetShowCalendarStatus(true);
438                         
439                         if ((*calendarEntryIter)->GetShowAccountStatus() == false){
440                                 
441                                 // Don't show the calendar entry because the account status
442                                 // is set to hidden. Continue to the next one.
443                                 
444                                 continue;
445                                 
446                         }
447                         
448                         wxSizerItem *calendarItem = eventListFrameSizer->GetItem((*calendarEntryIter));
449                         (*calendarEntryIter)->Show(true);
450                         
451                         // Get the spacing and hide it as well.
452                         
453                         wxSizerItem *afterSpacer = (*calendarEntryIter)->GetAfterSpacer();
454                         afterSpacer->Show(true);
455                         
456                 }
457                         
458         }
459         
460         this->Refresh();
461         
464 void XCCalendarDay::DeleteCalendarEntries(wxCommandEvent &calendarData){
465         
466         vector<vector<XCCalendarDayEntry*>::iterator> deleteEntriesList;
467         
468         for (vector<XCCalendarDayEntry*>::iterator calendarEntryIter = calendarEntryList.begin();
469                 calendarEntryIter != calendarEntryList.end(); calendarEntryIter++){
470         
471                 if ((*calendarEntryIter)->GetCalendarID() == calendarData.GetInt()){
472                         
473                         wxSizerItem *calendarItem = eventListFrameSizer->GetItem((*calendarEntryIter));
474                         (*calendarEntryIter)->Show(false);
475                         
476                         // Get the spacing and hide it as well.
477                         
478                         wxSizerItem *afterSpacer = (*calendarEntryIter)->GetAfterSpacer();
479                         afterSpacer->Show(false);
480                         
481                         delete afterSpacer;
482                         afterSpacer = nullptr;
483         
484                         delete (*calendarEntryIter);
485                         deleteEntriesList.push_back(calendarEntryIter);
486                         
487                 }               
488                         
489         }
490         
491         this->Refresh();
492         mainPanel->Layout();
493         eventListFrame->Layout();
494         eventListFrameSizer->Layout();
495         
496         for (auto deleteIter : deleteEntriesList){
497                 calendarEntryList.erase(deleteIter);
498         }
499         
502 void XCCalendarDay::DeleteCalendarEntry(wxCommandEvent &eventData){
503         
504         vector<vector<XCCalendarDayEntry*>::iterator> deleteEntriesList;
505         
506         for (vector<XCCalendarDayEntry*>::iterator calendarEntryIter = calendarEntryList.begin();
507                 calendarEntryIter != calendarEntryList.end(); calendarEntryIter++){
508         
509                 if ((*calendarEntryIter)->GetEventID() == eventData.GetInt()){
510                         
511                         wxSizerItem *calendarItem = eventListFrameSizer->GetItem((*calendarEntryIter));
512                         (*calendarEntryIter)->Show(false);
513                         
514                         // Get the spacing and hide it as well.
515                         
516                         wxSizerItem *afterSpacer = (*calendarEntryIter)->GetAfterSpacer();
517                         afterSpacer->Show(false);
518                         
519                         delete (*calendarEntryIter);
520                         deleteEntriesList.push_back(calendarEntryIter);                 
521                         
522                 }               
523                         
524         }
525         
526         for (auto deleteIter : deleteEntriesList){
527                 calendarEntryList.erase(deleteIter);
528         }
529         
530         this->Refresh();
531         this->Layout();
532         eventListFrame->Layout();
533         eventListFrameSizer->Layout();
534         
537 void XCCalendarDay::AddCalendarEntry(wxCommandEvent &eventData){
538         
539         EventProperties *eventInfo = (EventProperties*)eventData.GetClientData();
540         
541         XCCalendarDayEntry *newEntry = new XCCalendarDayEntry(eventListFrame, eventInfo->eventName, wxDefaultPosition, wxDefaultSize, eventInfo->eventID);
542                 
543         CDSGetCalendarInfo calendarInfo = dataStorage->GetCalendar(eventInfo->calendarID);
544         
545         newEntry->SetColour(&calendarInfo.calendarColour);
546         newEntry->SetTime(eventInfo->eventHour, eventInfo->eventMinute, eventInfo->eventSecond);
547         newEntry->SetEntryIDs(calendarInfo.accountID, eventInfo->calendarID, eventInfo->eventID);               
548                 
549         eventListFrameSizer->Add(newEntry, 0, wxEXPAND, 5);
550         wxSizerItem *afterSpacer = eventListFrameSizer->Add(0, 5, 0, 0, 5);
551                 
552         newEntry->SetAfterSpacer(afterSpacer);
553         
554         // Go through the list of calendar entries to hide by account.
555                 
556         for (vector<int>::iterator hideAccountsItem = eventInfo->hideAccountsList.begin();
557                 hideAccountsItem != eventInfo->hideAccountsList.end(); hideAccountsItem++){
558                                 
559                 if (*hideAccountsItem = calendarInfo.accountID){
560                         newEntry->Show(false);
561                         newEntry->GetAfterSpacer()->Show(false);
562                 }
563                                 
564         }
565                 
566         // Go through the list of calendar entries to hide by calendar.
567                 
568         for (vector<int>::iterator hideCalendarsItem = eventInfo->hideCalendarsList.begin();
569                 hideCalendarsItem != eventInfo->hideCalendarsList.end(); hideCalendarsItem++){
570                                 
571                 if (*hideCalendarsItem == eventInfo->calendarID){
572                         newEntry->Show(false);
573                         newEntry->GetAfterSpacer()->Show(false);
574                 }                       
575                                 
576         }
577                 
578         calendarEntryList.push_back(newEntry);
579         
580         this->Refresh();
581         mainPanel->Layout();
582         eventListFrame->Layout();
583         eventListFrameSizer->Layout();
584         
587 void XCCalendarDay::UpdateCalendarEntry(wxCommandEvent &eventData){
588         
589         // Go thorugh each of the entries in the day and
590         // then update it.
591         
592         EventProperties *eventInfo = (EventProperties*)eventData.GetClientData();
593         
594         for (vector<XCCalendarDayEntry*>::iterator calendarEntryIter = calendarEntryList.begin();
595                 calendarEntryIter != calendarEntryList.end(); calendarEntryIter++){
596                 
597                 if ((*calendarEntryIter)->GetEventID() == eventInfo->eventID){
598                         
599                         (*calendarEntryIter)->SetEventName(eventInfo->eventName);
600                         (*calendarEntryIter)->SetTime(eventInfo->eventHour, eventInfo->eventMinute, eventInfo->eventSecond);
601                         
602                         
603                 }
604                         
605         }
606         
607         delete eventInfo;
608         eventInfo = nullptr;
609         
612 void XCCalendarDay::UpdateCalendarColour(wxCommandEvent &colourData){
613         
614         // Go thorugh each of the entries in the day and
615         // then update it.
616         
617         ColourUpdateProperties *colourInfo = (ColourUpdateProperties*)colourData.GetClientData();
618         
619         for (vector<XCCalendarDayEntry*>::iterator calendarEntryIter = calendarEntryList.begin();
620                 calendarEntryIter != calendarEntryList.end(); calendarEntryIter++){
621                 
622                 if ((*calendarEntryIter)->GetCalendarID() == colourInfo->calendarID){
623                         
624                         (*calendarEntryIter)->SetColour(&colourInfo->newColour);
625                         
626                 }
627                         
628         }
629         
632 int XCCalendarDay::GetCalendarDay(){
633         
634         return calendarDay;
635         
638 int XCCalendarDay::GetCalendarMonth(){
639         
640         return calendarMonth;
641         
644 int XCCalendarDay::GetCalendarYear(){
645         
646         return calendarYear;
647         
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