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

@@ -28,6 +28,14 @@ extern wxSize GetBestSize(const wxControl* spin, int minVal, int maxVal, int bas
// Helper function to check if given combination of range and base is valid.
extern bool IsBaseCompatibleWithRange(int minVal, int maxVal, int base);
// Maximum number of digits returned by DetermineDigits().
const unsigned SPINCTRLDBL_MAX_DIGITS = 20;
// Return the number of digits required to show the numbers using the
// specified increment without loss of precision.
extern unsigned DetermineDigits(double inc);
} // namespace wxSpinCtrlImpl
#endif // _WX_PRIVATE_SPINCTRL_H_