Fixed min and max label values not being swapped when using wxSL_INVERSE in a horizontal MSW slider.
Changed wxSlider::GetLabelsSize to let the widthMin and widthMax values contain the width of what the minimum (always on the left/top) and maximum (always on the right/bottom) _label_ will contain. This is not the same as the minimum and maximum _value_ in case of using wxSL_INVERSE. Also don't swap the position of the min/max labels in a horizontal slider with wxSL_INVERSE (just how the labels already stay in place in a vertical slider, regardless of wxSL_INVERSE usage), nor their width. Regression since r65941. Fixes #13416. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70048 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
2a263bbbd7
commit
cac008ad62
@ -371,6 +371,11 @@ int wxSlider::GetLabelsSize(int *widthMin, int *widthMax) const
|
||||
{
|
||||
*widthMin = GetTextExtent(Format(m_rangeMin)).x;
|
||||
*widthMax = GetTextExtent(Format(m_rangeMax)).x;
|
||||
|
||||
if ( HasFlag(wxSL_INVERSE) )
|
||||
{
|
||||
wxSwap(*widthMin, *widthMax);
|
||||
}
|
||||
}
|
||||
|
||||
return HasFlag(wxSL_LABELS) ? GetCharHeight() : 0;
|
||||
@ -420,11 +425,10 @@ void wxSlider::DoMoveWindow(int x, int y, int width, int height)
|
||||
{
|
||||
holdTopX = xLabel;
|
||||
holdTopWidth = minLabelWidth;
|
||||
holdBottomX = xLabel - ((maxLabelWidth - minLabelWidth) / 2);
|
||||
holdBottomX = xLabel - (abs(maxLabelWidth - minLabelWidth) / 2);
|
||||
holdBottomWidth = maxLabelWidth;
|
||||
if ( HasFlag(wxSL_INVERSE) )
|
||||
{
|
||||
wxSwap(holdTopWidth, holdBottomWidth);
|
||||
wxSwap(holdTopX, holdBottomX);
|
||||
}
|
||||
DoMoveSibling((HWND)(*m_labels)[SliderLabel_Min],
|
||||
@ -446,13 +450,12 @@ void wxSlider::DoMoveWindow(int x, int y, int width, int height)
|
||||
{
|
||||
if ( HasFlag(wxSL_MIN_MAX_LABELS) )
|
||||
{
|
||||
holdTopX = xLabel + longestLabelWidth + ((maxLabelWidth - minLabelWidth) / 2);
|
||||
holdTopX = xLabel + longestLabelWidth + (abs(maxLabelWidth - minLabelWidth) / 2);
|
||||
holdTopWidth = minLabelWidth;
|
||||
holdBottomX = xLabel + longestLabelWidth;
|
||||
holdBottomWidth = maxLabelWidth;
|
||||
if ( HasFlag(wxSL_INVERSE) )
|
||||
{
|
||||
wxSwap(holdTopWidth, holdBottomWidth);
|
||||
wxSwap(holdTopX, holdBottomX);
|
||||
}
|
||||
DoMoveSibling((HWND)(*m_labels)[SliderLabel_Min],
|
||||
@ -515,11 +518,6 @@ void wxSlider::DoMoveWindow(int x, int y, int width, int height)
|
||||
holdLeftWidth = minLabelWidth;
|
||||
holdRightX = x + width - maxLabelWidth;
|
||||
holdRightWidth = maxLabelWidth;
|
||||
if ( HasFlag(wxSL_INVERSE) )
|
||||
{
|
||||
wxSwap(holdLeftWidth, holdRightWidth);
|
||||
wxSwap(holdLeftX, holdRightX);
|
||||
}
|
||||
DoMoveSibling((HWND)(*m_labels)[SliderLabel_Min],
|
||||
holdLeftX,
|
||||
yLabelMinMax,
|
||||
@ -546,11 +544,6 @@ void wxSlider::DoMoveWindow(int x, int y, int width, int height)
|
||||
holdLeftWidth = minLabelWidth;
|
||||
holdRightX = x + width - maxLabelWidth;
|
||||
holdRightWidth = maxLabelWidth;
|
||||
if ( HasFlag(wxSL_INVERSE) )
|
||||
{
|
||||
wxSwap(holdLeftWidth, holdRightWidth);
|
||||
wxSwap(holdLeftX, holdRightX);
|
||||
}
|
||||
DoMoveSibling((HWND)(*m_labels)[SliderLabel_Min],
|
||||
holdLeftX,
|
||||
yLabelMinMax,
|
||||
|
Loading…
Reference in New Issue
Block a user