1 // frmCalendarSelectMonth.cpp - Xestia Calendar frmCalendarSelectMonth form
3 // (c) 2016-2017 Xestia Software Development.
5 // This file is part of Xestia Calendar.
7 // Xestia Address Book is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
11 // Xestia Address Book is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Calendar. If not, see <http://www.gnu.org/licenses/>
19 #include "frmCalendarSelectMonth.h"
21 frmCalendarSelectMonth::frmCalendarSelectMonth(wxWindow *parent)
22 : wxDialog(parent, wxID_ANY, _("Select Month"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL, "") /* wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, "") */ {
24 // Setup the main sizer.
26 szrMain = new wxBoxSizer(wxHORIZONTAL);
27 this->SetSizer(szrMain);
29 this->SetMinSize(wxSize(255, 80));
30 this->SetSize(wxSize(255, 80));
32 this->SetMinSize(wxSize(255, 40));
33 this->SetSize(wxSize(255, 40));
36 // Setup the month selection control.
38 cmbMonth = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize);
40 cmbMonth->Append(_("January"));
41 cmbMonth->Append(_("February"));
42 cmbMonth->Append(_("March"));
43 cmbMonth->Append(_("April"));
44 cmbMonth->Append(_("May"));
45 cmbMonth->Append(_("June"));
46 cmbMonth->Append(_("July"));
47 cmbMonth->Append(_("August"));
48 cmbMonth->Append(_("September"));
49 cmbMonth->Append(_("October"));
50 cmbMonth->Append(_("November"));
51 cmbMonth->Append(_("December"));
53 szrMain->Add(cmbMonth, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
55 // Setup the year selection control.
57 spcYear = new wxSpinCtrl(this, wxID_ANY, _(""), wxDefaultPosition, wxSize(50, -1), wxSP_ARROW_KEYS, 0, 9999, 2016);
58 szrMain->Add(spcYear, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
60 // Setup the Change button.
62 btnChange = new wxButton(this, wxID_ANY, _("Change"), wxDefaultPosition, wxDefaultSize);
63 szrMain->Add(btnChange, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
67 btnChange->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(frmCalendarSelectMonth::UpdateMonthView), NULL, this);
72 frmCalendarSelectMonth::~frmCalendarSelectMonth() {
78 void frmCalendarSelectMonth::UpdateDate(int Month, int Year) {
80 cmbMonth->SetSelection((Month - 1));
81 spcYear->SetValue(Year);
85 void frmCalendarSelectMonth::UpdateMonthView(wxCommandEvent &event) {
87 // Post an event back to the parent updating the calendar
88 // with the new month.
91 wxCommandEvent UpdateGrid(XCCALENDARMANIPULATOR_CHANGEGRID);
92 UpdateGrid.SetId(ID_CHANGEGRID);
93 wxPostEvent(this->GetParent(), UpdateGrid);
97 int frmCalendarSelectMonth::GetMonth() {
99 return (cmbMonth->GetSelection() + 1);
103 int frmCalendarSelectMonth::GetYear() {
105 return spcYear->GetValue();