X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6c70323fcbc6e1e58934647edcc14c95bcb4242c..740ebe19a46655afdf59c65698c7c32d328911e0:/src/generic/datectlg.cpp diff --git a/src/generic/datectlg.cpp b/src/generic/datectlg.cpp index 825b162617..0d67a6c6ec 100644 --- a/src/generic/datectlg.cpp +++ b/src/generic/datectlg.cpp @@ -110,12 +110,17 @@ public: else // invalid date { wxASSERT_MSG( HasDPFlag(wxDP_ALLOWNONE), - _T("this control must have a valid date") ); + wxT("this control must have a valid date") ); m_combo->SetText(wxEmptyString); } } + bool IsTextEmpty() const + { + return m_combo->GetTextCtrl()->IsEmpty(); + } + bool ParseDateTime(const wxString& s, wxDateTime* pDt) { wxASSERT(pDt); @@ -255,8 +260,8 @@ private: if (year_cnt == 1 && month_cnt == 1 && day_cnt == 1) return fmt; - else - return x_format; + + return x_format; } bool SetFormat(const wxString& fmt) @@ -266,7 +271,7 @@ private: if ( m_combo ) { wxArrayString allowedChars; - for ( wxChar c = _T('0'); c <= _T('9'); c++ ) + for ( wxChar c = wxT('0'); c <= wxT('9'); c++ ) allowedChars.Add(wxString(c, 1)); const wxChar *p2 = m_format.c_str(); @@ -359,7 +364,7 @@ bool wxDatePickerCtrlGeneric::Create(wxWindow *parent, const wxString& name) { wxASSERT_MSG( !(style & wxDP_SPIN), - _T("wxDP_SPIN style not supported, use wxDP_DEFAULT") ); + wxT("wxDP_SPIN style not supported, use wxDP_DEFAULT") ); if ( !wxControl::Create(parent, id, pos, size, style | wxCLIP_CHILDREN | wxWANTS_CHARS | wxBORDER_NONE, @@ -435,6 +440,8 @@ wxDatePickerCtrlGeneric::SetDateRange(const wxDateTime& lowerdate, wxDateTime wxDatePickerCtrlGeneric::GetValue() const { + if ( HasFlag(wxDP_ALLOWNONE) && m_popup->IsTextEmpty() ) + return wxInvalidDateTime; return m_popup->GetDate(); }