diff options
author | pinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-29 20:16:50 +0000 |
---|---|---|
committer | pinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-29 20:16:50 +0000 |
commit | 842ad85cac86edad3036a20d8680de63f00bcb7c (patch) | |
tree | ccf41938711814ed5599bbf1b9bd8521019d2a6e /chrome/browser | |
parent | 55683e21a68a2c0df23c126c4a002054bad5725d (diff) | |
download | chromium_src-842ad85cac86edad3036a20d8680de63f00bcb7c.zip chromium_src-842ad85cac86edad3036a20d8680de63f00bcb7c.tar.gz chromium_src-842ad85cac86edad3036a20d8680de63f00bcb7c.tar.bz2 |
Create a new type of button cell for bookmark bar buttons that don't darken when pressed, leaving "standard" buttons (like used on the toolbar) to darken as expected.
BUG=44574
TEST=test bookmark buttons and toolbar buttons with different themes, make sure the appearance isn't crappy
Review URL: http://codereview.chromium.org/2866031
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51154 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/cocoa/bookmark_bar_controller.mm | 1 | ||||
-rw-r--r-- | chrome/browser/cocoa/bookmark_bar_folder_controller.mm | 1 | ||||
-rw-r--r-- | chrome/browser/cocoa/gradient_button_cell.h | 4 | ||||
-rw-r--r-- | chrome/browser/cocoa/gradient_button_cell.mm | 5 |
4 files changed, 9 insertions, 2 deletions
diff --git a/chrome/browser/cocoa/bookmark_bar_controller.mm b/chrome/browser/cocoa/bookmark_bar_controller.mm index 4d91c88..b918707 100644 --- a/chrome/browser/cocoa/bookmark_bar_controller.mm +++ b/chrome/browser/cocoa/bookmark_bar_controller.mm @@ -1377,6 +1377,7 @@ const NSTimeInterval kBookmarkBarAnimationDuration = 0.12; contextMenu:menu cellText:nil cellImage:image]; + [cell setTag:kStandardButtonTypeWithLimitedClickFeedback]; // Note: a quirk of setting a cell's text color is that it won't work // until the cell is associated with a button, so we can't theme the cell yet. diff --git a/chrome/browser/cocoa/bookmark_bar_folder_controller.mm b/chrome/browser/cocoa/bookmark_bar_folder_controller.mm index 1d4fa9f..d6f9b76 100644 --- a/chrome/browser/cocoa/bookmark_bar_folder_controller.mm +++ b/chrome/browser/cocoa/bookmark_bar_folder_controller.mm @@ -182,6 +182,7 @@ const CGFloat kScrollWindowVerticalMargin = 0.0; contextMenu:menu cellText:nil cellImage:image]; + [cell setTag:kStandardButtonTypeWithLimitedClickFeedback]; return cell; } diff --git a/chrome/browser/cocoa/gradient_button_cell.h b/chrome/browser/cocoa/gradient_button_cell.h index a485f63..72b3c30 100644 --- a/chrome/browser/cocoa/gradient_button_cell.h +++ b/chrome/browser/cocoa/gradient_button_cell.h @@ -24,6 +24,10 @@ enum { kStandardButtonType = 0, kRightButtonType = 1, kMiddleButtonType = 2, + // Draws like a standard button, except when clicked where the interior + // doesn't darken using the theme's "pressed" gradient. Instead uses the + // normal un-pressed gradient. + kStandardButtonTypeWithLimitedClickFeedback = 3, }; typedef NSInteger ButtonType; diff --git a/chrome/browser/cocoa/gradient_button_cell.mm b/chrome/browser/cocoa/gradient_button_cell.mm index d6bd544..4c3eaea 100644 --- a/chrome/browser/cocoa/gradient_button_cell.mm +++ b/chrome/browser/cocoa/gradient_button_cell.mm @@ -226,8 +226,9 @@ static const NSTimeInterval kAnimationHideDuration = 0.4; [innerPath fill]; } else { if (showClickedGradient) { - NSGradient* clickedGradient; - if (isFlatButton) { + NSGradient* clickedGradient = nil; + if (isFlatButton && + [self tag] == kStandardButtonTypeWithLimitedClickFeedback) { clickedGradient = gradient; } else { clickedGradient = themeProvider ? themeProvider->GetNSGradient( |