// wxGridCellTextEditor
// ----------------------------------------------------------------------------
-wxGridCellTextEditor::wxGridCellTextEditor()
+wxGridCellTextEditor::wxGridCellTextEditor(size_t maxChars)
{
- m_maxChars = 0;
+ m_maxChars = maxChars;
}
void wxGridCellTextEditor::Create(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);
}
}
}
+void wxGridCellTextEditor::SetValidator(const wxValidator& validator)
+{
+ m_validator.reset(static_cast<wxValidator*>(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
{