Tk Source Code

Check-in [f1f399c4]
Login

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 Unified Diffs Ignore Whitespace Patch

Changes to macosx/ttkMacOSXTheme.c.

197
198
199
200
201
202
203










































204
205
206
207
208
209
210
...
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
...
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
...
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791

    CGContextBeginPath(context);
    CGContextAddPath(context, path);
    CGContextReplacePathWithStrokedPath(context);
    CGContextFillPath(context);
    CFRelease(path);
}











































#endif /* MAC_OS_X_VERSION_MIN_REQUIRED > 1080 */

#if MAC_OS_X_VERSION_MIN_REQUIRED > 101300
/*----------------------------------------------------------------------
 * +++ Drawing procedures for widgets in Apple's "Dark Mode" (10.14 and up).
 *
................................................................................
static CGFloat darkBackgroundGradient[8] = {0.0, 0.0, 0.0, 0.1,
					    0.0, 0.0, 0.0, 0.25};
static CGFloat darkInactiveGradient[8] = {89.0/255, 90.0/255, 93.0/255, 1.0,
				       119.0/255, 120.0/255, 122.0/255, 1.0};
static CGFloat darkSelectedGradient[8] = {23.0/255, 111.0/255, 232.0/255, 1.0,
					  20.0/255, 94.0/255,  206.0/255, 1.0};

/*
 * NormalizeButtonBounds --
 *
 * Apple's Human Interface Guidelines only allow three specific heights for buttons:
 * Regular, small and mini. We always use the regular size.  However, Ttk may
 * provide an arbitrary bounding rectangle.  We always draw the button centered
 * vertically on the rectangle, and having the same width as the rectangle.
 * This function returns the actual bounding rectangle that will be used in
 * drawing the button.
 */

static CGRect NormalizeButtonBounds(
    SInt32 heightMetric,
    CGRect bounds)
{
    SInt32 height;
    ChkErr(GetThemeMetric, heightMetric, &height);
    bounds.origin.y += (bounds.size.height - height)/2;
    bounds.size.height = height;
    return bounds;
}

/* FillButtonBackground --
 *
 *    Fills a rounded rectangle with a transparent black gradient.
 */

static void FillButtonBackground(
    CGContextRef context,
................................................................................
    CGContextReplacePathWithStrokedPath(context);
    CGContextClip(context);
    CGContextDrawLinearGradient(context, topGradient, bounds.origin, topEnd, 0.0);
    CGContextRestoreGState(context);
    CFRelease(topGradient);
}

/* SolidFillButtonFace --
 *
 *     Fill a rounded rectangle with a specified solid color.
 */

static void SolidFillButtonFace(
   CGContextRef context,
   CGRect bounds,
   CGFloat radius,
   NSColor *color)
{
    CGPathRef path;
    CGContextSetFillColorWithColor(context, color.CGColor);
    path = CGPathCreateWithRoundedRect(bounds, radius, radius, NULL);
    CGContextBeginPath(context);
    CGContextAddPath(context, path);
    CGContextFillPath(context);
    CFRelease(path);
}

/* GradientFillButtonFace --
 *
 *     Fill a rounded rectangle with a specified gradient.
 */

static void GradientFillButtonFace(
   CGContextRef context,
................................................................................
	    break;
	case kThemeRadioButton:
	    DrawDarkRadioButton(bounds, state, dc.context);
	    break;
	default:
	    ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation, NULL);
#endif
	}
    } else {
	/*
	 *  Apple's PushButton and PopupButton do not change their (white) fill
	 *  color when the window is inactive although, except in 10.7 (Lion),
	 *  the color of the arrow button on a PopupButton does change.  For
	 *  some reason HITheme fills inactive buttons with a transparent color
	 *  that allows the window background to show through, leading to







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







 







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







 







<







197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
...
269
270
271
272
273
274
275






















276
277
278
279
280
281
282
...
322
323
324
325
326
327
328




















329
330
331
332
333
334
335
...
777
778
779
780
781
782
783

784
785
786
787
788
789
790

    CGContextBeginPath(context);
    CGContextAddPath(context, path);
    CGContextReplacePathWithStrokedPath(context);
    CGContextFillPath(context);
    CFRelease(path);
}

/*
 * NormalizeButtonBounds --
 *
 * Apple's Human Interface Guidelines only allow three specific heights for buttons:
 * Regular, small and mini. We always use the regular size.  However, Ttk may
 * provide an arbitrary bounding rectangle.  We always draw the button centered
 * vertically on the rectangle, and having the same width as the rectangle.
 * This function returns the actual bounding rectangle that will be used in
 * drawing the button.
 */

static CGRect NormalizeButtonBounds(
    SInt32 heightMetric,
    CGRect bounds)
{
    SInt32 height;
    ChkErr(GetThemeMetric, heightMetric, &height);
    bounds.origin.y += (bounds.size.height - height)/2;
    bounds.size.height = height;
    return bounds;
}

/* SolidFillButtonFace --
 *
 *     Fill a rounded rectangle with a specified solid color.
 */

static void SolidFillButtonFace(
   CGContextRef context,
   CGRect bounds,
   CGFloat radius,
   NSColor *color)
{
    CGPathRef path;
    CGContextSetFillColorWithColor(context, color.CGColor);
    path = CGPathCreateWithRoundedRect(bounds, radius, radius, NULL);
    CGContextBeginPath(context);
    CGContextAddPath(context, path);
    CGContextFillPath(context);
    CFRelease(path);
}

#endif /* MAC_OS_X_VERSION_MIN_REQUIRED > 1080 */

#if MAC_OS_X_VERSION_MIN_REQUIRED > 101300
/*----------------------------------------------------------------------
 * +++ Drawing procedures for widgets in Apple's "Dark Mode" (10.14 and up).
 *
................................................................................
static CGFloat darkBackgroundGradient[8] = {0.0, 0.0, 0.0, 0.1,
					    0.0, 0.0, 0.0, 0.25};
static CGFloat darkInactiveGradient[8] = {89.0/255, 90.0/255, 93.0/255, 1.0,
				       119.0/255, 120.0/255, 122.0/255, 1.0};
static CGFloat darkSelectedGradient[8] = {23.0/255, 111.0/255, 232.0/255, 1.0,
					  20.0/255, 94.0/255,  206.0/255, 1.0};























/* FillButtonBackground --
 *
 *    Fills a rounded rectangle with a transparent black gradient.
 */

static void FillButtonBackground(
    CGContextRef context,
................................................................................
    CGContextReplacePathWithStrokedPath(context);
    CGContextClip(context);
    CGContextDrawLinearGradient(context, topGradient, bounds.origin, topEnd, 0.0);
    CGContextRestoreGState(context);
    CFRelease(topGradient);
}





















/* GradientFillButtonFace --
 *
 *     Fill a rounded rectangle with a specified gradient.
 */

static void GradientFillButtonFace(
   CGContextRef context,
................................................................................
	    break;
	case kThemeRadioButton:
	    DrawDarkRadioButton(bounds, state, dc.context);
	    break;
	default:
	    ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation, NULL);
#endif

    } else {
	/*
	 *  Apple's PushButton and PopupButton do not change their (white) fill
	 *  color when the window is inactive although, except in 10.7 (Lion),
	 *  the color of the arrow button on a PopupButton does change.  For
	 *  some reason HITheme fills inactive buttons with a transparent color
	 *  that allows the window background to show through, leading to