wxRect GetBoundingBox() const;
// Get the height and, if the pointers are non NULL, widths of both labels.
+ //
+ // Notice that the return value will be 0 if we don't have wxSL_LABELS
+ // style but we do fill widthMin and widthMax even if we don't have
+ // wxSL_MIN_MAX_LABELS style set so the caller should account for it.
int GetLabelsSize(int *widthMin = NULL, int *widthMax = NULL) const;
{
if ( widthMin && widthMax )
{
- if ( HasFlag(wxSL_MIN_MAX_LABELS) )
- {
- *widthMin = GetTextExtent(Format(m_rangeMin)).x;
- *widthMax = GetTextExtent(Format(m_rangeMax)).x;
- }
- else
- {
- *widthMin =
- *widthMax = 0;
- }
+ *widthMin = GetTextExtent(Format(m_rangeMin)).x;
+ *widthMax = GetTextExtent(Format(m_rangeMax)).x;
}
return HasFlag(wxSL_LABELS) ? GetCharHeight() : 0;
maxLabelWidth;
const int labelHeight = GetLabelsSize(&minLabelWidth, &maxLabelWidth);
const int longestLabelWidth = wxMax(minLabelWidth, maxLabelWidth);
+ if ( !HasFlag(wxSL_MIN_MAX_LABELS) )
+ {
+ minLabelWidth =
+ maxLabelWidth = 0;
+ }
int labelOffset = 0;
int tickOffset = 0;
int hLabel = GetLabelsSize(&widthMin, &widthMax);
// account for the labels
- size.x += HGAP + wxMax(widthMin, widthMax);
+ if ( HasFlag(wxSL_MIN_MAX_LABELS) )
+ size.x += HGAP + wxMax(widthMin, widthMax);
// labels are indented relative to the slider itself
size.y += hLabel;