#include "XCCalendarCtrl.h"
+BEGIN_EVENT_TABLE(XCCalendarCtrl, wxPanel)
+END_EVENT_TABLE()
+
using namespace std;
XCCalendarCtrl::XCCalendarCtrl(wxWindow *parent, CalendarDataStorage *dataStorage)
: wxPanel (parent, wxID_ANY, wxDefaultPosition, wxDefaultSize){
+ // Setup the pointers.
+
+ calendarStorage = dataStorage;
+
// Setup the main sizer.
szrMain = new wxFlexGridSizer(2, 1, 0, 0);
// Setup the top menu.
- ManipulatorCtrl = new XCCalendarManipulator(this, "XCCalendarManipulator Test", wxDefaultPosition, wxDefaultSize, dataStorage);
+ ManipulatorCtrl = new XCCalendarManipulator(this, "XCCalendarManipulator Test", wxDefaultPosition, wxDefaultSize, calendarStorage);
// Setup the month view grid.
- XCCalendarMonthViewGrid CurrentMonthGrid = GenerateMonthGrid(11, 2016);
+ wxDateTime DTNow = wxDateTime::Now();
+ int currentMonth = ((int)DTNow.GetMonth() + 1);
+ int currentYear = DTNow.GetYear();
+
+ XCCalendarMonthViewGrid CurrentMonthGrid = GenerateMonthGrid(currentMonth, currentYear);
szrMain->Add(ManipulatorCtrl, 1, wxEXPAND, 5);
- MonthViewCtrl = new XCCalendarMonthView(this, "XCCalendarMonthView Test", wxDefaultPosition, wxDefaultSize, &CurrentMonthGrid);
+ MonthViewCtrl = new XCCalendarMonthView(this, "XCCalendarMonthView Test", wxDefaultPosition, wxDefaultSize, &CurrentMonthGrid, calendarStorage);
szrMain->Add(MonthViewCtrl, 1, wxEXPAND, 5);
Connect(wxID_ANY, XCCALENDARCTRL_CHANGEGRID, wxCommandEventHandler(XCCalendarCtrl::UpdateGrid));
// Create a new grid.
XCCalendarMonthViewGrid NewGrid = GenerateMonthGrid(ManipulatorCtrl->GetMonth(), ManipulatorCtrl->GetYear());
- MonthViewCtrl = new XCCalendarMonthView(this, _(""), wxDefaultPosition, wxDefaultSize, &NewGrid);
+ MonthViewCtrl = new XCCalendarMonthView(this, _(""), wxDefaultPosition, wxDefaultSize, &NewGrid, calendarStorage);
// Detach the old grid and attach the new one.