Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added code to XCCalendarDay
[xestiacalendar/.git] / source / widgets / XCCalendarDay.cpp
index 2b5eabb..15c8c65 100644 (file)
@@ -23,14 +23,14 @@ using namespace std;
 BEGIN_EVENT_TABLE(XCCalendarDay, wxPanel)
 EVT_PAINT(XCCalendarDay::PaintFrameEvent)
 EVT_SIZE(XCCalendarDay::ResizeFrameEvent)
-//EVT_COMMAND(wxID_ANY, XCCALENDARDAY_DESELECTOTHERENTRIES, XCCalendarDay::DeselectOthersEvent)
 END_EVENT_TABLE()
 
 XCCalendarDay::XCCalendarDay(wxWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size)
         : wxPanel(parent, wxID_ANY, pos, size, wxTAB_TRAVERSAL, title){
        
        Connect(wxID_ANY, XCCALENDARDAY_DESELECTOTHERENTRIES, wxCommandEventHandler(XCCalendarDay::DeselectOthersEvent));
-       
+       Connect(ID_DESELECTALLITEMS, XCCALENDARDAY_DESELECTALLENTRIES, wxCommandEventHandler(XCCalendarDay::DeselectAllEvent));
+
        this->SetMinSize( wxSize( 100,100 ) );
        
        AlertIconBitmap.LoadFile("AlertIcon-32.png", wxBITMAP_DEFAULT_TYPE);
@@ -139,29 +139,44 @@ XCCalendarDay::~XCCalendarDay(){
 void XCCalendarDay::Repaint(){
        
        wxPaintDC dc(this);
-
+       wxPaintDC EventListFrameDC(EventListFrame);
+       
        // Get the wxSizerItem for the top date and the entries part.
 
        wxSizerItem *TopSectionSizerItem = WindowSizer->GetItem((size_t)0);
        wxSizerItem *MainSectionSizerItem = WindowSizer->GetItem((size_t)1);
        wxRect TopSizer = wxRect(WindowSizer->GetPosition(), WindowSizer->GetSize());
        
-       dc.SetPen(wxPen(wxColor(255,255,255), 0, wxPENSTYLE_TRANSPARENT));
-       dc.DrawRectangle(TopSectionSizerItem->GetRect());
-       dc.SetBrush(wxBrush(wxColor(225,225,225)));
-       dc.DrawRectangle(MainSectionSizerItem->GetRect());
-       
-       // Draw the border.
+       if (IsInMonth == true){
        
-       this->Layout();
+               dc.SetPen(wxPen(wxColor(255,255,255), 0, wxPENSTYLE_TRANSPARENT));
+               dc.SetBrush(wxBrush(wxColor(255,255,255)));
+               dc.DrawRectangle(TopSectionSizerItem->GetRect());
+               dc.SetBrush(wxBrush(wxColor(225,225,225)));
+               dc.DrawRectangle(MainSectionSizerItem->GetRect());
+               EventListFrameDC.SetPen(wxPen(wxColor(255,255,255), 0, wxPENSTYLE_TRANSPARENT));
+               EventListFrameDC.SetBrush(wxBrush(wxColor(225,225,225)));
+               EventListFrameDC.DrawRectangle(EventListFrame->GetClientRect());
+               
+       } else {
 
-       dc.SetBrush(wxBrush(wxColor(0,0,0), wxBRUSHSTYLE_TRANSPARENT));
+               dc.SetPen(wxPen(wxColor(185,185,185), 0, wxPENSTYLE_TRANSPARENT));
+               dc.SetBrush(wxBrush(wxColor(185,185,185)));
+               dc.DrawRectangle(TopSectionSizerItem->GetRect());
+               dc.SetBrush(wxBrush(wxColor(155,155,155)));
+               dc.DrawRectangle(MainSectionSizerItem->GetRect());
+               EventListFrameDC.SetPen(wxPen(wxColor(255,255,255), 0, wxPENSTYLE_TRANSPARENT));
+               EventListFrameDC.SetBrush(wxBrush(wxColor(155,155,155)));
+               EventListFrameDC.DrawRectangle(EventListFrame->GetClientRect());
+               
+       }
        
-       wxPaintDC EventListFrameDC(EventListFrame);
-       EventListFrameDC.SetPen(wxPen(wxColor(255,255,255), 0, wxPENSTYLE_TRANSPARENT));
-       EventListFrameDC.SetBrush(wxBrush(wxColor(225,225,225)));
-       EventListFrameDC.DrawRectangle(EventListFrame->GetClientRect());
+       // Draw the border.
+
+       //dc.SetBrush(wxBrush(wxColor(0,0,0), wxBRUSHSTYLE_TRANSPARENT));
 
+       this->Layout();
+       
 }
 
 void XCCalendarDay::UpdateTopIcons(){
@@ -234,4 +249,52 @@ void XCCalendarDay::DeselectOthersEvent(wxCommandEvent &DeselectEvent)
                        
        }
        
+       // Send event notification to deselect the other calendar entries.
+       
+       if (this->MonthViewPointer != nullptr){
+               
+               wxCommandEvent DeselectEvent(XCCALENDARMONTH_DESELECTOTHERENTRIES);
+               DeselectEvent.SetClientData(this);
+               DeselectEvent.SetId(ID_MONTHVIEWCLEARSELECTION);
+               wxPostEvent(this->MonthViewPointer, DeselectEvent);
+               
+       }
+       
+}
+
+void XCCalendarDay::DeselectAllEvent(wxCommandEvent &DeselectEvent)
+{
+       
+       int SelectedEntryID = DeselectEvent.GetInt();
+
+       wxCommandEvent DeselectEntryEvent(XCCALENDARDAYENTRY_DESELECT);
+       
+       for (vector<XCCalendarDayEntry*>::iterator EntryIter = CalendarEntryList.begin();
+               EntryIter != CalendarEntryList.end(); EntryIter++){
+
+               wxPostEvent((*EntryIter), DeselectEntryEvent);
+                       
+       }
+       
+}
+
+void XCCalendarDay::SetupControl(int SetupDay, int SetupMonth, int SetupYear, bool SetupIsInMonth, XCCalendarMonthView *MonthViewPointer)
+{
+       
+       // Set the day
+       
+       NumberText->SetLabel(wxString::Format("%02i", SetupDay));
+       
+       // Set the month
+       
+       // Set the year.
+       
+       // Setup the Is In Month value.
+       
+       IsInMonth = SetupIsInMonth;
+       
+       // Setup the month view pointer.
+       
+       this->MonthViewPointer = MonthViewPointer;
+       
 }
\ 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