Don't allow wxSpinCtrl range to include negative values if base != 10 (wxMSW)

In a native up-down control hexadecimal numbers are always unsigned (see
UDM_SETBASE message documentation) so we need to prevent:
- Setting a range including negative values if base == 16.
- Setting base != 10 if current range includes negative values.

See #18805.
This commit is contained in:
Artur Wieczorek
2020-07-09 22:53:07 +02:00
parent b2d4a9dedc
commit ae1e93cbae
4 changed files with 26 additions and 1 deletions

View File

@@ -26,6 +26,8 @@ extern int GetMaxValueLength(int minVal, int maxVal, int base);
// of wxSpinCtrl is derived from wxSpinButton but uses the same algorithm.
extern wxSize GetBestSize(const wxControl* spin, int minVal, int maxVal, int base);
// Helper function to check if given combination of range and base is valid.
extern bool IsBaseCompatibleWithRange(int minVal, int maxVal, int base);
} // namespace wxSpinCtrlImpl
#endif // _WX_PRIVATE_SPINCTRL_H_