+
+ if ( !HasFlag(wxCAL_SEQUENTIAL_MONTH_SELECTION) )
+ {
+ delete m_comboMonth;
+ delete m_staticMonth;
+ delete m_spinYear;
+ delete m_staticYear;
+ }
+}
+
+void wxCalendarCtrl::SetWindowStyleFlag(long style)
+{
+ // changing this style doesn't work because the controls are not
+ // created/shown/hidden accordingly
+ wxASSERT_MSG( (style & wxCAL_SEQUENTIAL_MONTH_SELECTION) ==
+ (m_windowStyle & wxCAL_SEQUENTIAL_MONTH_SELECTION),
+ _T("wxCAL_SEQUENTIAL_MONTH_SELECTION can't be changed after creation") );
+
+ wxControl::SetWindowStyleFlag(style);
+}
+
+// ----------------------------------------------------------------------------
+// Create the wxComboBox and wxSpinCtrl
+// ----------------------------------------------------------------------------
+
+void wxCalendarCtrl::CreateMonthComboBox()
+{
+ m_comboMonth = new wxComboBox(GetParent(), wxID_ANY,
+ wxEmptyString,
+ wxDefaultPosition,
+ wxDefaultSize,
+ 0, NULL,
+ wxCB_READONLY | wxCLIP_SIBLINGS);
+
+ wxDateTime::Month m;
+ for ( m = wxDateTime::Jan; m < wxDateTime::Inv_Month; wxNextMonth(m) )
+ {
+ m_comboMonth->Append(wxDateTime::GetMonthName(m));
+ }
+
+ m_comboMonth->SetSelection(GetDate().GetMonth());
+ m_comboMonth->SetSize(wxDefaultCoord,
+ wxDefaultCoord,
+ wxDefaultCoord,
+ wxDefaultCoord,
+ wxSIZE_AUTO_WIDTH|wxSIZE_AUTO_HEIGHT);
+
+ m_comboMonth->Connect(wxEVT_COMMAND_COMBOBOX_SELECTED,
+ wxCommandEventHandler(wxCalendarCtrl::OnMonthChange),
+ NULL, this);
+}
+
+void wxCalendarCtrl::CreateYearSpinCtrl()
+{
+ m_spinYear = new wxSpinCtrl(GetParent(), wxID_ANY,
+ GetDate().Format(_T("%Y")),
+ wxDefaultPosition,
+ wxDefaultSize,
+ wxSP_ARROW_KEYS | wxCLIP_SIBLINGS,
+ -4300, 10000, GetDate().GetYear());
+
+ m_spinYear->Connect(wxEVT_COMMAND_TEXT_UPDATED,
+ wxCommandEventHandler(wxCalendarCtrl::OnYearTextChange),
+ NULL, this);
+
+ m_spinYear->Connect(wxEVT_COMMAND_SPINCTRL_UPDATED,
+ wxCommandEventHandler(wxCalendarCtrl::OnYearChange),
+ NULL, this);