SetValue(value);
SetPageSize((maxValue - minValue)/10);
+ // we need to position the labels correctly if we have them and if
+ // SetSize() hadn't been called before (when best size was determined by
+ // MSWCreateControl()) as in this case they haven't been put in place yet
+ if ( m_labels && size.x != wxDefaultCoord && size.y != wxDefaultCoord )
+ {
+ SetSize(size);
+ }
+
return true;
}
return;
}
+ // be careful to position the slider itself after moving the labels as
+ // otherwise our GetBoundingBox(), which is called from WM_SIZE handler,
+ // would return a wrong result and wrong size would be cached internally
if ( HasFlag(wxSL_VERTICAL) )
{
int wLabel;
int xLabel = HasFlag(wxSL_LEFT) ? x + width - wLabel : x;
- // position the slider itself along the left/right edge
- ::MoveWindow(GetHwnd(),
- HasFlag(wxSL_LEFT) ? x : x + wLabel + HGAP,
- y + hLabel/2,
- width - wLabel - HGAP,
- height - hLabel,
- TRUE);
-
// position all labels: min at the top, value in the middle and max at
// the bottom
::MoveWindow((*m_labels)[SliderLabel_Min],
::MoveWindow((*m_labels)[SliderLabel_Max],
xLabel, y + height - hLabel, wLabel, hLabel, TRUE);
+
+ // position the slider itself along the left/right edge
+ ::MoveWindow(GetHwnd(),
+ HasFlag(wxSL_LEFT) ? x : x + wLabel + HGAP,
+ y + hLabel/2,
+ width - wLabel - HGAP,
+ height - hLabel,
+ TRUE);
}
else // horizontal
{
int yLabel = HasFlag(wxSL_TOP) ? y + height - hLabel : y;
- // position the slider itself along the top/bottom edge
- ::MoveWindow(GetHwnd(),
- x,
- HasFlag(wxSL_TOP) ? y : y + hLabel,
- width,
- height - hLabel,
- TRUE);
-
// position all labels: min on the left, value in the middle and max to
// the right
::MoveWindow((*m_labels)[SliderLabel_Min],
::MoveWindow((*m_labels)[SliderLabel_Max],
x + width - wLabel, yLabel, wLabel, hLabel, TRUE);
+
+ // position the slider itself along the top/bottom edge
+ ::MoveWindow(GetHwnd(),
+ x,
+ HasFlag(wxSL_TOP) ? y : y + hLabel,
+ width,
+ height - hLabel,
+ TRUE);
}
}
return m_labels ? (WXHWND)(*m_labels)[SliderLabel_Value] : NULL;
}
-bool wxSlider95::ContainsHWND(WXHWND hWnd) const
-{
- return m_labels && m_labels->HasWindow((HWND)hWnd);
-}
-
-bool wxSlider95::Show(bool show)
-{
- if ( !wxSliderBase::Show(show) )
- return false;
-
- if ( m_labels )
- m_labels->Show(show);
-
- return true;
-}
+WX_FORWARD_STD_METHODS_TO_SUBWINDOWS(wxSlider95, wxSliderBase, m_labels)
#endif // wxUSE_SLIDER