Add Get{Min,Max,Range}() to numeric validator classes
Just provide accessors matching the existing setters. Closes https://github.com/wxWidgets/wxWidgets/pull/1287, https://github.com/wxWidgets/wxWidgets/pull/1288
This commit is contained in:
committed by
Vadim Zeitlin
parent
3674bd1c1f
commit
20c7421a67
@@ -157,17 +157,33 @@ public:
|
|||||||
this->DoSetMin(min);
|
this->DoSetMin(min);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ValueType GetMin() const
|
||||||
|
{
|
||||||
|
return static_cast<ValueType>(this->DoGetMin());
|
||||||
|
}
|
||||||
|
|
||||||
void SetMax(ValueType max)
|
void SetMax(ValueType max)
|
||||||
{
|
{
|
||||||
this->DoSetMax(max);
|
this->DoSetMax(max);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ValueType GetMax() const
|
||||||
|
{
|
||||||
|
return static_cast<ValueType>(this->DoGetMax());
|
||||||
|
}
|
||||||
|
|
||||||
void SetRange(ValueType min, ValueType max)
|
void SetRange(ValueType min, ValueType max)
|
||||||
{
|
{
|
||||||
SetMin(min);
|
SetMin(min);
|
||||||
SetMax(max);
|
SetMax(max);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GetRange(ValueType& min, ValueType& max) const
|
||||||
|
{
|
||||||
|
min = GetMin();
|
||||||
|
max = GetMax();
|
||||||
|
}
|
||||||
|
|
||||||
virtual bool TransferToWindow() wxOVERRIDE
|
virtual bool TransferToWindow() wxOVERRIDE
|
||||||
{
|
{
|
||||||
if ( m_value )
|
if ( m_value )
|
||||||
@@ -288,7 +304,9 @@ protected:
|
|||||||
static bool FromString(const wxString& s, LongestValueType *value);
|
static bool FromString(const wxString& s, LongestValueType *value);
|
||||||
|
|
||||||
void DoSetMin(LongestValueType min) { m_min = min; }
|
void DoSetMin(LongestValueType min) { m_min = min; }
|
||||||
|
LongestValueType DoGetMin() const { return m_min; }
|
||||||
void DoSetMax(LongestValueType max) { m_max = max; }
|
void DoSetMax(LongestValueType max) { m_max = max; }
|
||||||
|
LongestValueType DoGetMax() const { return m_max; }
|
||||||
|
|
||||||
bool IsInRange(LongestValueType value) const
|
bool IsInRange(LongestValueType value) const
|
||||||
{
|
{
|
||||||
@@ -390,7 +408,9 @@ protected:
|
|||||||
bool FromString(const wxString& s, LongestValueType *value) const;
|
bool FromString(const wxString& s, LongestValueType *value) const;
|
||||||
|
|
||||||
void DoSetMin(LongestValueType min) { m_min = min; }
|
void DoSetMin(LongestValueType min) { m_min = min; }
|
||||||
|
LongestValueType DoGetMin() const { return m_min; }
|
||||||
void DoSetMax(LongestValueType max) { m_max = max; }
|
void DoSetMax(LongestValueType max) { m_max = max; }
|
||||||
|
LongestValueType DoGetMax() const { return m_max; }
|
||||||
|
|
||||||
bool IsInRange(LongestValueType value) const
|
bool IsInRange(LongestValueType value) const
|
||||||
{
|
{
|
||||||
|
@@ -89,6 +89,13 @@ public:
|
|||||||
*/
|
*/
|
||||||
void SetMin(ValueType min);
|
void SetMin(ValueType min);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the minimal value accepted by the validator.
|
||||||
|
|
||||||
|
@since 3.1.3
|
||||||
|
*/
|
||||||
|
ValueType GetMin() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Sets the maximal value accepted by the validator.
|
Sets the maximal value accepted by the validator.
|
||||||
|
|
||||||
@@ -96,6 +103,13 @@ public:
|
|||||||
*/
|
*/
|
||||||
void SetMax(ValueType max);
|
void SetMax(ValueType max);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the maximum value accepted by the validator.
|
||||||
|
|
||||||
|
@since 3.1.3
|
||||||
|
*/
|
||||||
|
ValueType GetMax() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Sets both minimal and maximal values accepted by the validator.
|
Sets both minimal and maximal values accepted by the validator.
|
||||||
|
|
||||||
@@ -103,6 +117,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
void SetRange(ValueType min, ValueType max);
|
void SetRange(ValueType min, ValueType max);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets both minimal and maximal values accepted by the validator.
|
||||||
|
|
||||||
|
@since 3.1.3
|
||||||
|
*/
|
||||||
|
void GetRange(ValueType& min, ValueType& max) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Change the validator style.
|
Change the validator style.
|
||||||
|
Reference in New Issue
Block a user