Make wxSlider behaviours in wxUniv same as other ports, and generate proper wxScrollEvent

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77777 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-09-23 17:39:47 +00:00
parent 58730bc356
commit af4f17a553

View File

@@ -213,17 +213,6 @@ bool wxSlider::ChangeValueTo(int value)
Refresh();
// generate the events: both a specific scroll event and a command event
wxScrollEvent eventScroll(wxEVT_SCROLL_CHANGED, GetId());
eventScroll.SetPosition(m_value);
eventScroll.SetEventObject( this );
(void)GetEventHandler()->ProcessEvent(eventScroll);
wxCommandEvent event(wxEVT_SLIDER, GetId());
event.SetInt(m_value);
event.SetEventObject(this);
(void)GetEventHandler()->ProcessEvent(event);
return true;
}
@@ -782,27 +771,28 @@ bool wxSlider::PerformAction(const wxControlAction& action,
}
else if ( action == wxACTION_SLIDER_PAGE_CHANGE )
{
scrollEvent = wxEVT_SCROLL_CHANGED;
value = NormalizeValue(m_value + numArg * GetPageSize());
}
else if ( action == wxACTION_SLIDER_LINE_UP )
{
scrollEvent = wxEVT_SCROLL_LINEUP;
value = NormalizeValue(m_value + +GetLineSize());
value = NormalizeValue(m_value + -GetLineSize());
}
else if ( action == wxACTION_SLIDER_LINE_DOWN )
{
scrollEvent = wxEVT_SCROLL_LINEDOWN;
value = NormalizeValue(m_value + -GetLineSize());
value = NormalizeValue(m_value + +GetLineSize());
}
else if ( action == wxACTION_SLIDER_PAGE_UP )
{
scrollEvent = wxEVT_SCROLL_PAGEUP;
value = NormalizeValue(m_value + +GetPageSize());
value = NormalizeValue(m_value + -GetPageSize());
}
else if ( action == wxACTION_SLIDER_PAGE_DOWN )
{
scrollEvent = wxEVT_SCROLL_PAGEDOWN;
value = NormalizeValue(m_value + -GetPageSize());
value = NormalizeValue(m_value + +GetPageSize());
}
else if ( action == wxACTION_SLIDER_THUMB_DRAG ||
action == wxACTION_SLIDER_THUMB_MOVE )
@@ -826,12 +816,11 @@ bool wxSlider::PerformAction(const wxControlAction& action,
return wxControl::PerformAction(action, numArg, strArg);
}
// update wxSlider current value and generate wxCommandEvent, except while
// dragging the thumb
// update wxSlider current value
if ( valueChanged )
ChangeValueTo(value);
// also generate more precise wxScrollEvent if applicable
// generate wxScrollEvent
if ( scrollEvent != wxEVT_NULL )
{
wxScrollEvent event(scrollEvent, GetId());