+ Rect bounds ;
+ Str255 title ;
+ wxSize slsize;
+ int maxtextwidth, textheight;
+
+ // Is control horizontal or vertical (Can be ambigous if user selects
+ // another style without also specifying horz or vert
+ if (!(style & wxSL_HORIZONTAL) && !(style & wxSL_VERTICAL)) {
+ // Default is horizontal so make it so
+ style |= wxSL_HORIZONTAL;
+ }
+ slsize = size;
+ // Check that size corresponds with users selection of vertical or
+ // horizontal slider and insert suitable default values
+ if (style & wxSL_HORIZONTAL)
+ {
+ slsize.y = 15; // Slider width
+ if (slsize.x == -1) {
+ slsize.x = 150; // Slider default length
+ }
+ }
+ else
+ {
+ slsize.x = 15; // Slider width
+ if (slsize.y == -1) {
+ slsize.y = 150; // Slider default length
+ }
+ }
+ /* 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 ;
+