Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added new widgets
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 25 Dec 2016 01:25:02 +0000 (01:25 +0000)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 25 Dec 2016 01:25:02 +0000 (01:25 +0000)
Added XCCalendarList, XCCalendarListAccountCtrl and
XCCalendarListCalendarCtrl widgets.

source/widgets/XCCalendarList.cpp [new file with mode: 0644]
source/widgets/XCCalendarList.h [new file with mode: 0644]
source/widgets/XCCalendarListAccountCtrl.cpp [new file with mode: 0644]
source/widgets/XCCalendarListAccountCtrl.h [new file with mode: 0644]
source/widgets/XCCalendarListCalendarCtrl.cpp [new file with mode: 0644]
source/widgets/XCCalendarListCalendarCtrl.h [new file with mode: 0644]

diff --git a/source/widgets/XCCalendarList.cpp b/source/widgets/XCCalendarList.cpp
new file mode 100644 (file)
index 0000000..62efb9c
--- /dev/null
@@ -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 <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
diff --git a/source/widgets/XCCalendarList.h b/source/widgets/XCCalendarList.h
new file mode 100644 (file)
index 0000000..7dbb093
--- /dev/null
@@ -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 <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
diff --git a/source/widgets/XCCalendarListAccountCtrl.cpp b/source/widgets/XCCalendarListAccountCtrl.cpp
new file mode 100644 (file)
index 0000000..7ae30f8
--- /dev/null
@@ -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 <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
diff --git a/source/widgets/XCCalendarListAccountCtrl.h b/source/widgets/XCCalendarListAccountCtrl.h
new file mode 100644 (file)
index 0000000..ae94b6e
--- /dev/null
@@ -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 <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
diff --git a/source/widgets/XCCalendarListCalendarCtrl.cpp b/source/widgets/XCCalendarListCalendarCtrl.cpp
new file mode 100644 (file)
index 0000000..bdf1b6a
--- /dev/null
@@ -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 <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.
+       
+}
diff --git a/source/widgets/XCCalendarListCalendarCtrl.h b/source/widgets/XCCalendarListCalendarCtrl.h
new file mode 100644 (file)
index 0000000..9df84cd
--- /dev/null
@@ -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 <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
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