The best size calculation was wrong as the min/max labels height was
unnecessarily added to the slier total height even if though these labels are
positioned alongside the slider itself in horizontal layout case.
The slider also managed to position its value label completely outside the
space allocated to it (and the bug in DoGetBestSize() might have been an
attempt to work around this), don't do this any more. This also fixes the
wrongly centered vertical position of the min/max labels.
Closes #13291.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68207
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
((width - (m_minLabelWidth + m_maxLabelWidth)) / 2) -
(m_maxLabelWidth / 2);
((width - (m_minLabelWidth + m_maxLabelWidth)) / 2) -
(m_maxLabelWidth / 2);
if ( HasFlag(wxSL_BOTTOM) )
{
if ( HasFlag(wxSL_BOTTOM) )
{
+ if ( HasFlag(wxSL_VALUE_LABEL) )
+ {
+ DoMoveSibling((HWND)(*m_labels)[SliderLabel_Value],
+ xLabelValue,
+ y,
+ maxLabelWidth, labelHeight);
+
+ ySlider += labelHeight;
+ yLabelMinMax += labelHeight;
+ }
+
if ( HasFlag(wxSL_MIN_MAX_LABELS) )
{
holdLeftX = x;
if ( HasFlag(wxSL_MIN_MAX_LABELS) )
{
holdLeftX = x;
yLabelMinMax,
holdRightWidth, labelHeight);
}
yLabelMinMax,
holdRightWidth, labelHeight);
}
+ }
+ else // wxSL_TOP
+ {
if ( HasFlag(wxSL_VALUE_LABEL) )
{
DoMoveSibling((HWND)(*m_labels)[SliderLabel_Value],
xLabelValue,
if ( HasFlag(wxSL_VALUE_LABEL) )
{
DoMoveSibling((HWND)(*m_labels)[SliderLabel_Value],
xLabelValue,
+ y + THUMB + tickOffset,
maxLabelWidth, labelHeight);
}
maxLabelWidth, labelHeight);
}
- }
- else // wxSL_TOP
- {
if ( HasFlag(wxSL_MIN_MAX_LABELS) )
{
holdLeftX = x;
if ( HasFlag(wxSL_MIN_MAX_LABELS) )
{
holdLeftX = x;
yLabelMinMax,
holdRightWidth, labelHeight);
}
yLabelMinMax,
holdRightWidth, labelHeight);
}
- if ( HasFlag(wxSL_VALUE_LABEL) )
- DoMoveSibling((HWND)(*m_labels)[SliderLabel_Value],
- xLabelValue,
- y + THUMB + tickOffset,
- maxLabelWidth, labelHeight);
}
// position the slider itself along the top/bottom edge
}
// position the slider itself along the top/bottom edge
labelOffset = labelHeight;
wxSliderBase::DoMoveWindow(
x + m_minLabelWidth + VGAP,
labelOffset = labelHeight;
wxSliderBase::DoMoveWindow(
x + m_minLabelWidth + VGAP,
width - (m_minLabelWidth + m_maxLabelWidth + (VGAP*2)),
THUMB + tickOffset);
}
width - (m_minLabelWidth + m_maxLabelWidth + (VGAP*2)),
THUMB + tickOffset);
}
- // labels add extra height
int labelSize = GetLabelsSize();
int labelSize = GetLabelsSize();
- if ( HasFlag(wxSL_MIN_MAX_LABELS) )
+
+ // Min/max labels are compensated by the ticks so we don't need
+ // extra space for them if we're also showing ticks.
+ if ( HasFlag(wxSL_MIN_MAX_LABELS) && !HasFlag(wxSL_TICKS) )
+
+ // The value label is always on top of the control and so does need
+ // extra space in any case.
if ( HasFlag(wxSL_VALUE_LABEL) )
if ( HasFlag(wxSL_VALUE_LABEL) )
- size.y += static_cast<int>(labelSize*2.75);