From c6b44b6c88d56d20de914d7f708020bf9372d0f8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 28 Jun 2008 18:58:07 +0000 Subject: [PATCH] support wxDP_ALLOWNONE in generic wxDatePickerCtrl (#3164) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@54407 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + src/generic/datectlg.cpp | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/docs/changes.txt b/docs/changes.txt index 2898dc4588..c7d995f499 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -100,6 +100,7 @@ All (GUI): help window. - Fixed wxHTML default font size for printing to be 12pt regardless of the platform, instead of depending on GUI toolkit's screen configuration. +- Support wxDP_ALLOWNONE style in generic wxDatePickerCtrl version. All (Unix): diff --git a/src/generic/datectlg.cpp b/src/generic/datectlg.cpp index a898b9eea3..48f98569ed 100644 --- a/src/generic/datectlg.cpp +++ b/src/generic/datectlg.cpp @@ -169,6 +169,11 @@ public: } } + bool IsTextEmpty() const + { + return m_combo->GetTextCtrl()->IsEmpty(); + } + bool ParseDateTime(const wxString& s, wxDateTime* pDt) { wxASSERT(pDt); @@ -470,6 +475,8 @@ wxDatePickerCtrlGeneric::SetDateRange(const wxDateTime& lowerdate, wxDateTime wxDatePickerCtrlGeneric::GetValue() const { + if ( HasFlag(wxDP_ALLOWNONE) && m_popup->IsTextEmpty() ) + return wxInvalidDateTime; return m_popup->GetDate(); }