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);
// 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;
bool ok = wxTextCtrl::Create(parent, id, value, pos, size, style,
wxDefaultValidator, name);
- DoSetValue(initial);
+ DoSetValue(initial, SendEvent_None);
return ok;
}
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)
// 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); }
// 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);