-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMainController.m
More file actions
65 lines (49 loc) · 1.58 KB
/
Copy pathMainController.m
File metadata and controls
65 lines (49 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#import "MainController.h"
@implementation MainController
- (void)awakeFromNib
{
myBadge = [[CTBadge alloc] init];
[self setBadgeValue:scroller];
[[NSColorPanel sharedColorPanel] setShowsAlpha:YES];
}
- (void)windowWillClose:(NSNotification *)aNotification
{
RestoreApplicationDockTileImage();
[NSApp terminate:self];
}
- (IBAction)setBadgeValue:(id)sender
{
int value = [sender intValue];
[largeBadgeView setImage:[myBadge largeBadgeForValue:value]];
[smallBadgeView setImage:[myBadge smallBadgeForValue:value]];
[myBadge badgeApplicationDockIconWithValue:value insetX:3 y:0];
//[[[myBadge largeBadgeForValue:value] TIFFRepresentation] writeToFile:@"/tmp/badge.tif" atomically:NO];
}
- (IBAction)setBadgeColor:(id)sender
{
[myBadge setBadgeColor:[sender color]];
[self setBadgeValue:scroller];
}
- (IBAction)setLabelColor:(id)sender
{
[myBadge setLabelColor:[sender color]];
[self setBadgeValue:scroller];
}
- (IBAction)setApplicationIcon:(id)sender
{
NSOpenPanel *openPanel = [NSOpenPanel openPanel];
int result = [openPanel runModalForDirectory:NSHomeDirectory() file:nil types:[NSArray arrayWithObject:@"icns"]];
if(result == NSOKButton)
{
[self application:nil openFile:[openPanel filename]];
}
}
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
{
NSImage *newAppIcon = [[NSImage alloc] initWithContentsOfFile:filename];
[(NSImage *)[NSImage imageNamed:@"NSApplicationIcon"] setName:nil];
[newAppIcon setName:@"NSApplicationIcon"];
[self setBadgeValue:scroller];
return YES;
}
@end