From: Vadim Zeitlin Date: Sun, 19 Nov 2006 14:44:30 +0000 (+0000) Subject: set/get validator for wxTextCtrl part of wxComboCtrl and not the combo itself (patch... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/670048b2f09d543de2ecba4800f2428fbad743e8 set/get validator for wxTextCtrl part of wxComboCtrl and not the combo itself (patch 1599214, closes bug 1598600) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43521 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/combo.h b/include/wx/combo.h index 886ea13a65..3d73052876 100644 --- a/include/wx/combo.h +++ b/include/wx/combo.h @@ -184,6 +184,10 @@ public: virtual bool Enable(bool enable = true); virtual bool Show(bool show = true); virtual bool SetFont(const wxFont& font); +#if wxUSE_VALIDATORS + virtual void SetValidator(const wxValidator &validator); + virtual wxValidator *GetValidator(); +#endif // wxUSE_VALIDATORS // wxTextCtrl methods - for readonly combo they should return // without errors. diff --git a/src/common/combocmn.cpp b/src/common/combocmn.cpp index a633163d30..637c30952b 100644 --- a/src/common/combocmn.cpp +++ b/src/common/combocmn.cpp @@ -1149,6 +1149,26 @@ void wxComboCtrlBase::DoSetToolTip(wxToolTip *tooltip) } #endif // wxUSE_TOOLTIPS +#if wxUSE_VALIDATORS +void wxComboCtrlBase::SetValidator(const wxValidator& validator) +{ + wxTextCtrl* textCtrl = GetTextCtrl(); + + if ( textCtrl ) + textCtrl->SetValidator( validator ); +} + +wxValidator* wxComboCtrlBase::GetValidator() +{ + wxTextCtrl* textCtrl = GetTextCtrl(); + + if ( textCtrl ) + return textCtrl->GetValidator(); + + return wxControl::GetValidator(); +} +#endif // wxUSE_VALIDATORS + // ---------------------------------------------------------------------------- // painting // ----------------------------------------------------------------------------