5 // Created by Hori,Masaki on 2015/05/25.
6 // Copyright (c) 2015年 Hori,Masaki. All rights reserved.
9 #import "HMBookmarkItem.h"
11 @interface HMBookmarkItem ()
12 @property (strong, nonatomic) NSString *windowContentSizeString;
13 @property (strong, nonatomic) NSString *contentVisibleRectString;
14 @property (strong, nonatomic) NSNumber *scrollDelayValue;
17 @implementation HMBookmarkItem
24 @dynamic windowContentSizeString;
25 @dynamic contentVisibleRectString;
27 @dynamic scrollDelayValue;
30 - (void)setWindowContentSize:(NSSize)windowContentSize
32 self.windowContentSizeString = NSStringFromSize(windowContentSize);
34 - (NSSize)windowContentSize
36 return NSSizeFromString(self.windowContentSizeString);
38 - (void)setContentVisibleRect:(NSRect)contentVisibleRect
40 self.contentVisibleRectString = NSStringFromRect(contentVisibleRect);
42 - (NSRect)contentVisibleRect
44 return NSRectFromString(self.contentVisibleRectString);
46 - (void)setScrollDelay:(NSTimeInterval)scrollDelay
48 self.scrollDelayValue = [NSNumber numberWithDouble:scrollDelay];
50 - (NSTimeInterval)scrollDelay
52 return self.scrollDelayValue.doubleValue;
55 - (NSArray *)writableTypesForPasteboard:(NSPasteboard *)pasteboard
57 return @[@"com.masakih.KCD.HMBookmarkItem"];
59 - (id)pasteboardPropertyListForType:(NSString *)type
61 NSURL *uri = self.objectID.URIRepresentation;
62 NSData *data = [NSKeyedArchiver archivedDataWithRootObject:uri];
68 return [NSString stringWithFormat:
69 @"{identifier -> %@,\n"
72 @"windowContentSize -> %@,\n"
73 @"contentVisibleRect -> %@,\n"
76 @"scrollDelay -> %lf,\n"
81 NSStringFromSize(self.windowContentSize),
82 NSStringFromRect(self.contentVisibleRect),
83 self.canResize ? @"YES" : @"NO",
84 self.canScroll ? @"YES" : @"NO",