Tk Source Code

Check-in [f1f399c4]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix some conditional compilation misconfiguration.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | bug-0d63621b6c
Files: files | file ages | folders
SHA3-256: f1f399c48f805c6b2bac8de1a83cbd6bfc517e6d5baea850a49f04fbe22757f7
User & Date: culler 2019-03-15 21:14:49
Context
2019-03-15
21:31
Dealt with dark BevelButtons and progress bars. check-in: cf564e76 user: culler tags: bug-0d63621b6c
21:14
Fix some conditional compilation misconfiguration. check-in: f1f399c4 user: culler tags: bug-0d63621b6c
02:42
Added a drawing procedure for dark RadioButtons and dealt with many slightly wrong ttk details. check-in: 973b11e7 user: culler tags: bug-0d63621b6c
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to macosx/ttkMacOSXTheme.c.

   197    197   
   198    198       CGContextBeginPath(context);
   199    199       CGContextAddPath(context, path);
   200    200       CGContextReplacePathWithStrokedPath(context);
   201    201       CGContextFillPath(context);
   202    202       CFRelease(path);
   203    203   }
          204  +
          205  +/*
          206  + * NormalizeButtonBounds --
          207  + *
          208  + * Apple's Human Interface Guidelines only allow three specific heights for buttons:
          209  + * Regular, small and mini. We always use the regular size.  However, Ttk may
          210  + * provide an arbitrary bounding rectangle.  We always draw the button centered
          211  + * vertically on the rectangle, and having the same width as the rectangle.
          212  + * This function returns the actual bounding rectangle that will be used in
          213  + * drawing the button.
          214  + */
          215  +
          216  +static CGRect NormalizeButtonBounds(
          217  +    SInt32 heightMetric,
          218  +    CGRect bounds)
          219  +{
          220  +    SInt32 height;
          221  +    ChkErr(GetThemeMetric, heightMetric, &height);
          222  +    bounds.origin.y += (bounds.size.height - height)/2;
          223  +    bounds.size.height = height;
          224  +    return bounds;
          225  +}
          226  +
          227  +/* SolidFillButtonFace --
          228  + *
          229  + *     Fill a rounded rectangle with a specified solid color.
          230  + */
          231  +
          232  +static void SolidFillButtonFace(
          233  +   CGContextRef context,
          234  +   CGRect bounds,
          235  +   CGFloat radius,
          236  +   NSColor *color)
          237  +{
          238  +    CGPathRef path;
          239  +    CGContextSetFillColorWithColor(context, color.CGColor);
          240  +    path = CGPathCreateWithRoundedRect(bounds, radius, radius, NULL);
          241  +    CGContextBeginPath(context);
          242  +    CGContextAddPath(context, path);
          243  +    CGContextFillPath(context);
          244  +    CFRelease(path);
          245  +}
   204    246   
   205    247   #endif /* MAC_OS_X_VERSION_MIN_REQUIRED > 1080 */
   206    248   
   207    249   #if MAC_OS_X_VERSION_MIN_REQUIRED > 101300
   208    250   /*----------------------------------------------------------------------
   209    251    * +++ Drawing procedures for widgets in Apple's "Dark Mode" (10.14 and up).
   210    252    *
................................................................................
   227    269   static CGFloat darkBackgroundGradient[8] = {0.0, 0.0, 0.0, 0.1,
   228    270   					    0.0, 0.0, 0.0, 0.25};
   229    271   static CGFloat darkInactiveGradient[8] = {89.0/255, 90.0/255, 93.0/255, 1.0,
   230    272   				       119.0/255, 120.0/255, 122.0/255, 1.0};
   231    273   static CGFloat darkSelectedGradient[8] = {23.0/255, 111.0/255, 232.0/255, 1.0,
   232    274   					  20.0/255, 94.0/255,  206.0/255, 1.0};
   233    275   
   234         -/*
   235         - * NormalizeButtonBounds --
   236         - *
   237         - * Apple's Human Interface Guidelines only allow three specific heights for buttons:
   238         - * Regular, small and mini. We always use the regular size.  However, Ttk may
   239         - * provide an arbitrary bounding rectangle.  We always draw the button centered
   240         - * vertically on the rectangle, and having the same width as the rectangle.
   241         - * This function returns the actual bounding rectangle that will be used in
   242         - * drawing the button.
   243         - */
   244         -
   245         -static CGRect NormalizeButtonBounds(
   246         -    SInt32 heightMetric,
   247         -    CGRect bounds)
   248         -{
   249         -    SInt32 height;
   250         -    ChkErr(GetThemeMetric, heightMetric, &height);
   251         -    bounds.origin.y += (bounds.size.height - height)/2;
   252         -    bounds.size.height = height;
   253         -    return bounds;
   254         -}
   255         -
   256    276   /* FillButtonBackground --
   257    277    *
   258    278    *    Fills a rounded rectangle with a transparent black gradient.
   259    279    */
   260    280   
   261    281   static void FillButtonBackground(
   262    282       CGContextRef context,
................................................................................
   302    322       CGContextReplacePathWithStrokedPath(context);
   303    323       CGContextClip(context);
   304    324       CGContextDrawLinearGradient(context, topGradient, bounds.origin, topEnd, 0.0);
   305    325       CGContextRestoreGState(context);
   306    326       CFRelease(topGradient);
   307    327   }
   308    328   
   309         -/* SolidFillButtonFace --
   310         - *
   311         - *     Fill a rounded rectangle with a specified solid color.
   312         - */
   313         -
   314         -static void SolidFillButtonFace(
   315         -   CGContextRef context,
   316         -   CGRect bounds,
   317         -   CGFloat radius,
   318         -   NSColor *color)
   319         -{
   320         -    CGPathRef path;
   321         -    CGContextSetFillColorWithColor(context, color.CGColor);
   322         -    path = CGPathCreateWithRoundedRect(bounds, radius, radius, NULL);
   323         -    CGContextBeginPath(context);
   324         -    CGContextAddPath(context, path);
   325         -    CGContextFillPath(context);
   326         -    CFRelease(path);
   327         -}
   328         -
   329    329   /* GradientFillButtonFace --
   330    330    *
   331    331    *     Fill a rounded rectangle with a specified gradient.
   332    332    */
   333    333   
   334    334   static void GradientFillButtonFace(
   335    335      CGContextRef context,
................................................................................
   777    777   	    break;
   778    778   	case kThemeRadioButton:
   779    779   	    DrawDarkRadioButton(bounds, state, dc.context);
   780    780   	    break;
   781    781   	default:
   782    782   	    ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation, NULL);
   783    783   #endif
   784         -	}
   785    784       } else {
   786    785   	/*
   787    786   	 *  Apple's PushButton and PopupButton do not change their (white) fill
   788    787   	 *  color when the window is inactive although, except in 10.7 (Lion),
   789    788   	 *  the color of the arrow button on a PopupButton does change.  For
   790    789   	 *  some reason HITheme fills inactive buttons with a transparent color
   791    790   	 *  that allows the window background to show through, leading to