//----------------------------------------------------------------------------// void Editbox::setMaxTextLength(size_t max_len) { if (d_maxTextLen != max_len) { d_maxTextLen = max_len; // Trigger max length changed event WindowEventArgs args(this); onMaximumTextLengthChanged(args); // trim string if (getText().length() > d_maxTextLen) { String newText = getText(); newText.resize(d_maxTextLen); setText(newText); onTextChanged(args); const MatchState state = getStringMatchState(getText()); if (d_validatorMatchState != state) { RegexMatchStateEventArgs rms_args(this, state); onTextValidityChanged(rms_args); d_validatorMatchState = state; } } } }
bool Combobox::editbox_TextValidityChangedHandler(const EventArgs& e) { RegexMatchStateEventArgs args( this, static_cast<const RegexMatchStateEventArgs&>(e).matchState); onTextValidityChanged(args); return args.handled > 0; }
//----------------------------------------------------------------------------// bool Editbox::handleValidityChangeForString(const String& str) { const MatchState state = getStringMatchState(str); if (state == d_validatorMatchState) return true; RegexMatchStateEventArgs args(this, state); onTextValidityChanged(args); if (args.handled == 0) return false; d_validatorMatchState = state; return true; }
//----------------------------------------------------------------------------// bool Editbox::handleValidityChangeForString(const String& str) { const MatchState new_state = getStringMatchState(str); if (new_state == d_validatorMatchState) return d_previousValidityChangeResponse; RegexMatchStateEventArgs args(this, new_state); onTextValidityChanged(args); const bool response = (args.handled != 0); if (response) { d_validatorMatchState = new_state; d_previousValidityChangeResponse = response; } return response; }