-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFMNWindowOrientation.m
74 lines (59 loc) · 1.5 KB
/
FMNWindowOrientation.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//
// FMNWindowOrientation.m
// FMN
//
// Created by David Noblet on 7/19/06.
// Copyright 2006 __MyCompanyName__. All rights reserved.
//
#import "FMNWindowOrientation.h"
@implementation FMNWindowOrientation
- (id) init { [self release]; return nil; };
- (id) initWithWindow : (FMNWindowRef) win
{
if(![super init])
return nil;
window = [win retain];
@try
{
position = [window getWindowPosition];
size = [window getWindowSize];
/* NSLog(@"Init with pos (%f, %f) size %fx%f", position.x, position.y,
size.width, size.height); */
}
@catch (NSException* ex)
{
[self release];
@throw ex;
}
//NSLog(@"SUCCESS!!!!");
return self;
}
- (void) restoreWithContext : (NSDictionary*) context
{
[window setWindowSize: size Position: position Context: context];
//NSLog(@"Restored %@", window);
}
- (int) priority
{
return kRestorableDefaultPriority;
}
- (void) dealloc
{
[window release];
[super dealloc];
}
- (void)encodeWithCoder:(NSCoder *)encoder
{
[encoder encodePoint:position forKey:@"FMNWOposition"];
[encoder encodeSize:size forKey:@"FMNWOsize"];
[encoder encodeObject:window forKey:@"FMNWOwindow"];
}
- (id)initWithCoder:(NSCoder *)decoder
{
self = [super init];
position = [decoder decodePointForKey:@"FMNWOposition"];
size = [decoder decodeSizeForKey:@"FMNWOsize"];
window = [[decoder decodeObjectForKey:@"FMNWOwindow"] retain];
return self;
}
@end