X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/58e041b75320b509fe01cfb9d7057990e4a60f04..7ea1c917764fb2588fe1aadc75c49ba300f8cb2f:/src/generic/datectlg.cpp diff --git a/src/generic/datectlg.cpp b/src/generic/datectlg.cpp index 299aec46f7..abcbacf408 100644 --- a/src/generic/datectlg.cpp +++ b/src/generic/datectlg.cpp @@ -29,7 +29,8 @@ // use this version if we're explicitly requested to do it or if it's the only // one we have -#if wxUSE_DATEPICKCTRL_GENERIC || !defined(wxHAS_NATIVE_DATEPICKCTRL) +#if !defined(wxHAS_NATIVE_DATEPICKCTRL) || \ + (defined(wxUSE_DATEPICKCTRL_GENERIC) && wxUSE_DATEPICKCTRL_GENERIC) #ifndef WX_PRECOMP #include "wx/bmpbuttn.h" @@ -127,9 +128,8 @@ public: long style = 0, const wxValidator& validator = wxDefaultValidator); - virtual void DoMoveWindow(int x, int y, int w, int h); - protected: + virtual void DoMoveWindow(int x, int y, int w, int h); void OnSize(wxSizeEvent& event); void OnMouseEnter(wxMouseEvent& event); @@ -632,14 +632,14 @@ wxDatePickerCtrlGeneric::SetDateRange(const wxDateTime& lowerdate, bool wxDatePickerCtrlGeneric::SetFormat(const wxChar *fmt) { + m_format.clear(); + wxDateTime dt; dt.ParseFormat(wxT("2003-10-13"), wxT("%Y-%m-%d")); - wxString str=dt.Format(fmt); - wxChar *p=(wxChar*)str.c_str(); - - m_format=wxEmptyString; + wxString str(dt.Format(fmt)); - while (*p) + const wxChar *p = str.c_str(); + while ( *p ) { int n=wxAtoi(p); if (n == dt.GetDay()) @@ -669,19 +669,19 @@ bool wxDatePickerCtrlGeneric::SetFormat(const wxChar *fmt) m_format.Append(*p++); } - if (m_txt) + if ( m_txt ) { wxArrayString allowedChars; for ( wxChar c = _T('0'); c <= _T('9'); c++ ) allowedChars.Add(wxString(c, 1)); - const wxChar *p = m_format.c_str(); - while (*p) + const wxChar *p2 = m_format.c_str(); + while ( *p2 ) { - if (*p == '%') - p += 2; + if ( *p2 == '%') + p2 += 2; else - allowedChars.Add(wxString(*p++, 1)); + allowedChars.Add(wxString(*p2++, 1)); } #if wxUSE_VALIDATORS