Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
frmMain: Implemented code to hide/show calendar entries
[xestiacalendar/.git] / source / widgets / XCCalendarDayEntry.cpp
index 047bc4a..d2d9483 100644 (file)
@@ -30,12 +30,17 @@ XCCalendarDayEntry::XCCalendarDayEntry(wxWindow* parent, const wxString& title,
         : wxPanel(parent, wxID_ANY, pos, size, wxTAB_TRAVERSAL, title){
        
        DayPanel = parent->GetParent();
-       EntryID = id;
+       entryID = id;
        
        this->SetMinSize(wxSize(65, 30));
        
        EventTextData = title.mb_str();
-       EventText = new wxStaticText(this, wxID_ANY, title, wxPoint(49, 8), wxDefaultSize, wxST_ELLIPSIZE_END);
+       EventText = new wxStaticText(this, wxID_ANY, title, wxPoint(49, 14), wxDefaultSize, wxST_ELLIPSIZE_END);
+       EventTime = new wxStaticText(this, wxID_ANY, wxT("Time"), wxPoint(49,3), wxDefaultSize, 0);
+               
+       wxFont eventTimeFont = EventTime->GetFont();
+       eventTimeFont.MakeBold();
+       EventTime->SetFont(eventTimeFont);
 
        wxMemoryInputStream alerticon(icons_alert_png, sizeof(icons_alert_png));
        wxMemoryInputStream priorityicon(icons_priority_png, sizeof(icons_priority_png));
@@ -49,10 +54,12 @@ XCCalendarDayEntry::XCCalendarDayEntry(wxWindow* parent, const wxString& title,
        AlarmIcon->SetBitmap(AlarmIconBitmap);
        HighPriorityIcon->SetBitmap(PriorityIconBitmap);
 
-       Connect(wxID_ANY, XCCALENDARDAYENTRY_DESELECT, wxCommandEventHandler(XCCalendarDayEntry::Deselect));
-       AlarmIcon->Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(XCCalendarDayEntry::LeftClick), NULL, this);
-       HighPriorityIcon->Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(XCCalendarDayEntry::LeftClick), NULL, this);
-       EventText->Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(XCCalendarDayEntry::LeftClick), NULL, this);
+       Connect(ID_ENTRYDESELECT, XCCALENDARDAYENTRY_DESELECT, wxCommandEventHandler(XCCalendarDayEntry::Deselect));
+       AlarmIcon->Connect(wxEVT_LEFT_UP, wxMouseEventHandler(XCCalendarDayEntry::LeftClick), NULL, this);
+       HighPriorityIcon->Connect(wxEVT_LEFT_UP, wxMouseEventHandler(XCCalendarDayEntry::LeftClick), NULL, this);
+       EventText->Connect(wxEVT_LEFT_UP, wxMouseEventHandler(XCCalendarDayEntry::LeftClick), NULL, this);
+       EventTime->Connect(wxEVT_LEFT_UP, wxMouseEventHandler(XCCalendarDayEntry::LeftClick), NULL, this);
+       DayPanel->Connect(wxEVT_LEFT_UP, wxMouseEventHandler(XCCalendarDayEntry::LeftClick), NULL, this);
        
        UpdateInformation();
        
