diff options
author | pinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-06 21:14:57 +0000 |
---|---|---|
committer | pinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-06 21:14:57 +0000 |
commit | 1e89d3a996da488a3145590e86049dca233fed29 (patch) | |
tree | f397d78cb46b6f9628db2a19f15e78105fdd0e31 /chrome | |
parent | a5e173f756e57f9470e0d5695b5221f8daae269d (diff) | |
download | chromium_src-1e89d3a996da488a3145590e86049dca233fed29.zip chromium_src-1e89d3a996da488a3145590e86049dca233fed29.tar.gz chromium_src-1e89d3a996da488a3145590e86049dca233fed29.tar.bz2 |
Correctly initialize all parts of the tab to unselected when it's created, keeping it in sync with the member var.
Review URL: http://codereview.chromium.org/62074
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13192 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/cocoa/tab_controller.mm | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/chrome/browser/cocoa/tab_controller.mm b/chrome/browser/cocoa/tab_controller.mm index 7d0f5e5..09eb5c6 100644 --- a/chrome/browser/cocoa/tab_controller.mm +++ b/chrome/browser/cocoa/tab_controller.mm @@ -32,12 +32,21 @@ [super dealloc]; } +// The internals of |-setSelected:| but doesn't check if we're already set +// to |selected|. Pass the selection change to the subviews that need it and +// mark ourselves as needing a redraw. +- (void)internalSetSelected:(BOOL)selected { + selected_ = selected; + [backgroundButton_ setState:selected]; + [[self view] setNeedsDisplay:YES]; +} + // Called when the tab's nib is done loading and all outlets are hooked up. - (void)awakeFromNib { [[self view] addSubview:backgroundButton_ positioned:NSWindowBelow relativeTo:nil]; - [self setSelected:NO]; + [self internalSetSelected:selected_]; } - (IBAction)closeTab:(id)sender { @@ -48,11 +57,8 @@ } - (void)setSelected:(BOOL)selected { - if (selected_ != selected) { - selected_ = selected; - [backgroundButton_ setState:selected]; - [[self view] setNeedsDisplay:YES]; - } + if (selected_ != selected) + [self internalSetSelected:selected]; } - (BOOL)selected { |