- int wLabel;
- int hLabel = GetLabelsSize(&wLabel);
-
- int xLabel = HasFlag(wxSL_LEFT) ? x + width - wLabel : x;
-
- // position all labels: min at the top, value in the middle and max at
- // the bottom
- DoMoveSibling((HWND)(*m_labels)[SliderLabel_Min],
- xLabel, y, wLabel, hLabel);
-
- DoMoveSibling((HWND)(*m_labels)[SliderLabel_Value],
- xLabel, y + (height - hLabel)/2, wLabel, hLabel);
-
- DoMoveSibling((HWND)(*m_labels)[SliderLabel_Max],
- xLabel, y + height - hLabel, wLabel, hLabel);
+ int holdTopWidth;
+ int holdTopX;
+ int holdBottomWidth;
+ int holdBottomX;
+ int xLabel = (wxMax((THUMB + (BORDERPAD * 2)), maxLabelWidth) / 2) -
+ (maxLabelWidth / 2) + x;
+ if ( HasFlag(wxSL_LEFT) )
+ {
+ if ( HasFlag(wxSL_MIN_MAX_LABELS) )
+ {
+ holdTopX = xLabel;
+ holdTopWidth = m_minLabelWidth;
+ holdBottomX = xLabel - ((m_maxLabelWidth - m_minLabelWidth) / 2);
+ holdBottomWidth = m_maxLabelWidth;
+ if ( HasFlag(wxSL_INVERSE) )
+ {
+ wxSwap(holdTopWidth, holdBottomWidth);
+ wxSwap(holdTopX, holdBottomX);
+ }
+ DoMoveSibling((HWND)(*m_labels)[SliderLabel_Min],
+ holdTopX,
+ y,
+ holdTopWidth, labelHeight);
+ DoMoveSibling((HWND)(*m_labels)[SliderLabel_Max],
+ holdBottomX,
+ y + height - labelHeight,
+ holdBottomWidth, labelHeight);
+ }
+ if ( HasFlag(wxSL_VALUE_LABEL) )
+ DoMoveSibling((HWND)(*m_labels)[SliderLabel_Value],
+ x + THUMB + tickOffset + HGAP,
+ y + (height - labelHeight)/2,
+ maxLabelWidth, labelHeight);
+ }
+ else // wxSL_RIGHT
+ {
+ if ( HasFlag(wxSL_MIN_MAX_LABELS) )
+ {
+ holdTopX = xLabel + maxLabelWidth + ((m_maxLabelWidth - m_minLabelWidth) / 2);
+ holdTopWidth = m_minLabelWidth;
+ holdBottomX = xLabel + maxLabelWidth;
+ holdBottomWidth = m_maxLabelWidth;
+ if ( HasFlag(wxSL_INVERSE) )
+ {
+ wxSwap(holdTopWidth, holdBottomWidth);
+ wxSwap(holdTopX, holdBottomX);
+ }
+ DoMoveSibling((HWND)(*m_labels)[SliderLabel_Min],
+ holdTopX,
+ y,
+ holdTopWidth, labelHeight);
+ DoMoveSibling((HWND)(*m_labels)[SliderLabel_Max],
+ holdBottomX,
+ y + height - labelHeight,
+ holdBottomWidth, labelHeight);
+ }
+ if ( HasFlag(wxSL_VALUE_LABEL) )
+ labelOffset = maxLabelWidth + HGAP;
+ DoMoveSibling((HWND)(*m_labels)[SliderLabel_Value],
+ x,
+ y + (height - labelHeight)/2,
+ maxLabelWidth, labelHeight);
+ }