Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added the XCCalendarMonthView class
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 26 Jun 2016 10:40:47 +0000 (11:40 +0100)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 26 Jun 2016 10:40:47 +0000 (11:40 +0100)
source/widgets/XCCalendarMonthView.cpp [new file with mode: 0644]
source/widgets/XCCalendarMonthView.h [new file with mode: 0644]

diff --git a/source/widgets/XCCalendarMonthView.cpp b/source/widgets/XCCalendarMonthView.cpp
new file mode 100644 (file)
index 0000000..9c23929
--- /dev/null
@@ -0,0 +1,132 @@
+// XCCalendarMonthView.cpp - Xestia Calendar XCCalendarMonthView widget class.
+//
+// (c) 2016 Xestia Software Development.
+//
+// This file is part of Xestia Calendar.
+//
+// Xestia Address Book is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by the
+// Free Software Foundation, version 3 of the license.
+//
+// Xestia Address Book is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with Xestia Calendar. If not, see <http://www.gnu.org/licenses/>
+
+#include "XCCalendarMonthView.h"
+
+using namespace std;
+
+BEGIN_EVENT_TABLE(XCCalendarMonthView, wxFrame)
+EVT_PAINT(XCCalendarMonthView::PaintFrameEvent)
+END_EVENT_TABLE()
+
+XCCalendarMonthView::XCCalendarMonthView(const wxString& title, const wxPoint& pos, const wxSize& size, XCCalendarMonthViewGrid *grid)
+        : wxFrame(NULL, wxID_ANY, title, pos, size){
+       
+       MondayText = new XCCalendarMonthViewDayTitle(this, _("Monday"), wxDefaultPosition, wxDefaultSize);
+       TuesdayText = new XCCalendarMonthViewDayTitle(this, _("Tuesday"), wxDefaultPosition, wxDefaultSize);
+       WednesdayText = new XCCalendarMonthViewDayTitle(this, _("Wednesday"), wxDefaultPosition, wxDefaultSize);
+       ThursdayText = new XCCalendarMonthViewDayTitle(this, _("Thursday"), wxDefaultPosition, wxDefaultSize);
+       FridayText = new XCCalendarMonthViewDayTitle(this, _("Friday"), wxDefaultPosition, wxDefaultSize);
+       SaturdayText = new XCCalendarMonthViewDayTitle(this, _("Saturday"), wxDefaultPosition, wxDefaultSize);
+       SundayText = new XCCalendarMonthViewDayTitle(this, _("Sunday"), wxDefaultPosition, wxDefaultSize);
+       
+       WindowSizer->Add(MondayText, 1, wxEXPAND|wxALL, 0);
+       WindowSizer->Add(TuesdayText, 1, wxEXPAND|wxALL, 0);
+       WindowSizer->Add(WednesdayText, 1, wxEXPAND|wxALL, 0);
+       WindowSizer->Add(ThursdayText, 1, wxEXPAND|wxALL, 0);
+       WindowSizer->Add(FridayText, 1, wxEXPAND|wxALL, 0);
+       WindowSizer->Add(SaturdayText, 1, wxEXPAND|wxALL, 0);   
+       WindowSizer->Add(SundayText, 1, wxEXPAND|wxALL, 0);
+       
+       ProcessGrid(grid);
+       
+       // Setup the days.
+       
+       // Setup the growable rows and columns.
+       
+       WindowSizer->AddGrowableCol(0);
+       WindowSizer->AddGrowableCol(1);
+       WindowSizer->AddGrowableCol(2);
+       WindowSizer->AddGrowableCol(3);
+       WindowSizer->AddGrowableCol(4);
+       WindowSizer->AddGrowableCol(5); 
+       WindowSizer->AddGrowableCol(6);
+       WindowSizer->AddGrowableRow(1);
+       WindowSizer->AddGrowableRow(2);
+       WindowSizer->AddGrowableRow(3);
+       WindowSizer->AddGrowableRow(4);
+       WindowSizer->AddGrowableRow(5);
+       WindowSizer->SetFlexibleDirection( wxBOTH );
+       WindowSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
+       
+       this->SetSizer(WindowSizer);
+       WindowSizer->Fit(this);
+       this->Layout();
+       this->SetBackgroundColour(wxColour(0,0,0));
+       
+}
+
+XCCalendarMonthView::~XCCalendarMonthView(){
+       
+       
+       
+}
+
+void XCCalendarMonthView::ProcessGrid(XCCalendarMonthViewGrid *grid){
+       
+       // TODO: Delete the old calendar entries.
+       
+       // Add the new calendar entries.
+       
+       for (vector<XCCalendarMonthViewGridDayWeek>::iterator WeekIter = grid->WeekList.begin();
+               WeekIter != grid->WeekList.end(); WeekIter++){
+               
+               for (vector<XCCalendarMonthViewGridDayData>::iterator DayIter = (*WeekIter).DayList.begin();
+                       DayIter != (*WeekIter).DayList.end(); DayIter++){
+                               
+                       // TODO: Add CalendarEntries.
+                               
+                       XCCalendarDay *CalendarDayItem = new XCCalendarDay(this, "XCCalendarMonthView Test", wxPoint(50, 50), wxSize(200, 200));
+                               
+                       // Setup the control.
+                               
+                       CalendarDayItem->SetupControl((*DayIter).Day, (*DayIter).Month, (*DayIter).Year, (*DayIter).IsInMonth);
+                               
+                       CalendarDayList.push_back(CalendarDayItem);
+                       WindowSizer->Add(CalendarDayItem, 1, wxEXPAND, 5);
+                               
+               }
+                       
+       }
+       
+}
+
+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,
+       // switch to the small block mode.
+       
+       // Refresh the window.
+       
+       this->Refresh();
+       
+}
\ No newline at end of file
diff --git a/source/widgets/XCCalendarMonthView.h b/source/widgets/XCCalendarMonthView.h
new file mode 100644 (file)
index 0000000..f81fa17
--- /dev/null
@@ -0,0 +1,63 @@
+// XCCalendarDayEntry.cpp - Xestia Calendar XCCalendarMonthView widget class.
+//
+// (c) 2016 Xestia Software Development.
+//
+// This file is part of Xestia Calendar.
+//
+// Xestia Address Book is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by the
+// Free Software Foundation, version 3 of the license.
+//
+// Xestia Address Book is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with Xestia Calendar. If not, see <http://www.gnu.org/licenses/>
+
+#ifndef __WIDGETS_XCCALENDARMONTHVIEW_H__
+#define __WIDGETS_XCCALENDARMONTHVIEW_H__
+
+#include <vector>
+#include <wx/wx.h>
+
+#include "../common/colour.h"
+#include "../common/text.h"
+#include "../common/events.h"
+#include "../common/monthviewgen.h"
+
+#include "XCCalendarMonthView.h"
+#include "XCCalendarMonthViewDayTitle.h"
+#include "XCCalendarDay.h"
+
+class XCCalendarMonthView: public wxFrame
+{
+       
+       private:
+               wxFlexGridSizer *WindowSizer = new wxFlexGridSizer(0, 7, 1, 1);
+               vector<XCCalendarDay*> CalendarDayList;
+               wxStaticText *NumberText = nullptr;
+               XCCalendarMonthViewDayTitle *MondayText = nullptr;
+               XCCalendarMonthViewDayTitle *TuesdayText = nullptr;
+               XCCalendarMonthViewDayTitle *WednesdayText = nullptr;
+               XCCalendarMonthViewDayTitle *ThursdayText = nullptr;
+               XCCalendarMonthViewDayTitle *FridayText = nullptr;
+               XCCalendarMonthViewDayTitle *SaturdayText = nullptr;
+               XCCalendarMonthViewDayTitle *SundayText = nullptr;
+               void ProcessGrid(XCCalendarMonthViewGrid *grid);
+       
+               void Repaint();
+       
+       public:
+               XCCalendarMonthView(const wxString& title, const wxPoint& pos, const wxSize& size, XCCalendarMonthViewGrid *grid);
+               ~XCCalendarMonthView();
+       
+               void PaintFrameEvent(wxPaintEvent &PaintEvent);
+               void ResizeFrameEvent(wxSizeEvent &SizeEvent);
+       
+       DECLARE_EVENT_TABLE()
+       
+};
+
+#endif
\ 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