- Add chainable wxWizardPageSimple::Chain() overload.
- Add wxTextEntryDialog::SetMaxLength() (derEine).
- Fix maximum width support in wxGridCellTextEditor (derEine).
+- Allow associating a validator with wxGridCellTextEditor (derEine).
- Add more convenient wxFont(wxFontInfo) ctor.
- Pass menu events to the handler in the associated wxMenuBar.
// parameters string format is "max_width"
virtual void SetParameters(const wxString& params);
+ virtual void SetValidator(const wxValidator& validator);
- virtual wxGridCellEditor *Clone() const
- { return new wxGridCellTextEditor(m_maxChars); }
+ virtual wxGridCellEditor *Clone() const;
// added GetValue so we can get the value which is in the control
virtual wxString GetValue() const;
void DoReset(const wxString& startValue);
private:
- size_t m_maxChars; // max number of chars allowed
- wxString m_value;
+ size_t m_maxChars; // max number of chars allowed
+ wxScopedPtr<wxValidator> m_validator;
+ wxString m_value;
wxDECLARE_NO_COPY_CLASS(wxGridCellTextEditor);
};
the maximum width.
*/
virtual void SetParameters(const wxString& params);
+
+ /**
+ Set validator to validate user input.
+
+ @since 2.9.5
+ */
+ virtual void SetValidator(const wxValidator& validator);
};
/**
{
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
{