Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Updated widgets
[xestiacalendar/.git] / source / widgets / XCCalendarManipulator.cpp
index 9268d61..7337a71 100644 (file)
@@ -23,7 +23,8 @@ END_EVENT_TABLE()
 
 using namespace std;
 
-XCCalendarManipulator::XCCalendarManipulator(wxWindow* parent, const wxString& title, const wxPoint& pos, const wxSize& size)
+XCCalendarManipulator::XCCalendarManipulator(wxWindow* parent, const wxString& title, 
+       const wxPoint& pos, const wxSize& size, CalendarDataStorage *dataStorage)
         : wxPanel(parent, wxID_ANY, pos, size, wxTAB_TRAVERSAL, title){
        
        szrMain = new wxBoxSizer( wxVERTICAL );
@@ -31,7 +32,7 @@ XCCalendarManipulator::XCCalendarManipulator(wxWindow* parent, const wxString& t
        pnlMain->SetBackgroundColour(wxColour(40,40,40));
        this->SetSizer(szrMain);
        szrMain->Add(pnlMain, 0, wxEXPAND, 0);
-               
+       
        // Setup the navigation section.
                
        szrNavigation = new wxBoxSizer( wxHORIZONTAL );
@@ -41,22 +42,28 @@ XCCalendarManipulator::XCCalendarManipulator(wxWindow* parent, const wxString& t
                
        PreviousButton = new wxButton(pnlMain, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(32,32), 0|wxNO_BORDER);
        NextButton = new wxButton(pnlMain, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(32,32), 0|wxNO_BORDER);
+       CalendarsButton = new wxButton(pnlMain, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(32,32), 0|wxNO_BORDER);
        
        wxMemoryInputStream PreviousIcon(icons_previous_png, sizeof(icons_previous_png));
        wxMemoryInputStream NextIcon(icons_next_png, sizeof(icons_next_png));
+       wxMemoryInputStream CalendarsIcon(icons_calendars_png, sizeof(icons_calendars_png));
                
        wxImage icons_previous_png(PreviousIcon, wxBITMAP_TYPE_PNG);
        PreviousIconBitmap = wxBitmap(icons_previous_png, -1);
 
        wxImage icons_next_png(NextIcon, wxBITMAP_TYPE_PNG);
        NextIconBitmap = wxBitmap(icons_next_png, -1);
-               
+
+       wxImage icons_calendars_png(CalendarsIcon, wxBITMAP_TYPE_PNG);
+       CalendarsIconBitmap = wxBitmap(icons_calendars_png, -1);
+
        PreviousButton->SetBitmap(PreviousIconBitmap);
        NextButton->SetBitmap(NextIconBitmap);
+       CalendarsButton->SetBitmap(CalendarsIconBitmap);
                
        // Setup the static text.
                
-       DateButton = new wxButton(pnlMain, wxID_ANY, _("November 2016"), wxDefaultPosition, wxDefaultSize, 0|wxNO_BORDER);
+       DateButton = new wxButton(pnlMain, wxID_ANY, wxT(""), wxDefaultPosition, wxDefaultSize, 0|wxNO_BORDER);
                
        wxFont Test;
        
@@ -70,6 +77,7 @@ XCCalendarManipulator::XCCalendarManipulator(wxWindow* parent, const wxString& t
 
        DateButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(XCCalendarManipulator::DateTextClick), NULL, this);
        NextButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(XCCalendarManipulator::NextMonth), NULL, this);
+       CalendarsButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(XCCalendarManipulator::ShowCalendarsList), NULL, this);
        PreviousButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(XCCalendarManipulator::PreviousMonth), NULL, this);
        
        Connect(wxID_ANY, XCCALENDARMANIPULATOR_CHANGEGRID, wxCommandEventHandler(XCCalendarManipulator::ChangeGrid));
@@ -77,6 +85,7 @@ XCCalendarManipulator::XCCalendarManipulator(wxWindow* parent, const wxString& t
        // Setup the manipulator control.
 
        szrNavigation->Add(PreviousButton, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5);
+       szrNavigation->Add(CalendarsButton, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5);
        szrNavigation->Add( 0, 0, 1, wxEXPAND, 5 );
        szrNavigation->Add(DateButton, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
        szrNavigation->Add( 0, 0, 1, wxEXPAND, 5 );
@@ -91,6 +100,15 @@ XCCalendarManipulator::XCCalendarManipulator(wxWindow* parent, const wxString& t
        Month = ((int)DTNow.GetMonth() + 1);
        Year = DTNow.GetYear();
        Moo->UpdateDate(Month, Year);
+       UpdateDateButtonText();
+       
+       // Setup the calendars list.
+       
+       calendarList = new XCCalendarList(this);
+       
+       // Setup the calendar data storage pointer.
+       
+       this->dataStorage = dataStorage;
                
 }
 
@@ -190,6 +208,16 @@ void XCCalendarManipulator::PreviousMonth(wxCommandEvent &event){
        
 }
 
+void XCCalendarManipulator::ShowCalendarsList(wxCommandEvent &event){
+       
+       // Update the list of calendars before showing.
+       
+       calendarList->SetPosition(wxPoint(CalendarsButton->GetScreenRect().GetLeft(), CalendarsButton->GetScreenRect().GetBottom()));
+       calendarList->UpdateCalendarList(dataStorage);
+       calendarList->Popup();
+       
+}
+
 void XCCalendarManipulator::UpdateDateButtonText(){
        
        // Update the date text.
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