Merge branch 'spinctrl-digits'
Improve setting the number of digits in wxSpinCtrlDouble and make it consistent on all platforms. See https://github.com/wxWidgets/wxWidgets/pull/2348 Closes #17085.
This commit is contained in:
@@ -382,13 +382,7 @@ public:
|
||||
long style = wxSP_ARROW_KEYS,
|
||||
double min = 0, double max = 100, double initial = 0,
|
||||
double inc = 1,
|
||||
const wxString& name = wxT("wxSpinCtrlDouble"))
|
||||
{
|
||||
DetermineDigits(inc);
|
||||
return wxSpinCtrlGenericBase::Create(parent, id, value, pos, size,
|
||||
style, min, max, initial,
|
||||
inc, name);
|
||||
}
|
||||
const wxString& name = wxT("wxSpinCtrlDouble"));
|
||||
|
||||
// accessors
|
||||
double GetValue(wxSPINCTRL_GETVALUE_FIX) const { return DoGetValue(); }
|
||||
@@ -402,7 +396,7 @@ public:
|
||||
{ wxSpinCtrlGenericBase::SetValue(value); }
|
||||
void SetValue(double value) { DoSetValue(value, SendEvent_None); }
|
||||
void SetRange(double minVal, double maxVal) { DoSetRange(minVal, maxVal); }
|
||||
void SetIncrement(double inc) { DoSetIncrement(inc); }
|
||||
void SetIncrement(double inc);
|
||||
void SetDigits(unsigned digits);
|
||||
|
||||
// We don't implement bases support for floating point numbers, this is not
|
||||
@@ -416,7 +410,6 @@ protected:
|
||||
virtual bool DoTextToValue(const wxString& text, double *val) wxOVERRIDE;
|
||||
virtual wxString DoValueToText(double val) wxOVERRIDE;
|
||||
virtual void ResetTextValidator() wxOVERRIDE;
|
||||
void DetermineDigits(double inc);
|
||||
|
||||
unsigned m_digits;
|
||||
|
||||
@@ -424,10 +417,16 @@ private:
|
||||
// Common part of all ctors.
|
||||
void Init()
|
||||
{
|
||||
m_digits = 0;
|
||||
m_format = wxASCII_STR("%0.0f");
|
||||
DoSetDigits(0);
|
||||
}
|
||||
|
||||
// Just set the number of digits and the format unconditionally.
|
||||
void DoSetDigits(unsigned digits);
|
||||
|
||||
// Call DoSetDigits() and update the appearance.
|
||||
void DoSetDigitsAndUpdate(unsigned digits);
|
||||
|
||||
|
||||
wxString m_format;
|
||||
|
||||
wxDECLARE_DYNAMIC_CLASS(wxSpinCtrlDouble);
|
||||
|
Reference in New Issue
Block a user