Browse Source

Changes to accommodate new redesigned icon.

v1.2.3
Abhishek Banthia 9 years ago
parent
commit
f489820780
  1. 29
      Clocker/StatusItemView.m

29
Clocker/StatusItemView.m

@ -74,39 +74,38 @@
{ {
CLTimezoneData *timezoneObject = [CLTimezoneData getCustomObject:dataObject]; CLTimezoneData *timezoneObject = [CLTimezoneData getCustomObject:dataObject];
textField.stringValue = [timezoneObject getMenuTitle]; textField.stringValue = [timezoneObject getMenuTitle];
}
else
{
textField.stringValue = [[NSDate date] formattedDateWithFormat:@"MMM dd HH:mm"
timeZone:[NSTimeZone systemTimeZone]
locale:[NSLocale currentLocale]];
}
[textField sizeToFit];
// Set up dark mode for icon // Set up dark mode for icon
if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle"] isEqual: @"Dark"]) if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle"] isEqual: @"Dark"])
{ {
textField.backgroundColor = [NSColor whiteColor]; textField.textColor = [NSColor whiteColor];
textField.textColor = [NSColor blackColor];
self.image = [self imageWithSubviewsWithTextField:textField]; self.image = [self imageWithSubviewsWithTextField:textField];
} }
else else
{ {
textField.backgroundColor = [NSColor blackColor]; textField.textColor = [NSColor blackColor];
textField.textColor = [NSColor whiteColor];
self.image = [self imageWithSubviewsWithTextField:textField]; self.image = [self imageWithSubviewsWithTextField:textField];
} }
[textField sizeToFit];
NSDisableScreenUpdates(); NSDisableScreenUpdates();
[self.statusItem setLength:textField.frame.size.width+10]; [self.statusItem setLength:textField.frame.size.width+10];
NSEnableScreenUpdates(); NSEnableScreenUpdates();
CGRect newRect = CGRectMake(dirtyRect.origin.x, dirtyRect.origin.y, textField.frame.size.width+5, dirtyRect.size.height); CGRect newRect = CGRectMake(dirtyRect.origin.x, dirtyRect.origin.y, textField.frame.size.width+5, dirtyRect.size.height);
[self.statusItem drawStatusBarBackgroundInRect:newRect withHighlight:NO]; [self.statusItem drawStatusBarBackgroundInRect:newRect withHighlight:NO];
}
else
{
self.image = [NSImage imageNamed:@"MenuIcon"];
self.statusItem.length = 24;
[self.statusItem drawStatusBarBackgroundInRect:CGRectMake(0, 0, self.image.size.width, self.image.size.height) withHighlight:NO];
}
NSImage *icon = self.image; NSImage *icon = self.image;
NSSize iconSize = [icon size]; NSSize iconSize = [icon size];
NSRect bounds = self.bounds; NSRect bounds = self.bounds;

Loading…
Cancel
Save