- /* Set the height and width for the slider control region. The actual
- * slider is set at 10 pixels across. If the slider has labels then the
- * control region must be large enough to contain these labels
- */
- if (style & wxSL_LABELS)
- {
- wxString text;
- int ht, wd;
-
- // Get maximum text label width and height
- text.Printf("%d", minValue);
- parent->GetTextExtent(text, &maxtextwidth, &textheight);
- text.Printf("%d", maxValue);
- parent->GetTextExtent(text, &wd, &ht);
- if(ht > textheight) {
- textheight = ht;
- }
- if (wd > maxtextwidth) {
- maxtextwidth = wd;
- }
-
- if (style & wxSL_VERTICAL) {
- slsize.x = (15 + maxtextwidth + 2); // Slider wd plus mac text width
- }
- if (style & wxSL_HORIZONTAL) {
- slsize.y = (15 + textheight); // Slider ht plus text ht.
- }
- }
-
- MacPreControlCreate( parent , id , "" , pos , slsize , style,
- validator , name , &bounds , title ) ;
-
- m_macMinimumStatic = NULL ;
- m_macMaximumStatic = NULL ;
- m_macValueStatic = NULL ;
-
- m_lineSize = 1;
- m_tickFreq = 0;
-
- m_rangeMax = maxValue;
- m_rangeMin = minValue;
-
- m_pageSize = (int)((maxValue-minValue)/10);
-
- // Must modify bounds to that of the slider dimensions from slider
- // dimensions plus text labels.
- if (style & wxSL_LABELS)
- {
- if ( style & wxSL_HORIZONTAL )
- {
- bounds.bottom = bounds.top + 15;
- bounds.right -= (5 + maxtextwidth);
- }
- else // Vertical slider
- {
- bounds.right = bounds.left + 15;
- bounds.bottom -= (5 + textheight);
- }