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 // ----------------------------------------------------------------------------