From: Steve Brokenshire Date: Sun, 26 Jun 2016 12:36:54 +0000 (+0100) Subject: Updated Repaint function of XCCalendarDay. X-Git-Tag: release-0.02~109 X-Git-Url: http://Server1/repobrowser/?p=xestiacalendar%2F.git;a=commitdiff_plain;h=66d9410d3fc9072081106252a68740427406b0f4 Updated Repaint function of XCCalendarDay. The Repaint function of the XCCalendarDay now checks if the IsInMonth boolean is set and draws the background colours accordingly. --- diff --git a/source/widgets/XCCalendarDay.cpp b/source/widgets/XCCalendarDay.cpp index 2b5eabb..6c0b29b 100644 --- a/source/widgets/XCCalendarDay.cpp +++ b/source/widgets/XCCalendarDay.cpp @@ -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()); + if (IsInMonth == true){ - // Draw the border. + 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.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()); + + } - this->Layout(); + // Draw the border. - dc.SetBrush(wxBrush(wxColor(0,0,0), wxBRUSHSTYLE_TRANSPARENT)); - - wxPaintDC EventListFrameDC(EventListFrame); - EventListFrameDC.SetPen(wxPen(wxColor(255,255,255), 0, wxPENSTYLE_TRANSPARENT)); - EventListFrameDC.SetBrush(wxBrush(wxColor(225,225,225))); - EventListFrameDC.DrawRectangle(EventListFrame->GetClientRect()); + //dc.SetBrush(wxBrush(wxColor(0,0,0), wxBRUSHSTYLE_TRANSPARENT)); + this->Layout(); + } void XCCalendarDay::UpdateTopIcons(){ diff --git a/source/widgets/XCCalendarDay.h b/source/widgets/XCCalendarDay.h index d70594a..6e46b14 100644 --- a/source/widgets/XCCalendarDay.h +++ b/source/widgets/XCCalendarDay.h @@ -40,6 +40,7 @@ class XCCalendarDay: public wxPanel wxStaticText *NumberText = nullptr; wxScrolledWindow *EventListFrame = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL); int CalendarEntrySeekNumber = 0; + bool IsInMonth = false; vector CalendarEntryList; XCCalendarDayEntry *CalendarEntry1 = new XCCalendarDayEntry(EventListFrame, "Calendar Entry 1", wxDefaultPosition, wxDefaultSize, CalendarEntrySeekNumber++);