X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e910c00040cb6dde54e9aca53847cb404d3a3f29..be7a101366995b7b7bb76e3d5b1e7dd8fc9a1af8:/src/generic/calctrl.cpp diff --git a/src/generic/calctrl.cpp b/src/generic/calctrl.cpp index 2965710e11..bf61e81405 100644 --- a/src/generic/calctrl.cpp +++ b/src/generic/calctrl.cpp @@ -6,7 +6,7 @@ // Created: 29.12.99 // RCS-ID: $Id$ // Copyright: (c) 1999 Vadim Zeitlin -// Licence: wxWindows license +// Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -68,7 +68,11 @@ class wxYearSpinCtrl : public wxSpinCtrl public: wxYearSpinCtrl(wxCalendarCtrl *cal); - void OnYearTextChange(wxCommandEvent& event) { m_cal->OnYearChange(event); } + void OnYearTextChange(wxCommandEvent& event) + { + m_cal->SetUserChangedYear(); + m_cal->OnYearChange(event); + } void OnYearChange(wxSpinEvent& event) { m_cal->OnYearChange(event); } private: @@ -449,8 +453,6 @@ bool wxCalendarCtrl::SetDate(const wxDateTime& date) { if ( !m_userChangedYear ) m_spinYear->SetValue(m_date.Format(_T("%Y"))); - else // don't overwrite what the user typed in - m_userChangedYear = FALSE; } } @@ -468,6 +470,8 @@ bool wxCalendarCtrl::SetDate(const wxDateTime& date) } } + m_userChangedYear = FALSE; + return retval; } @@ -895,7 +899,7 @@ void wxCalendarCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) dc.SetTextForeground(*wxBLACK); dc.SetBrush(wxBrush(m_colHeaderBg, wxSOLID)); dc.SetPen(wxPen(m_colHeaderBg, 1, wxSOLID)); - dc.DrawRectangle(0, y, 7*m_widthCol, m_heightRow); + dc.DrawRectangle(0, y, GetClientSize().x, m_heightRow); // Get extent of month-name + year wxCoord monthw, monthh; @@ -1569,10 +1573,6 @@ void wxCalendarCtrl::OnYearChange(wxCommandEvent& event) return; } - // set the flag for SetDate(): otherwise it would overwrite the year - // typed in by the user - m_userChangedYear = TRUE; - wxDateTime::Tm tm = m_date.GetTm(); if ( tm.mday > wxDateTime::GetNumberOfDays(tm.mon, year) )