diff --git a/AppKit/CPButton.j b/AppKit/CPButton.j index c95f8a752..e3eb6a302 100644 --- a/AppKit/CPButton.j +++ b/AppKit/CPButton.j @@ -70,7 +70,13 @@ CPPushInCellMask = CPPushInButtonMask; CPChangeGrayCellMask = CPGrayButtonMask; CPChangeBackgroundCellMask = CPBackgroundButtonMask; -CPButtonStateMixed = CPThemeState("mixed"); +CPButtonStateMixed = CPThemeState("mixed"); +CPButtonStateBezelStyleRounded = CPThemeState("rounded"); + +// add all future correspondance between bezel styles and theme state here. +var CPButtonBezelStyleStateMap = [CPDictionary dictionaryWithObjects:[CPButtonStateBezelStyleRounded, nil] + forKeys:[CPRoundedBezelStyle, CPRoundRectBezelStyle]]; + CPButtonDefaultHeight = 24.0; CPButtonImageOffset = 3.0; @@ -151,7 +157,7 @@ CPButtonImageOffset = 3.0; _keyEquivalent = @""; _keyEquivalentModifierMask = 0; -// [self setBezelStyle:CPRoundRectBezelStyle]; + [self setBezelStyle:CPRoundRectBezelStyle]; [self setBordered:YES]; } @@ -678,10 +684,24 @@ CPButtonImageOffset = 3.0; - (void)setBezelStyle:(unsigned)aBezelStyle { + if (aBezelStyle === _bezelStyle) + return; + + var currentState = [CPButtonBezelStyleStateMap objectForKey:_bezelStyle], + newState = [CPButtonBezelStyleStateMap objectForKey:aBezelStyle]; + + if (currentState) + [self unsetThemeState:currentState]; + + if (newState) + [self setThemeState:newState]; + + _bezelStyle = aBezelStyle; } - (unsigned)bezelStyle { + return _bezelStyle; } @end diff --git a/AppKit/Themes/Aristo/Resources/button-bezel-rounded-center.png b/AppKit/Themes/Aristo/Resources/button-bezel-rounded-center.png new file mode 100644 index 000000000..2b147e622 Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/button-bezel-rounded-center.png differ diff --git a/AppKit/Themes/Aristo/Resources/button-bezel-rounded-disabled-center.png b/AppKit/Themes/Aristo/Resources/button-bezel-rounded-disabled-center.png new file mode 100644 index 000000000..8000b5c69 Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/button-bezel-rounded-disabled-center.png differ diff --git a/AppKit/Themes/Aristo/Resources/button-bezel-rounded-disabled-left.png b/AppKit/Themes/Aristo/Resources/button-bezel-rounded-disabled-left.png new file mode 100644 index 000000000..839fa35d7 Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/button-bezel-rounded-disabled-left.png differ diff --git a/AppKit/Themes/Aristo/Resources/button-bezel-rounded-disabled-right.png b/AppKit/Themes/Aristo/Resources/button-bezel-rounded-disabled-right.png new file mode 100644 index 000000000..3b5a71186 Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/button-bezel-rounded-disabled-right.png differ diff --git a/AppKit/Themes/Aristo/Resources/button-bezel-rounded-highlighted-center.png b/AppKit/Themes/Aristo/Resources/button-bezel-rounded-highlighted-center.png new file mode 100644 index 000000000..1b8d4ac2d Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/button-bezel-rounded-highlighted-center.png differ diff --git a/AppKit/Themes/Aristo/Resources/button-bezel-rounded-highlighted-left.png b/AppKit/Themes/Aristo/Resources/button-bezel-rounded-highlighted-left.png new file mode 100644 index 000000000..a07ea1ec3 Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/button-bezel-rounded-highlighted-left.png differ diff --git a/AppKit/Themes/Aristo/Resources/button-bezel-rounded-highlighted-right.png b/AppKit/Themes/Aristo/Resources/button-bezel-rounded-highlighted-right.png new file mode 100644 index 000000000..c4d248bd2 Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/button-bezel-rounded-highlighted-right.png differ diff --git a/AppKit/Themes/Aristo/Resources/button-bezel-rounded-left.png b/AppKit/Themes/Aristo/Resources/button-bezel-rounded-left.png new file mode 100644 index 000000000..6b2617414 Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/button-bezel-rounded-left.png differ diff --git a/AppKit/Themes/Aristo/Resources/button-bezel-rounded-right.png b/AppKit/Themes/Aristo/Resources/button-bezel-rounded-right.png new file mode 100644 index 000000000..04c7af05f Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/button-bezel-rounded-right.png differ diff --git a/AppKit/Themes/Aristo/Resources/default-button-bezel-rounded-center.png b/AppKit/Themes/Aristo/Resources/default-button-bezel-rounded-center.png new file mode 100644 index 000000000..1d540df8e Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/default-button-bezel-rounded-center.png differ diff --git a/AppKit/Themes/Aristo/Resources/default-button-bezel-rounded-disabled-center.png b/AppKit/Themes/Aristo/Resources/default-button-bezel-rounded-disabled-center.png new file mode 100644 index 000000000..f651063a9 Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/default-button-bezel-rounded-disabled-center.png differ diff --git a/AppKit/Themes/Aristo/Resources/default-button-bezel-rounded-disabled-left.png b/AppKit/Themes/Aristo/Resources/default-button-bezel-rounded-disabled-left.png new file mode 100644 index 000000000..eeb67ede3 Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/default-button-bezel-rounded-disabled-left.png differ diff --git a/AppKit/Themes/Aristo/Resources/default-button-bezel-rounded-disabled-right.png b/AppKit/Themes/Aristo/Resources/default-button-bezel-rounded-disabled-right.png new file mode 100644 index 000000000..30298940c Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/default-button-bezel-rounded-disabled-right.png differ diff --git a/AppKit/Themes/Aristo/Resources/default-button-bezel-rounded-highlighted-center.png b/AppKit/Themes/Aristo/Resources/default-button-bezel-rounded-highlighted-center.png new file mode 100644 index 000000000..b009e5b9e Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/default-button-bezel-rounded-highlighted-center.png differ diff --git a/AppKit/Themes/Aristo/Resources/default-button-bezel-rounded-highlighted-left.png b/AppKit/Themes/Aristo/Resources/default-button-bezel-rounded-highlighted-left.png new file mode 100644 index 000000000..4a292a1b5 Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/default-button-bezel-rounded-highlighted-left.png differ diff --git a/AppKit/Themes/Aristo/Resources/default-button-bezel-rounded-highlighted-right.png b/AppKit/Themes/Aristo/Resources/default-button-bezel-rounded-highlighted-right.png new file mode 100644 index 000000000..3ec6dddcd Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/default-button-bezel-rounded-highlighted-right.png differ diff --git a/AppKit/Themes/Aristo/Resources/default-button-bezel-rounded-left.png b/AppKit/Themes/Aristo/Resources/default-button-bezel-rounded-left.png new file mode 100644 index 000000000..127c89658 Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/default-button-bezel-rounded-left.png differ diff --git a/AppKit/Themes/Aristo/Resources/default-button-bezel-rounded-right.png b/AppKit/Themes/Aristo/Resources/default-button-bezel-rounded-right.png new file mode 100644 index 000000000..72aa04c72 Binary files /dev/null and b/AppKit/Themes/Aristo/Resources/default-button-bezel-rounded-right.png differ diff --git a/AppKit/Themes/Aristo/ThemeDescriptors.j b/AppKit/Themes/Aristo/ThemeDescriptors.j index 738d691b2..6f454db71 100755 --- a/AppKit/Themes/Aristo/ThemeDescriptors.j +++ b/AppKit/Themes/Aristo/ThemeDescriptors.j @@ -337,7 +337,8 @@ var themedButtonValues = nil, + (CPButton)button { var button = [self makeButton], - + + // RoundRect bezelColor = PatternColor( [ ["button-bezel-left.png", 4.0, 24.0], @@ -353,7 +354,15 @@ var themedButtonValues = nil, ["button-bezel-highlighted-right.png", 4.0, 24.0] ], PatternIsHorizontal), - + + disabledBezelColor = PatternColor( + [ + ["button-bezel-disabled-left.png", 4.0, 24.0], + ["button-bezel-disabled-center.png", 1.0, 24.0], + ["button-bezel-disabled-right.png", 4.0, 24.0] + ], + PatternIsHorizontal), + defaultBezelColor = PatternColor( [ ["default-button-bezel-left.png", 4.0, 24.0], @@ -378,13 +387,56 @@ var themedButtonValues = nil, ], PatternIsHorizontal), - disabledBezelColor = PatternColor( + + // Rounded + roundedBezelColor = PatternColor( [ - ["button-bezel-disabled-left.png", 4.0, 24.0], - ["button-bezel-disabled-center.png", 1.0, 24.0], - ["button-bezel-disabled-right.png", 4.0, 24.0] + ["button-bezel-rounded-left.png", 12.0, 24.0], + ["button-bezel-rounded-center.png", 1.0, 24.0], + ["button-bezel-rounded-right.png", 12.0, 24.0] ], PatternIsHorizontal), + + roundedHighlightedBezelColor = PatternColor( + [ + ["button-bezel-rounded-highlighted-left.png", 12.0, 24.0], + ["button-bezel-rounded-highlighted-center.png", 1.0, 24.0], + ["button-bezel-rounded-highlighted-right.png", 12.0, 24.0] + ], + PatternIsHorizontal), + + roundedDisabledBezelColor = PatternColor( + [ + ["button-bezel-rounded-disabled-left.png", 12.0, 24.0], + ["button-bezel-rounded-disabled-center.png", 1.0, 24.0], + ["button-bezel-rounded-disabled-right.png", 12.0, 24.0] + ], + PatternIsHorizontal), + + defaultRoundedBezelColor = PatternColor( + [ + ["default-button-bezel-rounded-left.png", 12.0, 24.0], + ["default-button-bezel-rounded-center.png", 1.0, 24.0], + ["default-button-bezel-rounded-right.png", 12.0, 24.0] + ], + PatternIsHorizontal), + + defaultRoundedHighlightedBezelColor = PatternColor( + [ + ["default-button-bezel-rounded-highlighted-left.png", 12.0, 24.0], + ["default-button-bezel-rounded-highlighted-center.png", 1.0, 24.0], + ["default-button-bezel-rounded-highlighted-right.png", 12.0, 24.0] + ], + PatternIsHorizontal), + + defaultRoundedDisabledBezelColor = PatternColor( + [ + ["default-button-bezel-rounded-disabled-left.png", 12.0, 24.0], + ["default-button-bezel-rounded-disabled-center.png", 1.0, 24.0], + ["default-button-bezel-rounded-disabled-right.png", 12.0, 24.0] + ], + PatternIsHorizontal), + defaultTextColor = [CPColor colorWithCalibratedRed:13.0 / 255.0 green:51.0 / 255.0 blue:70.0 / 255.0 alpha:1.0], defaultDisabledTextColor = [CPColor colorWithCalibratedRed:13.0 / 255.0 green:51.0 / 255.0 blue:70.0 / 255.0 alpha:0.6]; @@ -398,18 +450,27 @@ var themedButtonValues = nil, [@"text-shadow-offset", CGSizeMake(0.0, 1.0), CPThemeStateBordered], [@"line-break-mode", CPLineBreakByTruncatingTail], [@"content-inset", CGInsetMake(0.0, 7.0, 0.0, 7.0), CPThemeStateBordered], - - [@"bezel-color", bezelColor, CPThemeStateBordered], - [@"bezel-color", highlightedBezelColor, CPThemeStateBordered | CPThemeStateHighlighted], - - [@"text-color", [CPColor colorWithCalibratedWhite:0.6 alpha:1.0], CPThemeStateDisabled], - [@"bezel-color", disabledBezelColor, CPThemeStateBordered | CPThemeStateDisabled], - [@"bezel-color", defaultDisabledBezelColor, CPThemeStateBordered | CPThemeStateDefault | CPThemeStateDisabled], - - [@"text-color", defaultTextColor, CPThemeStateDefault], - [@"text-color", defaultDisabledTextColor, CPThemeStateDefault | CPThemeStateDisabled], + [@"bezel-color", bezelColor, CPThemeStateBordered], + [@"bezel-color", highlightedBezelColor, CPThemeStateBordered | CPThemeStateHighlighted], + [@"bezel-color", disabledBezelColor, CPThemeStateBordered | CPThemeStateDisabled], [@"bezel-color", defaultBezelColor, CPThemeStateBordered | CPThemeStateDefault], [@"bezel-color", defaultHighlightedBezelColor, CPThemeStateBordered | CPThemeStateHighlighted | CPThemeStateDefault], + [@"bezel-color", defaultDisabledBezelColor, CPThemeStateBordered | CPThemeStateDefault | CPThemeStateDisabled], + [@"content-inset", CGInsetMake(0.0, 5.0, 0.0, 5.0), CPThemeStateBordered], + + [@"bezel-color", roundedBezelColor, CPThemeStateBordered | CPButtonStateBezelStyleRounded], + [@"bezel-color", roundedHighlightedBezelColor, CPThemeStateBordered | CPThemeStateHighlighted | CPButtonStateBezelStyleRounded], + [@"bezel-color", roundedDisabledBezelColor, CPThemeStateBordered | CPThemeStateDisabled | CPButtonStateBezelStyleRounded], + [@"bezel-color", defaultRoundedBezelColor, CPThemeStateBordered | CPThemeStateDefault | CPButtonStateBezelStyleRounded], + [@"bezel-color", defaultRoundedHighlightedBezelColor, CPThemeStateBordered | CPThemeStateHighlighted | CPThemeStateDefault | CPButtonStateBezelStyleRounded], + [@"bezel-color", defaultRoundedDisabledBezelColor, CPThemeStateBordered | CPThemeStateDefault | CPThemeStateDisabled | CPButtonStateBezelStyleRounded], + [@"content-inset", CGInsetMake(0.0, 10.0, 0.0, 10.0), CPThemeStateBordered], + + [@"text-color", [CPColor colorWithCalibratedWhite:0.6 alpha:1.0], CPThemeStateDisabled], + + + [@"text-color", defaultTextColor, CPThemeStateDefault], + [@"text-color", defaultDisabledTextColor, CPThemeStateDefault | CPThemeStateDisabled], [@"min-size", CGSizeMake(0.0, CPButtonDefaultHeight)], [@"max-size", CGSizeMake(-1.0, CPButtonDefaultHeight)],