Browse Source

Changes to accommodate new redesigned icon.

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

51
Clocker/StatusItemView.m

@ -74,38 +74,37 @@
{
CLTimezoneData *timezoneObject = [CLTimezoneData getCustomObject:dataObject];
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
if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle"] isEqual: @"Dark"])
{
textField.textColor = [NSColor whiteColor];
self.image = [self imageWithSubviewsWithTextField:textField];
}
else
{
textField.textColor = [NSColor blackColor];
self.image = [self imageWithSubviewsWithTextField:textField];
}
[textField sizeToFit];
NSDisableScreenUpdates();
[self.statusItem setLength:textField.frame.size.width+10];
NSEnableScreenUpdates();
CGRect newRect = CGRectMake(dirtyRect.origin.x, dirtyRect.origin.y, textField.frame.size.width+5, dirtyRect.size.height);
[self.statusItem drawStatusBarBackgroundInRect:newRect withHighlight:NO];
// Set up dark mode for icon
if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle"] isEqual: @"Dark"])
{
textField.backgroundColor = [NSColor whiteColor];
textField.textColor = [NSColor blackColor];
self.image = [self imageWithSubviewsWithTextField:textField];
}
else
{
textField.backgroundColor = [NSColor blackColor];
textField.textColor = [NSColor whiteColor];
self.image = [self imageWithSubviewsWithTextField:textField];
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];
}
NSDisableScreenUpdates();
[self.statusItem setLength:textField.frame.size.width+10];
NSEnableScreenUpdates();
CGRect newRect = CGRectMake(dirtyRect.origin.x, dirtyRect.origin.y, textField.frame.size.width+5, dirtyRect.size.height);
[self.statusItem drawStatusBarBackgroundInRect:newRect withHighlight:NO];
NSImage *icon = self.image;
NSSize iconSize = [icon size];

Loading…
Cancel
Save