X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4322906f97b2f6994b33182cb6a889fd899f3012..010d821b3138ae39c43403da64eb0bcde9af82ae:/src/generic/grideditors.cpp diff --git a/src/generic/grideditors.cpp b/src/generic/grideditors.cpp index aee78e2fe8..aef0f36453 100644 --- a/src/generic/grideditors.cpp +++ b/src/generic/grideditors.cpp @@ -4,7 +4,6 @@ // Author: Michael Bedward (based on code by Julian Smart, Robin Dunn) // Modified by: Robin Dunn, Vadim Zeitlin, Santiago Palacios // Created: 1/08/1999 -// RCS-ID: $Id$ // Copyright: (c) Michael Bedward (mbedward@ozemail.com.au) // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -416,6 +415,11 @@ void wxGridCellTextEditor::DoCreate(wxWindow* parent, { Text()->SetMaxLength(m_maxChars); } + // validate text in textctrl, if validator is set + if ( m_validator ) + { + Text()->SetValidator(*m_validator); + } wxGridCellEditor::Create(parent, id, evtHandler); } @@ -634,6 +638,21 @@ void wxGridCellTextEditor::SetParameters(const wxString& params) } } +void wxGridCellTextEditor::SetValidator(const wxValidator& validator) +{ + m_validator.reset(static_cast(validator.Clone())); +} + +wxGridCellEditor *wxGridCellTextEditor::Clone() const +{ + wxGridCellTextEditor* editor = new wxGridCellTextEditor(m_maxChars); + if ( m_validator ) + { + editor->SetValidator(*m_validator); + } + return editor; +} + // return the value in the text control wxString wxGridCellTextEditor::GetValue() const {