-
Notifications
You must be signed in to change notification settings - Fork 2
/
UserImageRep.m
55 lines (43 loc) · 1.24 KB
/
UserImageRep.m
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
//
// UserImage.m
// CronniX
//
// Created by sas on Sun Jun 10 2001.
// Copyright (c) 2001 __CompanyName__. All rights reserved.
//
#import "UserImageRep.h"
@implementation UserImageRep
- (id)initWithUserName: (NSString *)username {
[ self setUser: username ];
return [ self init ];
}
- (id)init {
return [ self initWithDrawSelector: @selector(draw) delegate: self ];
}
- (id)initWithDrawSelector: (SEL)method delegate: (id)object {
if ( self = [ super initWithDrawSelector: method delegate: object ] ) {
}
return self;
}
- (void)dealloc {
[ user release ];
}
- (void) setUser: (NSString *)name {
[ user autorelease ];
if ( name )
user = [ name copy ];
else
user = [ [ NSString alloc ] initWithString: @"" ];
}
- (NSString *)user {
return user;
}
- (BOOL)draw {
NSMutableDictionary *attrs = [ NSMutableDictionary dictionary ];
[ attrs setObject: [ NSFont systemFontOfSize: 10 ] forKey: NSFontAttributeName ];
[ @"Crontab for user:" drawAtPoint: NSMakePoint( 5, 15 ) withAttributes: attrs ];
[ attrs setObject: [ NSColor blueColor ] forKey: NSForegroundColorAttributeName ];
[ [ self user ] drawAtPoint: NSMakePoint( 5, 5 ) withAttributes: attrs ];
return YES;
}
@end