// frmCalendarSelectMonth.cpp - Xestia Calendar frmCalendarSelectMonth form // // (c) 2016-2017 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 "frmCalendarSelectMonth.h" frmCalendarSelectMonth::frmCalendarSelectMonth(wxWindow *parent) : wxDialog(parent, wxID_ANY, _("Select Month"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL, "") /* wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, "") */ { // Setup the main sizer. szrMain = new wxBoxSizer(wxHORIZONTAL); this->SetSizer(szrMain); #if defined(WIN32) this->SetMinSize(wxSize(255, 80)); this->SetSize(wxSize(255, 80)); #else this->SetMinSize(wxSize(255, 40)); this->SetSize(wxSize(255, 40)); #endif // Setup the month selection control. cmbMonth = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize); cmbMonth->Append(_("January")); cmbMonth->Append(_("February")); cmbMonth->Append(_("March")); cmbMonth->Append(_("April")); cmbMonth->Append(_("May")); cmbMonth->Append(_("June")); cmbMonth->Append(_("July")); cmbMonth->Append(_("August")); cmbMonth->Append(_("September")); cmbMonth->Append(_("October")); cmbMonth->Append(_("November")); cmbMonth->Append(_("December")); szrMain->Add(cmbMonth, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); // Setup the year selection control. spcYear = new wxSpinCtrl(this, wxID_ANY, _(""), wxDefaultPosition, wxSize(50, -1), wxSP_ARROW_KEYS, 0, 9999, 2016); szrMain->Add(spcYear, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); // Setup the Change button. btnChange = new wxButton(this, wxID_ANY, _("Change"), wxDefaultPosition, wxDefaultSize); szrMain->Add(btnChange, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5); // Setup the events. btnChange->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(frmCalendarSelectMonth::UpdateMonthView), NULL, this); this->Layout(); } frmCalendarSelectMonth::~frmCalendarSelectMonth() { } void frmCalendarSelectMonth::UpdateDate(int Month, int Year) { cmbMonth->SetSelection((Month - 1)); spcYear->SetValue(Year); } void frmCalendarSelectMonth::UpdateMonthView(wxCommandEvent &event) { // Post an event back to the parent updating the calendar // with the new month. this->Close(); wxCommandEvent UpdateGrid(XCCALENDARMANIPULATOR_CHANGEGRID); UpdateGrid.SetId(ID_CHANGEGRID); wxPostEvent(this->GetParent(), UpdateGrid); } int frmCalendarSelectMonth::GetMonth() { return (cmbMonth->GetSelection() + 1); } int frmCalendarSelectMonth::GetYear() { return spcYear->GetValue(); }