Make wxSpinCtrlDouble::SetIncrement() update digits in wxGTK too
Follow the generic version and increase the number of digits if necessary.
This commit is contained in:
@@ -243,7 +243,7 @@ public:
|
|||||||
void SetValue(const wxString& value) wxOVERRIDE { wxSpinCtrlGTKBase::SetValue(value); } // visibility problem w/ gcc
|
void SetValue(const wxString& value) wxOVERRIDE { wxSpinCtrlGTKBase::SetValue(value); } // visibility problem w/ gcc
|
||||||
void SetValue(double value) { DoSetValue(value); }
|
void SetValue(double value) { DoSetValue(value); }
|
||||||
void SetRange(double minVal, double maxVal) { DoSetRange(minVal, maxVal); }
|
void SetRange(double minVal, double maxVal) { DoSetRange(minVal, maxVal); }
|
||||||
void SetIncrement(double inc) { DoSetIncrement(inc); }
|
void SetIncrement(double inc);
|
||||||
void SetDigits(unsigned digits);
|
void SetDigits(unsigned digits);
|
||||||
|
|
||||||
virtual int GetBase() const wxOVERRIDE { return 10; }
|
virtual int GetBase() const wxOVERRIDE { return 10; }
|
||||||
|
@@ -643,6 +643,18 @@ void wxSpinCtrlDouble::GtkSetEntryWidth()
|
|||||||
gtk_entry_set_width_chars(GTK_ENTRY(m_widget), wxMax(lenMin, lenMax));
|
gtk_entry_set_width_chars(GTK_ENTRY(m_widget), wxMax(lenMin, lenMax));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxSpinCtrlDouble::SetIncrement(double inc)
|
||||||
|
{
|
||||||
|
DoSetIncrement(inc);
|
||||||
|
|
||||||
|
const unsigned digits = wxSpinCtrlImpl::DetermineDigits(inc);
|
||||||
|
|
||||||
|
// Increase the number of digits, if necessary, to show all numbers that
|
||||||
|
// can be obtained by using the new increment without loss of precision.
|
||||||
|
if ( digits > GetDigits() )
|
||||||
|
SetDigits(digits);
|
||||||
|
}
|
||||||
|
|
||||||
unsigned wxSpinCtrlDouble::GetDigits() const
|
unsigned wxSpinCtrlDouble::GetDigits() const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_widget, 0, "invalid spin button" );
|
wxCHECK_MSG( m_widget, 0, "invalid spin button" );
|
||||||
|
Reference in New Issue
Block a user