summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/tab_controller.mm
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-09 22:37:55 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-09 22:37:55 +0000
commitd546029a268e19c244bcbfba57e4bd2d39d44a83 (patch)
tree82090113ed3095ac5db6fe5610a908846b7cf0ec /chrome/browser/cocoa/tab_controller.mm
parent8717745b839efbe446902f3449a3a348f687a42f (diff)
downloadchromium_src-d546029a268e19c244bcbfba57e4bd2d39d44a83.zip
chromium_src-d546029a268e19c244bcbfba57e4bd2d39d44a83.tar.gz
chromium_src-d546029a268e19c244bcbfba57e4bd2d39d44a83.tar.bz2
Several theming fixes for the Mac. Sorry for the extensive change, but they
were all sort of intertwined. Fixes up patterns in general so that they are all in phase. Moves the window widget buttons down by two pixels. Draws overlays correctly. Fixes up some accessibility issues with the default window widgets. Gets rid of some out of date files (tab_cell). BUG=18438, 18547, 19851, 20295, 22213, 23651, 24338 TEST=Launch Chrome. Switch to "dots" theme from the Google themes. Create a couple of tabs. Check to make sure that the background pattern line up with the tabs. Move the tabs around. Check that the hightlight colors and text colors look correct for all of the tabs. Make sure the patterns stay lined up. Resize the window, make sure none of the patterns move around. Create new windows by dragging the tabs out of the windows and make sure a new window is created with the correct pattern. Show the "find" bar. Make sure its pattern lines up correctly with the tabbar. Switch to default theme. Make sure it looks correct and draws properly. Switch to Zen theme and make sure that the overlay at the top draws correctly. Create a new window. make sure that the rollovers in the window widgets work correctly in both the active and inactive window. Mouse down on the zoom button in the inactive window and notice that the window context changes. Move off of the zoom button and mouse up. Mouse down on the miniaturize button on the inactive window and notice that the window context does not change. Move off of the miniaturize button and mouse up. Do the same thing you did for the miniaturize button for the close button. Start up Accessibility Inspector from the developer tools. Make sure that the window widgets report their accessibility information correctly. Review URL: http://codereview.chromium.org/260009 Patch from dmaclach@chromium.org. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28613 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/tab_controller.mm')
-rw-r--r--chrome/browser/cocoa/tab_controller.mm60
1 files changed, 34 insertions, 26 deletions
diff --git a/chrome/browser/cocoa/tab_controller.mm b/chrome/browser/cocoa/tab_controller.mm
index 64207f9..94de7cfc 100644
--- a/chrome/browser/cocoa/tab_controller.mm
+++ b/chrome/browser/cocoa/tab_controller.mm
@@ -33,11 +33,15 @@
self = [super initWithNibName:@"TabView" bundle:mac_util::MainAppBundle()];
if (self != nil) {
isIconShowing_ = YES;
- [[NSNotificationCenter defaultCenter]
- addObserver:self
- selector:@selector(viewResized:)
- name:NSViewFrameDidChangeNotification
- object:[self view]];
+ NSNotificationCenter* defaultCenter = [NSNotificationCenter defaultCenter];
+ [defaultCenter addObserver:self
+ selector:@selector(viewResized:)
+ name:NSViewFrameDidChangeNotification
+ object:[self view]];
+ [defaultCenter addObserver:self
+ selector:@selector(themeChangedNotification:)
+ name:kGTMThemeDidChangeNotification
+ object:nil];
}
return self;
}
@@ -52,9 +56,10 @@
// mark ourselves as needing a redraw.
- (void)internalSetSelected:(BOOL)selected {
selected_ = selected;
- [(TabView *)[self view] setState:selected];
+ TabView* tabView = static_cast<TabView*>([self view]);
+ [tabView setState:selected];
[self updateVisibility];
- [self applyTheme];
+ [self updateTitleColor];
}
// Called when the tab's nib is done loading and all outlets are hooked up.
@@ -71,9 +76,6 @@
iconTitleXOffset_ = NSMinX(titleFrame) - NSMinX(originalIconFrame_);
titleCloseWidthOffset_ = NSMaxX([closeButton_ frame]) - NSMaxX(titleFrame);
- // Ensure we don't show favicon if the tab is already too small to begin with.
- [self updateVisibility];
-
[self internalSetSelected:selected_];
}
@@ -100,7 +102,7 @@
return [[self target] isCommandEnabled:command forController:self];
}
-- (void)setTitle:(NSString *)title {
+- (void)setTitle:(NSString*)title {
[[self view] setToolTip:title];
[super setTitle:title];
}
@@ -131,7 +133,7 @@
return iconView_;
}
-- (NSString *)toolTip {
+- (NSString*)toolTip {
return [[self view] toolTip];
}
@@ -212,6 +214,21 @@
[titleView_ setFrame:titleFrame];
}
+- (void)updateTitleColor {
+ NSColor* titleColor = nil;
+ GTMTheme* theme = [[self view] gtm_theme];
+ if (![self selected]) {
+ titleColor = [theme textColorForStyle:GTMThemeStyleTabBarDeselected
+ state:GTMThemeStateActiveWindow];
+ }
+ // Default to the selected text color unless told otherwise.
+ if (!titleColor) {
+ titleColor = [theme textColorForStyle:GTMThemeStyleTabBarSelected
+ state:GTMThemeStateActiveWindow];
+ }
+ [titleView_ setTextColor:titleColor ? titleColor : [NSColor textColor]];
+}
+
// Called when our view is resized. If it gets too small, start by hiding
// the close button and only show it if tab is selected. Eventually, hide the
// icon as well. We know that this is for our view because we only registered
@@ -220,21 +237,12 @@
[self updateVisibility];
}
-- (void)applyTheme {
- GTMTheme* theme = [[self view] gtm_theme];
- NSColor* color = nil;
- if (!selected_) {
- color = [theme textColorForStyle:GTMThemeStyleTabBarDeselected
- state:GTMThemeStateActiveWindow];
+- (void)themeChangedNotification:(NSNotification*)notification {
+ GTMTheme* theme = [notification object];
+ NSView* view = [self view];
+ if ([theme isEqual:[view gtm_theme]]) {
+ [self updateTitleColor];
}
- // Default to the selected text color unless told otherwise.
- if (!color) {
- color = [theme textColorForStyle:GTMThemeStyleToolBar
- state:GTMThemeStateActiveWindow];
- }
-
- [titleView_ setTextColor:color ? color : [NSColor textColor]];
- [[self view] setNeedsDisplay:YES];
}
// Called by the tabs to determine whether we are in rapid (tab) closure mode.