From d97b5c14c651aa7dad92072e7bf192704540018c Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Tue, 11 Jul 2017 00:41:56 +0100 Subject: [PATCH] XCCalendar widgets: Removed painting of controls --- source/widgets/XCCalendarDay.cpp | 132 ++++++++++--------------- source/widgets/XCCalendarDay.h | 13 ++- source/widgets/XCCalendarDayEntry.cpp | 76 +++++++------- source/widgets/XCCalendarDayEntry.h | 9 +- source/widgets/XCCalendarMonthView.cpp | 19 +--- source/widgets/XCCalendarMonthView.h | 5 +- 6 files changed, 97 insertions(+), 157 deletions(-) diff --git a/source/widgets/XCCalendarDay.cpp b/source/widgets/XCCalendarDay.cpp index 64b58e7..78c1687 100644 --- a/source/widgets/XCCalendarDay.cpp +++ b/source/widgets/XCCalendarDay.cpp @@ -33,16 +33,22 @@ wxDEFINE_EVENT(XCCALENDARDAY_UPDATEENTRY, wxCommandEvent); wxDEFINE_EVENT(XCCALENDARDAY_UPDATECALENDARCOLOUR, wxCommandEvent); BEGIN_EVENT_TABLE(XCCalendarDay, wxPanel) -EVT_PAINT(XCCalendarDay::PaintFrameEvent) -EVT_SIZE(XCCalendarDay::ResizeFrameEvent) 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){ this->SetMinSize( wxSize( 100,100 ) ); + // Setup the top panel. + + topPanel = new wxPanel(this, wxID_ANY, wxPoint(0,0), wxSize(50, 40), wxTAB_TRAVERSAL); + mainPanel = new wxPanel(this, wxID_ANY, wxPoint(0,0), wxSize(200, 200), wxTAB_TRAVERSAL); + // Setip the icons. + highPriorityIcon = new wxStaticBitmap(topPanel, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize(32,32), 0); + alertIcon = new wxStaticBitmap(topPanel, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize(32,32), 0); + wxMemoryInputStream alerticon(icons_alert32_png, sizeof(icons_alert32_png)); wxMemoryInputStream priorityicon(icons_priority32_png, sizeof(icons_priority32_png)); @@ -55,12 +61,7 @@ XCCalendarDay::XCCalendarDay(wxWindow *parent, const wxString& title, const wxPo alertIcon->SetBitmap(imgAlertIcon); highPriorityIcon->SetBitmap(imgPriorityIcon); - windowSizer->AddGrowableCol(0); - windowSizer->AddGrowableRow(1); - windowSizer->SetFlexibleDirection( wxBOTH ); - windowSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - - numberText = new wxStaticText(this, wxID_ANY, wxT("09"), wxDefaultPosition, wxDefaultSize, 0); + numberText = new wxStaticText(topPanel, wxID_ANY, wxT("09"), wxDefaultPosition, wxDefaultSize, 0); numberText->SetFont(wxFont(24, 70, 90, 92, false, wxEmptyString)); topSectionSizer->Add(highPriorityIcon, 0, wxALL|wxALIGN_CENTER_VERTICAL, 0); @@ -70,6 +71,8 @@ XCCalendarDay::XCCalendarDay(wxWindow *parent, const wxString& title, const wxPo // Setup the scrollable section. + eventListFrame = new wxScrolledWindow(mainPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL); + Colour eventColour; eventColour.red = 40; eventColour.green = 80; eventColour.blue = 80; @@ -78,19 +81,20 @@ XCCalendarDay::XCCalendarDay(wxWindow *parent, const wxString& title, const wxPo eventListFrame->SetScrollRate(0,1); eventListFrameSizer->Fit(eventListFrame); eventListFrameSizer->Layout(); - windowSizer->Fit(this); // Setup the scroll window. - mainSectionSizer->Add(eventListFrame, 1, wxGROW | wxALL, 10); + mainSectionSizer->Add(eventListFrame, 1, wxGROW | wxALL, 5); - windowSizer->Add(topSectionSizer, 1, wxEXPAND, 5); - windowSizer->Add(mainSectionSizer, 1, wxEXPAND, 5); + topPanel->SetSizer(topSectionSizer); + mainPanel->SetSizer(mainSectionSizer); + + windowSizer->Add(topPanel, 1, wxEXPAND, 0); + windowSizer->Add(mainPanel, 1, wxEXPAND, 0); this->SetSizer(windowSizer); this->SetSize(size); this->Layout(); - this->SetBackgroundStyle(wxBG_STYLE_PAINT); this->Centre(wxBOTH); UpdateTopIcons(); @@ -134,49 +138,6 @@ 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()); - - if (isInMonth == true){ - - 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()); - - } - - // Draw the border. - - //dc.SetBrush(wxBrush(wxColor(0,0,0), wxBRUSHSTYLE_TRANSPARENT)); - - this->Layout(); - -} - void XCCalendarDay::UpdateTopIcons(){ bool alarmFound = false; @@ -210,13 +171,6 @@ void XCCalendarDay::UpdateTopIcons(){ } -void XCCalendarDay::PaintFrameEvent(wxPaintEvent &paintEvent) -{ - - Repaint(); - -} - void XCCalendarDay::ResizeFrameEvent(wxSizeEvent &sizeEvent) { @@ -226,6 +180,11 @@ void XCCalendarDay::ResizeFrameEvent(wxSizeEvent &sizeEvent) // Refresh the window. this->Refresh(); + topPanel->Refresh(); + mainPanel->Refresh(); + topSectionSizer->Layout(); + mainSectionSizer->Layout(); + windowSizer->Layout(); } @@ -252,10 +211,10 @@ void XCCalendarDay::DeselectOthersEvent(wxCommandEvent &deselectEvent) if (this->monthViewPointer != nullptr){ - wxCommandEvent deselectEvent(XCCALENDARMONTH_DESELECTOTHERENTRIES); - deselectEvent.SetClientData(this); - deselectEvent.SetId(ID_MONTHVIEWCLEARSELECTION); - wxPostEvent(this->monthViewPointer, deselectEvent); + wxCommandEvent deselectMonthEvent(XCCALENDARMONTH_DESELECTOTHERENTRIES); + deselectMonthEvent.SetClientData(this); + deselectMonthEvent.SetId(ID_MONTHVIEWCLEARSELECTION); + wxPostEvent(this->monthViewPointer, deselectMonthEvent); } @@ -299,6 +258,18 @@ void XCCalendarDay::SetupControl(int setupDay, int setupMonth, int setupYear, bo // Setup the Is In Month value. isInMonth = setupIsInMonth; + if (isInMonth) + { + topPanel->SetBackgroundColour(wxColor(255,255,255)); + mainPanel->SetBackgroundColour(wxColor(225,225,225)); + eventListFrame->SetBackgroundColour(wxColor(225,225,225)); + } + else + { + topPanel->SetBackgroundColour(wxColor(185,185,185)); + mainPanel->SetBackgroundColour(wxColor(155,155,155)); + eventListFrame->SetBackgroundColour(wxColor(155,155,155)); + } // Setup the month view pointer. @@ -384,7 +355,6 @@ void XCCalendarDay::HideAccountEntries(wxCommandEvent &accountData){ } this->Refresh(); - Repaint(); } @@ -419,7 +389,6 @@ void XCCalendarDay::ShowAccountEntries(wxCommandEvent &accountData){ } this->Refresh(); - Repaint(); } @@ -450,7 +419,6 @@ void XCCalendarDay::HideCalendarEntries(wxCommandEvent &calendarData){ } this->Refresh(); - Repaint(); } @@ -490,7 +458,6 @@ void XCCalendarDay::ShowCalendarEntries(wxCommandEvent &calendarData){ } this->Refresh(); - Repaint(); } @@ -508,12 +475,11 @@ void XCCalendarDay::DeleteCalendarEntries(wxCommandEvent &calendarData){ // Get the spacing and hide it as well. - /*wxSizerItem *afterSpacer = (*calendarEntryIter)->GetAfterSpacer(); + wxSizerItem *afterSpacer = (*calendarEntryIter)->GetAfterSpacer(); afterSpacer->Show(false); - afterSpacer->DetachSizer(); delete afterSpacer; - afterSpacer = nullptr;*/ + afterSpacer = nullptr; delete (*calendarEntryIter); deleteEntriesList.push_back(calendarEntryIter); @@ -523,7 +489,9 @@ void XCCalendarDay::DeleteCalendarEntries(wxCommandEvent &calendarData){ } this->Refresh(); - Repaint(); + mainPanel->Layout(); + eventListFrame->Layout(); + eventListFrameSizer->Layout(); for (auto deleteIter : deleteEntriesList){ calendarEntryList.erase(deleteIter); @@ -545,12 +513,8 @@ void XCCalendarDay::DeleteCalendarEntry(wxCommandEvent &eventData){ // Get the spacing and hide it as well. - /*wxSizerItem *afterSpacer = (*calendarEntryIter)->GetAfterSpacer(); + wxSizerItem *afterSpacer = (*calendarEntryIter)->GetAfterSpacer(); afterSpacer->Show(false); - afterSpacer->DetachSizer(); - - delete afterSpacer; - afterSpacer = nullptr;*/ delete (*calendarEntryIter); deleteEntriesList.push_back(calendarEntryIter); @@ -564,7 +528,9 @@ void XCCalendarDay::DeleteCalendarEntry(wxCommandEvent &eventData){ } this->Refresh(); - Repaint(); + this->Layout(); + eventListFrame->Layout(); + eventListFrameSizer->Layout(); } @@ -612,7 +578,9 @@ void XCCalendarDay::AddCalendarEntry(wxCommandEvent &eventData){ calendarEntryList.push_back(newEntry); this->Refresh(); - Repaint(); + mainPanel->Layout(); + eventListFrame->Layout(); + eventListFrameSizer->Layout(); } diff --git a/source/widgets/XCCalendarDay.h b/source/widgets/XCCalendarDay.h index bd51a62..e00379b 100644 --- a/source/widgets/XCCalendarDay.h +++ b/source/widgets/XCCalendarDay.h @@ -38,17 +38,19 @@ class XCCalendarDay: public wxPanel { private: XCCalendarMonthView *monthViewPointer = nullptr; - wxFlexGridSizer *windowSizer = new wxFlexGridSizer(2, 1, 0, 0); + wxPanel *topPanel = nullptr; + wxPanel *mainPanel = nullptr; + wxBoxSizer *windowSizer = new wxBoxSizer(wxVERTICAL); wxBoxSizer *topSectionSizer = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer *mainSectionSizer = new wxBoxSizer(wxVERTICAL); wxBoxSizer *eventListFrameSizer = new wxBoxSizer(wxVERTICAL); - wxStaticBitmap *highPriorityIcon = new wxStaticBitmap(this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize(32,32), 0); - wxStaticBitmap *alertIcon = new wxStaticBitmap(this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize(32,32), 0); + wxStaticBitmap *highPriorityIcon = nullptr; + wxStaticBitmap *alertIcon = nullptr; CalendarDataStorage *dataStorage = nullptr; wxBitmap alertIconBitmap; wxBitmap priorityIconBitmap; wxStaticText *numberText = nullptr; - wxScrolledWindow *eventListFrame = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL); + wxScrolledWindow *eventListFrame = nullptr; int calendarEntrySeekNumber = 0; int calendarDay = 0; int calendarMonth = 0; @@ -57,8 +59,6 @@ class XCCalendarDay: public wxPanel vector calendarEntryList; - void Repaint(); - protected: void HideAccountEntries(wxCommandEvent &accountData); void ShowAccountEntries(wxCommandEvent &accountData); @@ -73,7 +73,6 @@ class XCCalendarDay: public wxPanel public: XCCalendarDay(wxWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size); ~XCCalendarDay(); - void PaintFrameEvent(wxPaintEvent &paintEvent); void ResizeFrameEvent(wxSizeEvent &sizeEvent); void DeselectOthersEvent(wxCommandEvent &deselectEvent); void DeselectAllEvent(wxCommandEvent &deselectEvent); diff --git a/source/widgets/XCCalendarDayEntry.cpp b/source/widgets/XCCalendarDayEntry.cpp index 0aede56..5bef669 100644 --- a/source/widgets/XCCalendarDayEntry.cpp +++ b/source/widgets/XCCalendarDayEntry.cpp @@ -21,7 +21,6 @@ wxDEFINE_EVENT(XCCALENDARDAYENTRY_DESELECT, wxCommandEvent); BEGIN_EVENT_TABLE(XCCalendarDayEntry, wxPanel) -EVT_PAINT(XCCalendarDayEntry::PaintFrameEvent) EVT_SIZE(XCCalendarDayEntry::ResizeFrameEvent) EVT_LEFT_UP(XCCalendarDayEntry::LeftClick) EVT_RIGHT_UP(XCCalendarDayEntry::RightClick) @@ -35,15 +34,29 @@ XCCalendarDayEntry::XCCalendarDayEntry(wxWindow* parent, const wxString& title, eventID = id; this->SetMinSize(wxSize(65, 30)); + + // Setup the main panel and main sizer. + + mainPanel = new wxPanel(this, wxID_ANY, wxPoint(0,0), this->GetSize(), wxTAB_TRAVERSAL|wxSIMPLE_BORDER); + mainSizer = new wxBoxSizer( wxVERTICAL ); + + // Setup the calendar colour. + calendarColour = new wxPanel(mainPanel, wxID_ANY, wxPoint(0,0), wxSize(10, 30), wxTAB_TRAVERSAL|wxEXPAND, "Calendar Colour"); + calendarColour->SetBackgroundColour(wxColour(80, 40, 40, 100)); + + // Setup the event text. + eventTextData = title.mb_str(); - 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); + eventText = new wxStaticText(mainPanel, wxID_ANY, title, wxPoint(49, 14), wxDefaultSize, wxST_ELLIPSIZE_END); + eventTime = new wxStaticText(mainPanel, wxID_ANY, wxT("Time"), wxPoint(49,3), wxDefaultSize, 0); wxFont eventTimeFont = eventTime->GetFont(); eventTimeFont.MakeBold(); eventTime->SetFont(eventTimeFont); + // Setup the images. + wxMemoryInputStream alerticon(icons_alert_png, sizeof(icons_alert_png)); wxMemoryInputStream priorityicon(icons_priority_png, sizeof(icons_priority_png)); @@ -56,12 +69,16 @@ XCCalendarDayEntry::XCCalendarDayEntry(wxWindow* parent, const wxString& title, alarmIcon->SetBitmap(alarmIconBitmap); highPriorityIcon->SetBitmap(priorityIconBitmap); + // Setup the connections for the control. + + calendarColour->Connect(wxEVT_LEFT_UP, wxMouseEventHandler(XCCalendarDayEntry::LeftClick), NULL, this); 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); - + + calendarColour->Connect(wxEVT_RIGHT_UP, wxMouseEventHandler(XCCalendarDayEntry::RightClick), NULL, this); alarmIcon->Connect(wxEVT_RIGHT_UP, wxMouseEventHandler(XCCalendarDayEntry::RightClick), NULL, this); highPriorityIcon->Connect(wxEVT_RIGHT_UP, wxMouseEventHandler(XCCalendarDayEntry::RightClick), NULL, this); eventText->Connect(wxEVT_RIGHT_UP, wxMouseEventHandler(XCCalendarDayEntry::RightClick), NULL, this); @@ -73,40 +90,16 @@ XCCalendarDayEntry::XCCalendarDayEntry(wxWindow* parent, const wxString& title, // Bind events to the control. Bind(XCCALENDARDAYENTRY_DESELECT, &XCCalendarDayEntry::Deselect, this, ID_ENTRYDESELECT); -} - -XCCalendarDayEntry::~XCCalendarDayEntry(){ - // Destory the controls from the widget. + // Set the control's sizer. + this->SetSizer(mainSizer); + mainSizer->Add(mainPanel, 0, wxEXPAND, 1); } -void XCCalendarDayEntry::Repaint(){ - - wxPaintDC dc(this); - - // Get the wxSizerItem for the top date and the entries part. - - dc.SetBrush(wxBrush(wxColor(0,0,0), wxBRUSHSTYLE_TRANSPARENT)); - - /*wxRect Test; - - Test.SetX(this->GetClientRect().GetX()); - Test.SetY(this->GetClientRect().GetY()); - Test.SetHeight(this->GetClientRect().GetHeight()); - Test.SetWidth(this->GetClientRect().GetWidth()); - - cout << Test.GetX() << "|" << Test.GetY() << "|" << Test.GetHeight() << "|" << Test.GetWidth() << "|" << endl;*/ - - dc.DrawRectangle(this->GetClientRect()); - - // Draw the calendar colour. +XCCalendarDayEntry::~XCCalendarDayEntry(){ - dc.SetPen(wxPen(wxColor(255,255,255), 0, wxPENSTYLE_TRANSPARENT)); - dc.SetBrush(wxBrush(wxColor(entryColour.red, - entryColour.green, - entryColour.blue), wxBRUSHSTYLE_SOLID)); - dc.DrawRectangle(wxRect(1,1,10,28)); + // Destory the controls from the widget. } @@ -172,12 +165,6 @@ void XCCalendarDayEntry::UpdateInformation(){ } -void XCCalendarDayEntry::PaintFrameEvent(wxPaintEvent &paintEvent){ - - Repaint(); - -} - void XCCalendarDayEntry::ResizeFrameEvent(wxSizeEvent &sizeEvent){ // Adjust the Event text so it is displayed properly. @@ -197,6 +184,10 @@ void XCCalendarDayEntry::ResizeFrameEvent(wxSizeEvent &sizeEvent){ break; } + // Resize the main panel. + + mainPanel->SetSize(this->GetSize()); + // Refresh the window. this->Refresh(); @@ -208,7 +199,7 @@ void XCCalendarDayEntry::LeftClick(wxMouseEvent &mouseEvent){ // Change the background of the widget to mark // the entry as selected. - this->SetBackgroundColour(wxColor(255,215,0)); + mainPanel->SetBackgroundColour(wxColor(255,215,0)); wxCommandEvent deselectOthersEvent(XCCALENDARDAY_DESELECTOTHERENTRIES); deselectOthersEvent.SetInt(eventID); deselectOthersEvent.SetId(ID_DESELECTOTHERENTRIES); @@ -233,7 +224,7 @@ void XCCalendarDayEntry::RightClick(wxMouseEvent &MouseEvent){ void XCCalendarDayEntry::Deselect(wxCommandEvent &DeselectEvent){ - this->SetBackgroundColour(wxNullColour); + mainPanel->SetBackgroundColour(wxNullColour); } @@ -250,8 +241,7 @@ void XCCalendarDayEntry::SetTime(int timeHour, int timeMinute, int timeSecond){ void XCCalendarDayEntry::SetColour(Colour *colourIn){ - entryColour = *colourIn; - Repaint(); + calendarColour->SetBackgroundColour(wxColour(colourIn->red, colourIn->green, colourIn->blue, colourIn->alpha)); } diff --git a/source/widgets/XCCalendarDayEntry.h b/source/widgets/XCCalendarDayEntry.h index 6daf755..1836312 100644 --- a/source/widgets/XCCalendarDayEntry.h +++ b/source/widgets/XCCalendarDayEntry.h @@ -39,11 +39,16 @@ class XCCalendarDayEntry: public wxPanel private: wxWindow *dayPanel = nullptr; + wxPanel *mainPanel = nullptr; + wxPanel *borderPanel = nullptr; + wxPanel *calendarColour = nullptr; string eventTextData = ""; wxStaticText *eventTime = nullptr; wxStaticText *eventText = nullptr; wxStaticBitmap *highPriorityIcon = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxPoint(14,7), wxDefaultSize, 0 ); wxStaticBitmap *alarmIcon = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxPoint(30,7), wxDefaultSize, 0 ); + wxBoxSizer *mainSizer = nullptr; + wxBoxSizer *borderSizer = nullptr; wxSizerItem *afterSpacer = nullptr; wxBitmap alarmIconBitmap; wxBitmap priorityIconBitmap; @@ -68,9 +73,6 @@ class XCCalendarDayEntry: public wxPanel const int secondPosition = 30; const int thirdPosition = 49; - void Repaint(); - void RepaintSelected(); - void UpdateInformation(); string BuildEventTime(int timeHour, int timeMinute); @@ -83,7 +85,6 @@ class XCCalendarDayEntry: public wxPanel XCCalendarDayEntry(wxWindow* parent, const wxString& title, const wxPoint& pos, const wxSize& size, const int id); ~XCCalendarDayEntry(); - void PaintFrameEvent(wxPaintEvent &paintEvent); void ResizeFrameEvent(wxSizeEvent &sizeEvent); void Deselect(wxCommandEvent &deselectEvent); diff --git a/source/widgets/XCCalendarMonthView.cpp b/source/widgets/XCCalendarMonthView.cpp index dda8448..d962006 100644 --- a/source/widgets/XCCalendarMonthView.cpp +++ b/source/widgets/XCCalendarMonthView.cpp @@ -33,7 +33,6 @@ wxDEFINE_EVENT(XCCALENDARMONTH_UPDATEENTRY, wxCommandEvent); wxDEFINE_EVENT(XCCALENDARMONTH_UPDATECALENDARCOLOUR, wxCommandEvent); BEGIN_EVENT_TABLE(XCCalendarMonthView, wxPanel) -EVT_PAINT(XCCalendarMonthView::PaintFrameEvent) END_EVENT_TABLE() XCCalendarMonthView::XCCalendarMonthView(wxWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size, XCCalendarMonthViewGrid *grid, CalendarDataStorage *dataStorage, std::vector *hideAccounts, std::vector *hideCalendars) @@ -177,8 +176,8 @@ void XCCalendarMonthView::ProcessGrid(XCCalendarMonthViewGrid *grid, std::vector // Add Calendar entries. - XCCalendarDay *calendarDayItem = new XCCalendarDay(this, "XCCalendarMonthView Test", wxPoint(50, 50), wxSize(200, 200)); - + XCCalendarDay *calendarDayItem = new XCCalendarDay(this, "XCCalendarMonthView Test", wxPoint(50, 50), wxSize(100,100)); + // Setup the control. calendarDayItem->SetupControl((*dayIter).day, (*dayIter).month, (*dayIter).year, (*dayIter).isInMonth, this, calendarStorage, hideAccounts, hideCalendars); @@ -200,20 +199,6 @@ void XCCalendarMonthView::ProcessGrid(XCCalendarMonthViewGrid *grid, std::vector } -void XCCalendarMonthView::Repaint(){ - - // Draw the border. - - this->Layout(); - -} - -void XCCalendarMonthView::PaintFrameEvent(wxPaintEvent &PaintEvent){ - - Repaint(); - -} - void XCCalendarMonthView::ResizeFrameEvent(wxSizeEvent &SizeEvent){ // TODO: Check if window size is less than 120 pixels and if it is, diff --git a/source/widgets/XCCalendarMonthView.h b/source/widgets/XCCalendarMonthView.h index 36ad194..837a166 100644 --- a/source/widgets/XCCalendarMonthView.h +++ b/source/widgets/XCCalendarMonthView.h @@ -56,8 +56,6 @@ class XCCalendarMonthView: public wxPanel void ProcessGrid(XCCalendarMonthViewGrid *grid, std::vector *hideAccounts, std::vector *hideCalendars); - void Repaint(); - protected: void HideAccountEntries(wxCommandEvent &accountData); void ShowAccountEntries(wxCommandEvent &accountData); @@ -74,8 +72,7 @@ class XCCalendarMonthView: public wxPanel XCCalendarMonthView(wxWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size, XCCalendarMonthViewGrid *grid, CalendarDataStorage *dataStorage, std::vector *hideAccounts, std::vector *hideCalendars); XCCalendarMonthView(XCCalendarMonthViewGrid *grid, CalendarDataStorage *dataStorage, std::vector *hideAccounts, std::vector *hideCalendars); ~XCCalendarMonthView(); - - void PaintFrameEvent(wxPaintEvent &paintEvent); + void ResizeFrameEvent(wxSizeEvent &sizeEvent); void DeselectOthersEvent(wxCommandEvent &deselectEvent); -- 2.39.5