--- /dev/null
+// XCCalendarList.cpp - Xestia Calendar XCCalendarList 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 "XCCalendarList.h"
+
+XCCalendarList::XCCalendarList(wxWindow *parent)
+ : wxPopupTransientWindow (parent){
+
+ // Setup the controls.
+
+ szrMain = new wxBoxSizer( wxVERTICAL );
+ this->SetSizer(szrMain);
+ this->SetSize(wxSize(350, 500));
+
+ //scwMain = new wxScrolledWindow();
+
+ //szrScrolled = new wxBoxSizer( wxHORIZONTAL );
+ //scwMain->SetSizer(szrScrolled);
+
+ //szrMain->Add(scwMain, 0, wxEXPAND, 5);
+ //szrMain->Layout();
+
+
+}
+
+XCCalendarList::~XCCalendarList(){
+
+}
+
+void XCCalendarList::UpdateCalendarList(CalendarDataStorage *dataStorage){
+
+ // TODO: Verify if the generated code has changed.
+
+ // Get the list of accounts and create them one by one.
+
+ CDSAccountList accountListData = dataStorage->GetAccountList();
+
+ for (int AccountSeek = 0; AccountSeek < accountListData.accountList.size(); AccountSeek++){
+
+ // Create the control and add it to the list.
+
+ XCCalendarListAccountCtrl *newAccountCtrl = new XCCalendarListAccountCtrl(this, accountListData.accountList[AccountSeek].accountName);
+
+ szrMain->Add(newAccountCtrl, 0, wxEXPAND, 5);
+
+ accountControlList.push_back(newAccountCtrl);
+
+ // Get the list of calendars and create controls.
+
+ CDSCalendarList accountCalendarList = dataStorage->GetCalendarList(accountListData.accountList[AccountSeek].accountID);
+
+ for (int calendarSeek = 0; calendarSeek < accountCalendarList.calendarList.size(); calendarSeek++){
+
+ CDSGetCalendarInfo calendarInfo = dataStorage->GetCalendar(accountListData.accountList[AccountSeek].accountName, accountCalendarList.calendarListTextID[calendarSeek]);
+
+ XCCalendarListCalendarCtrl *newCalendarCtrl = new XCCalendarListCalendarCtrl(this, calendarInfo.calendarName, calendarInfo.calendarColour);
+
+ newAccountCtrl->AddCalendar(newCalendarCtrl);
+
+ szrMain->Add(newCalendarCtrl, 0, wxEXPAND, 5);
+
+ }
+
+ }
+
+}
\ No newline at end of file
--- /dev/null
+// XCCalendarList.h - Xestia Calendar XCCalendarList header file.
+//
+// (c) 2016 Xestia Software Development.
+//
+// This file is part of Xestia Calendar.
+//
+// Xestia Calendar 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 Calendar 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_XCCALENDARLIST_H__
+#define __WIDGETS_XCCALENDARLIST_H__
+
+#include <string>
+#include <vector>
+
+#include <wx/wx.h>
+#include <wx/popupwin.h>
+#include <wx/spinctrl.h>
+#include <wx/scrolwin.h>
+
+#include "events.h"
+#include "../bitmaps.h"
+#include "../libraries/CalendarDataStorage/CalendarDataStorage.h"
+#include "XCCalendarListAccountCtrl.h"
+#include "XCCalendarListCalendarCtrl.h"
+
+class XCCalendarList: public wxPopupTransientWindow
+{
+
+ private:
+ wxBoxSizer *szrMain = nullptr;
+ wxScrolledWindow *scwMain = nullptr;
+ wxBoxSizer *szrScrolled = nullptr;
+ std::vector<XCCalendarListAccountCtrl*> accountControlList;
+ protected:
+
+ public:
+ XCCalendarList(wxWindow *parent);
+ void UpdateCalendarList(CalendarDataStorage *dataStorage);
+ ~XCCalendarList();
+
+};
+
+#endif
+
--- /dev/null
+// XCCalendarListAccountCtrl.cpp - XCCalendarListAccountCtrl class
+//
+// (c) 2016 Xestia Software Development.
+//
+// This file is part of Xestia Calendar.
+//
+// Xestia Calendar 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 Calendar 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 "XCCalendarListAccountCtrl.h"
+
+using namespace std;
+
+XCCalendarListAccountCtrl::XCCalendarListAccountCtrl(wxWindow* parent, string accountName) :
+ wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, ""){
+
+ // Create the sizer.
+
+ szrMain = new wxBoxSizer( wxHORIZONTAL );
+ this->SetSizer(szrMain);
+
+ // Setup the checkbox.
+
+ chkShowAll = new wxCheckBox(this, wxID_ANY, "", wxPoint(0,0), wxDefaultSize, wxCHK_3STATE, wxDefaultValidator, "");
+
+ // Setup the label.
+
+ lblAccountName = new wxStaticText(this, wxID_ANY, wxString(accountName), wxDefaultPosition, wxDefaultSize, 0, "");
+
+ // Setup the font.
+
+ wxFont accountFont = lblAccountName->GetFont();
+ accountFont.MakeBold();
+ lblAccountName->SetFont(accountFont);
+
+ // Connect them to the sizer.
+
+ szrMain->Add(chkShowAll, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5);
+ szrMain->Add(lblAccountName, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5);
+
+}
+
+XCCalendarListAccountCtrl::~XCCalendarListAccountCtrl(){
+
+ // Delete the calendar controls.
+
+}
+
+void XCCalendarListAccountCtrl::AddCalendar(XCCalendarListCalendarCtrl *calendarControl){
+
+ // Add the calendar control to the sizer.
+
+ //szrMain->Add(calendarControl, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5);
+
+ // Add the calendar control to the list.
+
+ calendarControlList.push_back(calendarControl);
+
+}
\ No newline at end of file
--- /dev/null
+// XCCalendarListAccountCtrl.h - XCCalendarListAccountCtrl class header
+//
+// (c) 2016 Xestia Software Development.
+//
+// This file is part of Xestia Calendar.
+//
+// Xestia Calendar 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 Calendar 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_XCCALENDARLISTACCOUNTCTRL_H__
+#define __WIDGETS_XCCALENDARLISTACCOUNTCTRL_H__
+
+#include <vector>
+#include <string>
+#include <wx/wx.h>
+
+#include "types.h"
+#include "colour.h"
+#include "XCCalendarListCalendarCtrl.h"
+
+class XCCalendarListAccountCtrl: public wxPanel{
+
+ private:
+ wxBoxSizer *szrMain = nullptr;
+ wxCheckBox *chkShowAll = nullptr;
+ wxStaticText *lblAccountName = nullptr;
+ wxStaticBitmap *imgAccountIcon = nullptr;
+ protected:
+ std::vector<XCCalendarListCalendarCtrl*> calendarControlList;
+ int accountID = 0;
+ AccountType accountType = ACCOUNTTYPE_UNKNOWN;
+ std::string accountName = "";
+ bool showAccounts = true;
+ public:
+ XCCalendarListAccountCtrl(wxWindow* parent, string accountName);
+ ~XCCalendarListAccountCtrl();
+ void AddCalendar(XCCalendarListCalendarCtrl *calendarControl);
+
+};
+
+#endif
\ No newline at end of file
--- /dev/null
+// XCCalendarListCalendarCtrl.cpp - XCCalendarListCalendarCtrl class
+//
+// (c) 2016 Xestia Software Development.
+//
+// This file is part of Xestia Calendar.
+//
+// Xestia Calendar 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 Calendar 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 "XCCalendarListCalendarCtrl.h"
+
+using namespace std;
+
+XCCalendarListCalendarCtrl::XCCalendarListCalendarCtrl(wxWindow* parent, string calendarName, Colour calendarColour) :
+ wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, ""){
+
+ // Create the sizer.
+
+ szrMain = new wxBoxSizer( wxHORIZONTAL );
+ this->SetSizer(szrMain);
+
+ // Setup the checkbox.
+
+ //chkShowAll = new wxCheckBox();
+
+ chkShowCalendar = new wxCheckBox(this, wxID_ANY, "", wxPoint(0,0), wxDefaultSize, wxCHK_3STATE, wxDefaultValidator, "");
+
+ // Setup the label.
+
+ lblCalendarName = new wxStaticText(this, wxID_ANY, wxString(calendarName), wxDefaultPosition, wxDefaultSize, 0, "");
+
+ // Setup the colour.
+
+ pnlColour = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(16,16), 0, "");
+ pnlColour->SetBackgroundColour(wxColour(calendarColour.red, calendarColour.green, calendarColour.blue, calendarColour.alpha));
+
+ // Connect them to the sizer.
+
+ szrMain->Add(15, 0, 0, 0, 5);
+ szrMain->Add(chkShowCalendar, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5);
+ szrMain->Add(lblCalendarName, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5);
+ szrMain->Add(pnlColour, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5);
+
+}
+
+XCCalendarListCalendarCtrl::~XCCalendarListCalendarCtrl(){
+
+ // Delete the controls.
+
+}
--- /dev/null
+// XCCalendarListCalendarCtrl.h - XCCalendarListCalendarCtrl class header
+//
+// (c) 2016 Xestia Software Development.
+//
+// This file is part of Xestia Calendar.
+//
+// Xestia Calendar 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 Calendar 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_XCCALENDARLISTCALENDARCTRL_H__
+#define __WIDGETS_XCCALENDARLISTCALENDARCTRL_H__
+
+#include <vector>
+#include <string>
+#include <wx/wx.h>
+
+#include "types.h"
+#include "colour.h"
+
+class XCCalendarListCalendarCtrl: public wxPanel{
+
+ private:
+ wxBoxSizer *szrMain = nullptr;
+ wxCheckBox *chkShowCalendar = nullptr;
+ wxStaticText *lblCalendarName = nullptr;
+ wxStaticBitmap *imgCalendarIcon = nullptr;
+ wxPanel *pnlColour = nullptr;
+ protected:
+ int calendarID = 0;
+ std::string calendarName = "";
+ bool showCalendar = true;
+ public:
+ XCCalendarListCalendarCtrl(wxWindow* parent, string calendarName, Colour calendarColour);
+ ~XCCalendarListCalendarCtrl();
+
+};
+
+#endif
\ No newline at end of file