From: Steve Brokenshire Date: Sun, 25 Dec 2016 01:25:02 +0000 (+0000) Subject: Added new widgets X-Git-Tag: release-0.02~74 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=339434b90a0a03c3102b82a5dc45334b338bc59c;p=xestiacalendar%2F.git Added new widgets Added XCCalendarList, XCCalendarListAccountCtrl and XCCalendarListCalendarCtrl widgets. --- diff --git a/source/widgets/XCCalendarList.cpp b/source/widgets/XCCalendarList.cpp new file mode 100644 index 0000000..62efb9c --- /dev/null +++ b/source/widgets/XCCalendarList.cpp @@ -0,0 +1,81 @@ +// 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 + +#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 diff --git a/source/widgets/XCCalendarList.h b/source/widgets/XCCalendarList.h new file mode 100644 index 0000000..7dbb093 --- /dev/null +++ b/source/widgets/XCCalendarList.h @@ -0,0 +1,54 @@ +// 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 + +#ifndef __WIDGETS_XCCALENDARLIST_H__ +#define __WIDGETS_XCCALENDARLIST_H__ + +#include +#include + +#include +#include +#include +#include + +#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 accountControlList; + protected: + + public: + XCCalendarList(wxWindow *parent); + void UpdateCalendarList(CalendarDataStorage *dataStorage); + ~XCCalendarList(); + +}; + +#endif + diff --git a/source/widgets/XCCalendarListAccountCtrl.cpp b/source/widgets/XCCalendarListAccountCtrl.cpp new file mode 100644 index 0000000..7ae30f8 --- /dev/null +++ b/source/widgets/XCCalendarListAccountCtrl.cpp @@ -0,0 +1,68 @@ +// 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 + +#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 diff --git a/source/widgets/XCCalendarListAccountCtrl.h b/source/widgets/XCCalendarListAccountCtrl.h new file mode 100644 index 0000000..ae94b6e --- /dev/null +++ b/source/widgets/XCCalendarListAccountCtrl.h @@ -0,0 +1,50 @@ +// 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 + +#ifndef __WIDGETS_XCCALENDARLISTACCOUNTCTRL_H__ +#define __WIDGETS_XCCALENDARLISTACCOUNTCTRL_H__ + +#include +#include +#include + +#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 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 diff --git a/source/widgets/XCCalendarListCalendarCtrl.cpp b/source/widgets/XCCalendarListCalendarCtrl.cpp new file mode 100644 index 0000000..bdf1b6a --- /dev/null +++ b/source/widgets/XCCalendarListCalendarCtrl.cpp @@ -0,0 +1,59 @@ +// 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 + +#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. + +} diff --git a/source/widgets/XCCalendarListCalendarCtrl.h b/source/widgets/XCCalendarListCalendarCtrl.h new file mode 100644 index 0000000..9df84cd --- /dev/null +++ b/source/widgets/XCCalendarListCalendarCtrl.h @@ -0,0 +1,47 @@ +// 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 + +#ifndef __WIDGETS_XCCALENDARLISTCALENDARCTRL_H__ +#define __WIDGETS_XCCALENDARLISTCALENDARCTRL_H__ + +#include +#include +#include + +#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