Make DetermineDigits() reusable in other ports

Move this function, and the associated constant, to common code.

This required moving wxSpinCtrlDouble::Create() implementation to the
source file, but there are no real changes.
This commit is contained in:
Vadim Zeitlin
2021-04-25 20:14:46 +01:00
parent c16f85bd4d
commit a44bb13a0c
4 changed files with 47 additions and 31 deletions

View File

@@ -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"))
{
DoSetDigits(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(); }
@@ -426,10 +420,6 @@ private:
DoSetDigits(0);
}
// Return the number of digits required to show the numbers using the
// specified increment without loss of precision.
static unsigned DetermineDigits(double inc);
// Just set the number of digits and the format unconditionally.
void DoSetDigits(unsigned digits);