@@ -140,13 +147,16 @@ void XCCalendarDayEntry::UpdateInformation(){
        
        switch(PositionMode){
                case 0:
-                       EventText->SetPosition(wxPoint(FirstPosition,8));
+                       EventText->SetPosition(wxPoint(FirstPosition,14));
+                       EventTime->SetPosition(wxPoint(FirstPosition,3));
                        break;
                case 1:
-                       EventText->SetPosition(wxPoint(SecondPosition,8));
+                       EventText->SetPosition(wxPoint(SecondPosition,14));
+                       EventTime->SetPosition(wxPoint(FirstPosition,3));
                        break;
                case 2:
-                       EventText->SetPosition(wxPoint(ThirdPosition,8));
+                       EventText->SetPosition(wxPoint(ThirdPosition,14));
+                       EventTime->SetPosition(wxPoint(FirstPosition,3));
                        break;
        }
        
@@ -165,12 +175,15 @@ void XCCalendarDayEntry::ResizeFrameEvent(wxSizeEvent &SizeEvent){
        switch(PositionMode){
                case 0:
                        EventText->SetSize(wxSize((this->GetClientRect().width - FirstPosition - 5),15));
+                       EventTime->SetSize(wxSize((this->GetClientRect().width - FirstPosition - 5),15));
                        break;
                case 1:
                        EventText->SetSize(wxSize((this->GetClientRect().width - SecondPosition - 5),15));
+                       EventTime->SetSize(wxSize((this->GetClientRect().width - SecondPosition - 5),15));
                        break;
                case 2:
-                       EventText->SetSize(wxSize((this->GetClientRect().width - ThirdPosition - 5),15));
+                       EventText->SetSize(wxSize((this->GetClientRect().width - ThirdPosition - 5),14));
+                       EventTime->SetSize(wxSize((this->GetClientRect().width - ThirdPosition - 5),15));
                        break;
        }
        
@@ -187,7 +200,8 @@ void XCCalendarDayEntry::LeftClick(wxMouseEvent &MouseEvent){
        
        this->SetBackgroundColour(wxColor(255,215,0));
        wxCommandEvent DeselectOthersEvent(XCCALENDARDAY_DESELECTOTHERENTRIES);
-       DeselectOthersEvent.SetInt(EntryID);
+       DeselectOthersEvent.SetInt(entryID);
+       DeselectOthersEvent.SetId(ID_DESELECTOTHERENTRIES);
        wxPostEvent(DayPanel, DeselectOthersEvent);
        
 }
@@ -198,9 +212,21 @@ void XCCalendarDayEntry::Deselect(wxCommandEvent &DeselectEvent){
        
 }
 
+void XCCalendarDayEntry::SetTime(int timeHour, int timeMinute, int timeSecond){
+       
+       this->timeHour = timeHour;
+       this->timeMinute = timeMinute;
+       this->timeSecond = timeSecond;
+       
+       string timeOutput = BuildEventTime(timeHour, timeMinute);
+       EventTime->SetLabel(timeOutput);
+       
+}
+
 void XCCalendarDayEntry::SetColour(Colour *ColourIn){
        
        EntryColour = *ColourIn;
+       Repaint();
        
 }
 
@@ -232,6 +258,98 @@ bool XCCalendarDayEntry::GetDisplayHighPriority(){
 
 int XCCalendarDayEntry::GetID(){
        
-       return EntryID;
+       return entryID;
+       
+}
+
+int XCCalendarDayEntry::GetCalendarID(){
+       
+       return calendarID;
+       
+}
+
+int XCCalendarDayEntry::GetAccountID(){
+       
+       return accountID;
+       
+}
+
+string XCCalendarDayEntry::BuildEventTime(int timeHour, int timeMinute){
+       
+       string timeOutput;
+       
+       if (timeHour > 12){
+               
+               timeOutput += to_string(timeHour - 12);
+               
+       } else if (timeHour > 0){
+               
+               timeOutput += to_string(timeHour);
+               
+       } else if (timeHour == 0){
+       
+               timeOutput += to_string(12);
+               
+       }
+       
+       timeOutput += ":";
+       
+       if (timeMinute < 10){
+               timeOutput += "0";
+       }       
+       
+       timeOutput += to_string(timeMinute);
+       
+       if (timeHour < 12){
+               timeOutput += "am";
+       } else {
+               timeOutput += "pm";
+       }
+       
+       return timeOutput;
+       
+}
+
+void XCCalendarDayEntry::SetEntryIDs(int accountID, int calendarID, int entryID){
+       
+       this->accountID = accountID;
+       this->calendarID = calendarID;
+       this->entryID = entryID;
+       
+}
+
+void XCCalendarDayEntry::SetAfterSpacer(wxSizerItem *afterSpacer){
+       
+       this->afterSpacer = afterSpacer;
+       
+}
+
+wxSizerItem* XCCalendarDayEntry::GetAfterSpacer(){
+       
+       return afterSpacer;
+       
+}
+
+bool XCCalendarDayEntry::SetShowAccountStatus(bool statusInput){
+       
+       showAccount = statusInput;
+       
+}
+
+bool XCCalendarDayEntry::SetShowCalendarStatus(bool statusInput){
+
+       showCalendar = statusInput;
+       
+}
+
+bool XCCalendarDayEntry::GetShowAccountStatus(){
+       
+       return showAccount;
+       
+}
+
+bool XCCalendarDayEntry::GetShowCalendarStatus(){
+
+       return showCalendar;
        
 }
\ No newline at end of file
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