Allow using a different text value in wxGTK wxSpinCtrl

Make it possible to use a string value different from the numeric value,
as wxMSW version allows this and some existing code depends on it.

Closes #19140.
This commit is contained in:
Vadim Zeitlin
2021-04-20 00:55:02 +02:00
parent e73a0c23ef
commit ca0cf3ea59
4 changed files with 159 additions and 7 deletions

View File

@@ -74,6 +74,9 @@ public:
virtual void GTKValueChanged() = 0;
protected:
wxSpinCtrlGTKBase();
~wxSpinCtrlGTKBase();
double DoGetValue() const;
double DoGetMin() const;
double DoGetMax() const;
@@ -98,6 +101,19 @@ protected:
// override this and return true.
virtual bool UseGTKStyleBase() const wxOVERRIDE { return true; }
// Set or reset m_textOverride.
void GTKSetTextOverride(const wxString& text);
void GTKResetTextOverride();
private:
// This function does _not_ take into account m_textOverride, so it is
// private and normally shouldn't be used -- use DoGetValue() instead.
double GTKGetValue() const;
// Non-null when the text value is different from the numeric value.
class wxSpinCtrlGTKTextOverride* m_textOverride;
friend class wxSpinCtrlEventDisabler;
wxDECLARE_EVENT_TABLE();