aboutsummaryrefslogtreecommitdiff
path: root/AppKit
diff options
context:
space:
mode:
authorGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2009-11-05 21:34:23 +0000
committerGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2009-11-05 21:34:23 +0000
commite2d01bf4bbfebd3ee8205238b230990aa326dc05 (patch)
treeb6866bd2a258158c7f7439fc2fcbbdc2ccc4b1de /AppKit
parent1206dc74b7f08a50f12ac686b03c1ad5088d4de9 (diff)
[Author: dmaclach]
Fix up GTMTheme so that it returns a color for iconColorForStyle:state: and so that it doesn't broadcast notifications whenever the background color is changed. We need this class cleaned up. It's a real mess. http://code.google.com/p/google-toolbox-for-mac/issues/detail?id=37 R=thomasvl DELTA=12 (6 added, 3 deleted, 3 changed)
Diffstat (limited to 'AppKit')
-rw-r--r--AppKit/GTMTheme.m17
1 files changed, 10 insertions, 7 deletions
diff --git a/AppKit/GTMTheme.m b/AppKit/GTMTheme.m
index 7b966f9..bb197fe 100644
--- a/AppKit/GTMTheme.m
+++ b/AppKit/GTMTheme.m
@@ -137,9 +137,9 @@ NSString *const kGTMThemeBackgroundColorKey = @"GTMThemeBackgroundColor";
}
- (void)sendChangeNotification {
- [[NSNotificationCenter defaultCenter]
- postNotificationName:kGTMThemeDidChangeNotification
- object:self];
+ NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
+ [nc postNotificationName:kGTMThemeDidChangeNotification
+ object:self];
}
- (id)keyForSelector:(SEL)selector
@@ -191,8 +191,6 @@ NSString *const kGTMThemeBackgroundColorKey = @"GTMThemeBackgroundColor";
if (backgroundColor_ != value) {
[backgroundColor_ release];
backgroundColor_ = [value retain];
- [values_ removeAllObjects];
- [self sendChangeNotification];
}
}
- (NSColor *)backgroundColor {
@@ -206,7 +204,6 @@ NSString *const kGTMThemeBackgroundColorKey = @"GTMThemeBackgroundColor";
if (backgroundImage_ != value) {
[backgroundImage_ release];
backgroundImage_ = [value retain];
- [self sendChangeNotification];
}
}
@@ -484,7 +481,13 @@ NSString *const kGTMThemeBackgroundColorKey = @"GTMThemeBackgroundColor";
state:(GTMThemeState)state {
NSColor *color = [self valueForSelector:_cmd style:style state:state];
if (color) return color;
-
+
+ if ([self styleIsDark:style state:state]) {
+ color = [NSColor whiteColor];
+ } else {
+ color = [NSColor blackColor];
+ }
+
[self cacheValue:color forSelector:_cmd style:style state:state];
return color;
}