#include "wx/slider.h"
#include "wx/osx/private.h"
-IMPLEMENT_DYNAMIC_CLASS(wxSlider, wxControl)
-
BEGIN_EVENT_TABLE(wxSlider, wxControl)
END_EVENT_TABLE()
void wxSlider::SetRange(int minValue, int maxValue)
{
+ // Changing the range preserves the value of the native control but may
+ // change our logical value if we're inverting the native value to get it
+ // as ValueInvertOrNot() depends on the range so preserve it before
+ // changing the range.
+ const int valueOld = GetValue();
+
wxString value;
m_rangeMin = minValue;
SetValue(m_rangeMin);
else if(currentValue > m_rangeMax)
SetValue(m_rangeMax);
+
+ // Ensure that our value didn't change.
+ SetValue(valueOld);
}
// For trackbars only
-void wxSlider::SetTickFreq(int n, int WXUNUSED(pos))
+void wxSlider::DoSetTickFreq(int n)
{
// TODO
m_tickFreq = n;