+// ----------------------------------------------------------------------------
+// enable/disable month/year controls
+// ----------------------------------------------------------------------------
+
+void wxCalendarCtrl::ShowCurrentControls()
+{
+ if ( AllowMonthChange() )
+ {
+ m_comboMonth->Show();
+ m_staticMonth->Hide();
+
+ if ( AllowYearChange() )
+ {
+ m_spinYear->Show();
+ m_staticYear->Hide();
+
+ // skip the rest
+ return;
+ }
+ }
+ else
+ {
+ m_comboMonth->Hide();
+ m_staticMonth->Show();
+ }
+
+ // year change not allowed here
+ m_spinYear->Hide();
+ m_staticYear->Show();
+}
+
+wxControl *wxCalendarCtrl::GetMonthControl() const
+{
+ return AllowMonthChange() ? (wxControl *)m_comboMonth : (wxControl *)m_staticMonth;
+}
+
+wxControl *wxCalendarCtrl::GetYearControl() const
+{
+ return AllowYearChange() ? (wxControl *)m_spinYear : (wxControl *)m_staticYear;
+}
+
+void wxCalendarCtrl::EnableYearChange(bool enable)
+{
+ if ( enable != AllowYearChange() )
+ {
+ long style = GetWindowStyle();
+ if ( enable )
+ style &= ~wxCAL_NO_YEAR_CHANGE;
+ else
+ style |= wxCAL_NO_YEAR_CHANGE;
+ SetWindowStyle(style);
+
+ ShowCurrentControls();
+ }
+}
+
+void wxCalendarCtrl::EnableMonthChange(bool enable)
+{
+ if ( enable != AllowMonthChange() )
+ {
+ long style = GetWindowStyle();
+ if ( enable )
+ style &= ~wxCAL_NO_MONTH_CHANGE;
+ else
+ style |= wxCAL_NO_MONTH_CHANGE;
+ SetWindowStyle(style);
+
+ ShowCurrentControls();
+ }
+}
+