-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathPrintableString.m
More file actions
77 lines (64 loc) · 1.43 KB
/
Copy pathPrintableString.m
File metadata and controls
77 lines (64 loc) · 1.43 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
66
67
68
69
70
71
72
73
74
75
76
77
//
// PrintableString.m
// Atari800MacX
//
// Created by Mark Grebe on Sat Mar 19 2005.
// Copyright (c) 2005 __MyCompanyName__. All rights reserved.
//
#import "PrintableString.h"
@implementation PrintableString
-(id)init
{
return [self initWithAttributedSting:nil];
}
-(id)initWithAttributedSting:(NSAttributedString *)attributedString
{
if (self = [super init]) {
_contents = attributedString ? [attributedString mutableCopy] :
[[NSMutableAttributedString alloc] init];
}
return self;
}
-(NSString *)string
{
return [_contents string];
}
-(NSDictionary *)attributesAtIndex:(unsigned)location
effectiveRange:(NSRange *)range
{
return [_contents attributesAtIndex:location effectiveRange:range];
}
-(void)replaceCharactersInRange:(NSRange)range
withString:(NSString *)string
{
[_contents replaceCharactersInRange:range withString:string];
}
-(void)setAttributes:(NSDictionary *)attributes
range:(NSRange)range
{
[_contents setAttributes:attributes range:range];
}
-(void)dealloc
{
[_contents release];
[super dealloc];
}
-(void) setLocation:(NSPoint)location
{
printLocation = location;
}
-(void)print:(NSRect)rect:(float)offset
{
if ((printLocation.y >= rect.origin.y-12.0) &&
(printLocation.y <= (rect.origin.y + rect.size.height + 12.0)))
[self drawAtPoint:printLocation];
}
-(float)getYLocation
{
return printLocation.y;
}
-(float)getMinYLocation
{
return printLocation.y;
}
@end