Refactor code for numeric validation in numeric wxPG properties

Move template function NumericValidation() to wxNumericProperty because all data necessary to validate the value are available here: acceptable value range, SpinCtrl editor value wrapping mode, etc.
This commit is contained in:
Artur Wieczorek
2019-06-28 21:16:58 +02:00
parent 69632371e3
commit 48adc38bbb
3 changed files with 134 additions and 149 deletions

View File

@@ -166,10 +166,13 @@ public:
virtual wxVariant AddSpinStepValue(long stepScale) const = 0;
wxVariant GetMinVal() const { return m_minVal; }
wxVariant GetMaxVal() const { return m_maxVal; }
bool UseSpinMotion() const { return m_spinMotion; }
// Common validation code - for internal use.
template<typename T>
bool DoNumericValidation(T& value, wxPGValidationInfo* pValidationInfo,
int mode, T defMin, T defMax) const;
protected:
wxNumericProperty(const wxString& label, const wxString& name);