X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3f66f6a5b3583b02c34854556eb83e3a808524ce..66c2bf7b1d9326fb650acfaae22ec50528cfbf7c:/include/wx/generic/spinctlg.h?ds=sidebyside diff --git a/include/wx/generic/spinctlg.h b/include/wx/generic/spinctlg.h index c37fe357eb..a35cc8a4a4 100644 --- a/include/wx/generic/spinctlg.h +++ b/include/wx/generic/spinctlg.h @@ -117,9 +117,15 @@ protected: virtual void DoEnable(bool enable); #endif // __WXMSW__ + enum SendEvent + { + SendEvent_None, + SendEvent_Text + }; + // generic double valued functions double DoGetValue() const { return m_value; } - bool DoSetValue(double val); + bool DoSetValue(double val, SendEvent sendEvent); void DoSetRange(double min_val, double max_val); void DoSetIncrement(double inc); @@ -129,7 +135,7 @@ protected: // can also change the text control if its value is invalid // // return true if our value has changed - bool SyncSpinToText(); + bool SyncSpinToText(SendEvent sendEvent); // Send the correct event type virtual void DoSendEvent() = 0; @@ -201,7 +207,7 @@ public: bool ok = wxTextCtrl::Create(parent, id, value, pos, size, style, wxDefaultValidator, name); - DoSetValue(initial); + DoSetValue(initial, SendEvent_None); return ok; } @@ -237,9 +243,20 @@ protected: return n; } - bool DoSetValue(double val) + bool DoSetValue(double val, SendEvent sendEvent) { - wxTextCtrl::SetValue(wxString::Format(m_format.c_str(), val)); + wxString str(wxString::Format(m_format, val)); + switch ( sendEvent ) + { + case SendEvent_None: + wxTextCtrl::ChangeValue(str); + break; + + case SendEvent_Text: + wxTextCtrl::SetValue(str); + break; + } + return true; } void DoSetRange(double min_val, double max_val) @@ -305,7 +322,7 @@ public: // operations void SetValue(const wxString& value) { wxSpinCtrlGenericBase::SetValue(value); } - void SetValue( int value ) { DoSetValue(value); } + void SetValue( int value ) { DoSetValue(value, SendEvent_None); } void SetRange( int minVal, int maxVal ) { DoSetRange(minVal, maxVal); } void SetIncrement(int inc) { DoSetIncrement(inc); } @@ -381,7 +398,7 @@ public: // operations void SetValue(const wxString& value) { wxSpinCtrlGenericBase::SetValue(value); } - void SetValue(double value) { DoSetValue(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 SetDigits(unsigned digits);