summaryrefslogtreecommitdiffstats
path: root/macosx/ttkMacOSXTheme.c
diff options
context:
space:
mode:
Diffstat (limited to 'macosx/ttkMacOSXTheme.c')
-rw-r--r--macosx/ttkMacOSXTheme.c114
1 files changed, 52 insertions, 62 deletions
diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c
index ff850f0..bbc0bcb 100644
--- a/macosx/ttkMacOSXTheme.c
+++ b/macosx/ttkMacOSXTheme.c
@@ -136,7 +136,6 @@ static inline HIThemeButtonDrawInfo ComputeButtonDrawInfo(
* define it to return nil.
*/
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
static CGColorRef
CGColorFromRGBA(
CGFloat *rgba)
@@ -162,15 +161,6 @@ CGColorFromGray(
#define CGCOLOR(nscolor) (nscolor).CGColor
-#else
-
-#define CGCOLOR(nscolor) NULL
-#define CGColorFromRGBA(rgba) NULL
-#define CGColorFromGray(gray) NULL
-#define CGPathCreateWithRoundedRect(w, x, y, z) NULL
-
-#endif
-
/*----------------------------------------------------------------------
* +++ Utilities.
*/
@@ -214,9 +204,9 @@ static GrayPalette LookupGrayPalette(
{
const PaletteStateTable *entry = design->palettes;
while ((state & entry->onBits) != entry->onBits ||
- (~state & entry->offBits) != entry->offBits)
+ (~state & entry->offBits) != entry->offBits)
{
- ++entry;
+ ++entry;
}
return isDark ? entry->dark : entry->light;
}
@@ -356,12 +346,12 @@ static void GetBackgroundColorRGBA(
rgba[i] -= Ttk_ContrastDelta*contrast / 255.0;
}
}
- if (save && winPtr->privatePtr) {
- winPtr->privatePtr->flags |= TTK_HAS_CONTRASTING_BG;
- for (int i = 0; i < 4; i++) {
- winPtr->privatePtr->fillRGBA[i] = rgba[i];
- }
- }
+ if (save && winPtr->privatePtr) {
+ winPtr->privatePtr->flags |= TTK_HAS_CONTRASTING_BG;
+ for (int i = 0; i < 4; i++) {
+ winPtr->privatePtr->fillRGBA[i] = rgba[i];
+ }
+ }
}
}
@@ -931,8 +921,8 @@ DrawHelpSymbol(
NSColor *foreground = state & TTK_STATE_DISABLED ?
[NSColor disabledControlTextColor] : [NSColor controlTextColor];
NSDictionary *attrs = @{
- NSForegroundColorAttributeName : foreground,
- NSFontAttributeName : font
+ NSForegroundColorAttributeName : foreground,
+ NSFontAttributeName : font
};
NSAttributedString *attributedString = [[NSAttributedString alloc]
initWithString:@"?"
@@ -1505,10 +1495,10 @@ DrawTab(
if (!(state & TTK_STATE_SELECTED)) {
DrawGrayButton(context, bounds, &tabDesign, state, tkwin);
- /*
- * Draw a separator line on the left side of the tab if it
- * not first.
- */
+ /*
+ * Draw a separator line on the left side of the tab if it
+ * not first.
+ */
if (!(state & TTK_STATE_FIRST)) {
CGContextSaveGState(context);
@@ -1653,20 +1643,20 @@ static void ButtonElementMinSize(
if (params->heightMetric != NoThemeMetric) {
ChkErr(GetThemeMetric, params->heightMetric, minHeight);
- /*
- * The theme height does not include the 1-pixel border around
- * the button, although it does include the 1-pixel shadow at
- * the bottom.
- */
+ /*
+ * The theme height does not include the 1-pixel border around
+ * the button, although it does include the 1-pixel shadow at
+ * the bottom.
+ */
*minHeight += 2;
- /*
- * For buttons with labels the minwidth must be 0 to force the
- * correct text layout. For example, a non-zero value will cause the
- * text to be left justified, no matter what -anchor setting is used in
- * the style.
- */
+ /*
+ * For buttons with labels the minwidth must be 0 to force the
+ * correct text layout. For example, a non-zero value will cause the
+ * text to be left justified, no matter what -anchor setting is used in
+ * the style.
+ */
if (params->widthMetric != NoThemeMetric) {
ChkErr(GetThemeMetric, params->widthMetric, minWidth);
@@ -1700,10 +1690,10 @@ static void ButtonElementSize(
return;
case TkGradientButton:
*paddingPtr = Ttk_MakePadding(1, 1, 1, 1);
- /* Fall through. */
+ /* Fall through. */
case kThemeArrowButton:
case kThemeRoundButtonHelp:
- return;
+ return;
/* Buttons which are sized like PushButtons but unknown to HITheme. */
case TkRoundedRectButton:
case TkRecessedButton:
@@ -1711,7 +1701,7 @@ static void ButtonElementSize(
info.kind = kThemePushButton;
break;
default:
- break;
+ break;
}
/*
@@ -2152,14 +2142,14 @@ static void EntryElementDraw(
.isFocused = state & TTK_STATE_FOCUS,
};
- /*
- * Earlier versions of the Aqua theme ignored the -fieldbackground
- * option and used the -background as if it were -fieldbackground.
- * Here we are enabling -fieldbackground. For backwards
- * compatibility, if -fieldbackground is set to the default color and
- * -background is set to a different color then we use -background as
- * -fieldbackground.
- */
+ /*
+ * Earlier versions of the Aqua theme ignored the -fieldbackground
+ * option and used the -background as if it were -fieldbackground.
+ * Here we are enabling -fieldbackground. For backwards
+ * compatibility, if -fieldbackground is set to the default color and
+ * -background is set to a different color then we use -background as
+ * -fieldbackground.
+ */
if (0 != strcmp(Tcl_GetString(e->fieldbackgroundObj), defaultBG)) {
backgroundPtr =
@@ -2828,14 +2818,14 @@ static void ThumbElementDraw(
CGRect troughBounds = {{macWin->xOff, macWin->yOff},
{Tk_Width(tkwin), Tk_Height(tkwin)}};
- /*
- * The info struct has integer fields, which will be converted to
- * floats in the drawing routine. All of values provided in the info
- * struct, namely min, max, value, and viewSize are only defined up to
- * an arbitrary scale factor. To avoid roundoff error we scale so
- * that the viewSize is a large float which is smaller than the
- * largest int.
- */
+ /*
+ * The info struct has integer fields, which will be converted to
+ * floats in the drawing routine. All of values provided in the info
+ * struct, namely min, max, value, and viewSize are only defined up to
+ * an arbitrary scale factor. To avoid roundoff error we scale so
+ * that the viewSize is a large float which is smaller than the
+ * largest int.
+ */
HIThemeTrackDrawInfo info = {
.version = 0,
@@ -2941,7 +2931,7 @@ static void SeparatorElementDraw(
CGRect bounds = BoxToRect(d, b);
const HIThemeSeparatorDrawInfo info = {
.version = 0,
- /* Separator only supports kThemeStateActive, kThemeStateInactive */
+ /* Separator only supports kThemeStateActive, kThemeStateInactive */
.state = Ttk_StateTableLookup(ThemeStateTable,
state & TTK_STATE_BACKGROUND),
};
@@ -3004,7 +2994,7 @@ static void SizegripElementDraw(
CGRect bounds = BoxToRect(d, b);
HIThemeGrowBoxDrawInfo info = {
.version = 0,
- /* Grow box only supports kThemeStateActive, kThemeStateInactive */
+ /* Grow box only supports kThemeStateActive, kThemeStateInactive */
.state = Ttk_StateTableLookup(ThemeStateTable,
state & TTK_STATE_BACKGROUND),
.kind = kHIThemeGrowBoxKindNormal,
@@ -3295,10 +3285,10 @@ static void TreeHeaderElementDraw(
BEGIN_DRAWING(d)
if ([NSApp macOSVersion] > 100800) {
- /*
- * Compensate for the padding added in TreeHeaderElementSize, so
- * the larger heading will be drawn at the top of the widget.
- */
+ /*
+ * Compensate for the padding added in TreeHeaderElementSize, so
+ * the larger heading will be drawn at the top of the widget.
+ */
bounds.origin.y -= 4;
DrawListHeader(bounds, dc.context, tkwin, state);
@@ -3484,13 +3474,13 @@ TTK_LAYOUT("TSpinbox",
TTK_LAYOUT("TEntry",
TTK_GROUP("Entry.field", TTK_FILL_BOTH|TTK_BORDER,
- TTK_GROUP("Entry.padding", TTK_FILL_BOTH,
+ TTK_GROUP("Entry.padding", TTK_FILL_BOTH,
TTK_NODE("Entry.textarea", TTK_FILL_BOTH))))
/* Searchbox */
TTK_LAYOUT("Searchbox",
TTK_GROUP("Searchbox.field", TTK_FILL_BOTH|TTK_BORDER,
- TTK_GROUP("Entry.padding", TTK_FILL_BOTH,
+ TTK_GROUP("Entry.padding", TTK_FILL_BOTH,
TTK_NODE("Entry.textarea", TTK_FILL_BOTH))))
/* Progress bars -- track only */