by modern apps.
- Ellipsize long strings in wxStatusBar (Francesco Montorsi)
- Fix spurious repaint when changing tooltip text (Jonathan Liu).
+- Fix wxSP_WRAP and wxSP_ARROW_KEYS in wxSpinCtrlDouble (Andrew Radke).
wxX11:
// Send the correct event type
virtual void DoSendEvent() = 0;
+ // check if the value is in range
bool InRange(double n) const { return (n >= m_min) && (n <= m_max); }
+ // ensure that the value is in range wrapping it round if necessary
+ double AdjustToFitInRange(double value) const;
+
+
double m_value;
double m_min;
double m_max;
if (((spin_value >= 0) && (m_spin_value >= 0)) || ((spin_value <= 0) && (m_spin_value <= 0)))
step *= abs(spin_value - m_spin_value);
- double value = m_value + step*m_increment;
-
- // Check for over/underflow wrapping around if necessary
- if (value < m_min)
- value = HasFlag(wxSP_WRAP) ? m_max : m_min;
- if (value > m_max)
- value = HasFlag(wxSP_WRAP) ? m_min : m_max;
+ double value = AdjustToFitInRange(m_value + step*m_increment);
// Ignore the edges when it wraps since the up/down event may be opposite
// They are in GTK and Mac
m_spin_value = spin_value;
- if (InRange(value) && DoSetValue(value))
+ if ( DoSetValue(value) )
DoSendEvent();
}
return;
}
+ value = AdjustToFitInRange(value);
+
if ( m_textCtrl && m_textCtrl->IsModified() )
SyncSpinToText();
return false;
}
+double wxSpinCtrlGenericBase::AdjustToFitInRange(double value) const
+{
+ if (value < m_min)
+ value = HasFlag(wxSP_WRAP) ? m_max : m_min;
+ if (value > m_max)
+ value = HasFlag(wxSP_WRAP) ? m_min : m_max;
+
+ return value;
+}
+
void wxSpinCtrlGenericBase::DoSetRange(double min, double max)
{
m_min = min;