DrawKit
Vector and illustration framework for Mac OS X
Instance Methods | Class Methods | List of all members
DKMetadataItem Class Reference

DKMetadataItems are used to store metadata (attribute) values in user info dictionaries attached to various objects such as layers and drawables. More...

Inheritance diagram for DKMetadataItem:
Inheritance graph
[legend]

Instance Methods

(NSAttributedString *) - attributedStringValue
 
(BOOL- boolValue
 
(NSColor *) - colourValue
 
(NSData *) - data
 
(double) - doubleValue
 
(CGFloat- floatValue
 
(id- initWithAttributedString:
 
(id- initWithBoolean:
 
(id- initWithColour:
 
(id- initWithData:
 
(id- initWithDate:
 
(id- initWithImage:
 
(id- initWithImageData:
 
(id- initWithInteger:
 
(id- initWithPoint:
 
(id- initWithReal:
 
(id- initWithRect:
 
(id- initWithSize:
 
(id- initWithString:
 
(id- initWithType:
 
(id- initWithUnsigned:
 
(id- initWithURL:
 
(NSInteger- integerValue
 
(NSInteger- intValue
 
(BOOL- isLossyConversionToType:
 
(DKMetadataItem *) - metadataItemWithType:
 
(id- objectValue
 
(NSPoint) - pointValue
 
(NSRect- rectValue
 
(void) - setType:
 
(void) - setValue:
 
(NSSize) - sizeValue
 
(NSString *) - stringValue
 
(void) - takeObjectValueFrom:
 
(DKMetadataType) - type
 
(NSString *) - typeDisplayName
 
(id- value
 
(BOOL- writeToPasteboard:
 
- Instance Methods inherited from NSObject
(NSString *) - address
 
(DKStyleRegistry *) - applicationWillReturnStyleRegistry
 
(BOOL- canBeUsedWithSelectionTool
 
(id- categoryManager:shouldReplaceObject:withObject:
 
(Class- classForCoder
 
(NSColor *) - colorValue
 
(id- copy
 
(void) - dealloc
 
(id- deepCopy
 
(NSDictionary *) - dimensionValuesForArrowStroke:
 
(CGFloat- drawing:convertDistanceToExternalCoordinates:
 
(NSPoint) - drawing:convertLocationToExternalCoordinates:
 
(void) - drawing:didDrawRect:inView:
 
(void) - drawing:willDrawRect:inView:
 
(NSString *) - drawing:willReturnAbbreviationForUnit:
 
(NSString *) - drawing:willReturnFormattedCoordinateForDistance:
 
(CGFloat- drawingWillReturnUnitToPointsConversonFactor:
 
(void) - finalize
 
(NSString *) - hexString
 
(void) - hotspot:didEndTrackingWithEvent:inView:
 
(void) - hotspot:isTrackingWithEvent:inView:
 
(void) - hotspot:willBeginTrackingWithEvent:inView:
 
(NSData *) - imageData
 
(NSImage *) - imageResourceNamed:
 
(id- init
 
(id- initWithExpression:
 
(id- instantiateObjectWithShortName:parameters:
 
(BOOL- isLiteralValue
 
(void) - layoutManager:willPlaceGlyphAtIndex:atLocation:pathAngle:yOffset:
 
(void) - menuItem:wasAddedForObject:inCategory:
 
(BOOL- moveObjectTo:position:slope:userInfo:
 
(id- mutableCopy
 
(void) - oneShotComplete
 
(void) - oneShotHasReached:
 
(void) - oneShotWillBegin
 
(void) - path:elementIndex:type:points:subPathIndex:subPathClosed:contextInfo:
 
(id- placeLinkFromPoint:toPoint:onPath:linkNumber:userInfo:
 
(id- placeObjectAtPoint:onPath:position:slope:userInfo:
 
(NSPoint) - point
 
(NSPoint) - pointForTextLayout
 
(DKStyle *) - registry:shouldReplaceStyle:withStyle:
 
(NSBezierPath *) - renderer:willRenderPath:
 
(void) - routeFinder:progressHasReached:
 
(void) - setValue:forNumericParameter:
 
(CGFloat- taperFactorAtDistance:onPath:ofLength:
 
(void) - toolDidPerformUndoableAction:
 
(void) - toolWillPerformUndoableAction:
 
(NSURL *) - url
 
- Instance Methods inherited from <NSObject>
(NSString *) - description
 
(NSUInteger- hash
 
(BOOL- isEqual:
 
- Instance Methods inherited from <NSKeyValueBindingCreation>
(void) - bind:toObject:withKeyPath:options:
 
(NSArray *) - exposedBindings
 
(NSDictionary *) - infoForBinding:
 
(NSArray *) - optionDescriptionsForBinding:
 
(void) - unbind:
 
(Class- valueClassForBinding:
 
- Instance Methods inherited from <NSCoding>
(void) - encodeWithCoder:
 
(id- initWithCoder:
 
- Instance Methods inherited from <NSCopying>
(id- copyWithZone:
 

Class Methods

(NSArray *) + arrayOfMetadataItemsWithArray:
 
(Class+ classForType:
 
(NSDictionary *) + dictionaryOfMetadataItemsWithDictionary:
 
(NSString *) + localizedDisplayNameForType:
 
(NSDictionary *) + metadataItemsWithPasteboard:
 
(DKMetadataItem *) + metadataItemWithAttributedString:
 
(DKMetadataItem *) + metadataItemWithBoolean:
 
(DKMetadataItem *) + metadataItemWithColour:
 
(DKMetadataItem *) + metadataItemWithData:
 
(DKMetadataItem *) + metadataItemWithDate:
 
(DKMetadataItem *) + metadataItemWithImage:
 
(DKMetadataItem *) + metadataItemWithImageData:
 
(DKMetadataItem *) + metadataItemWithInteger:
 
(DKMetadataItem *) + metadataItemWithObject:
 
(DKMetadataItem *) + metadataItemWithPasteboard:
 
(DKMetadataItem *) + metadataItemWithPoint:
 
(DKMetadataItem *) + metadataItemWithReal:
 
(DKMetadataItem *) + metadataItemWithRect:
 
(DKMetadataItem *) + metadataItemWithSize:
 
(DKMetadataItem *) + metadataItemWithString:
 
(DKMetadataItem *) + metadataItemWithUnsigned:
 
(DKMetadataItem *) + metadataItemWithURL:
 
(BOOL+ writeMetadataItems:forKeys:toPasteboard:
 
- Class Methods inherited from NSObject
(id+ alloc
 
(Class+ class
 
(void) + initialize
 
(void) + load
 
(id+ new
 
- Class Methods inherited from <NSKeyValueBindingCreation>
(void) + exposeBinding:
 

Detailed Description

DKMetadataItems are used to store metadata (attribute) values in user info dictionaries attached to various objects such as layers and drawables.

Using a special wrapper preserves the type information under editing whereas using raw NSValue/NSNumber objects does not.

Values passed to -setValue are always converted to the current type wherever possible. Conversely, using -setType converts the current value to that type where possible. A conversion is always attempted, so in some cases a nonsensical conversion will result in data loss, e.g. converting a URL to a colour. The -isLossyConversionToType: will return YES for lossy conversions, NO if the conversion will succeed.

<type> and

properties are KVO-observable, any other methods call these.

Values are stored in whatever class is appropriate to the type, viz:

Type Class

String NSString Integer NSNumber (int) Real NSNumber (double) Boolean NSNumber (BOOL) Unsigned NSNumber (int) Attributed String NSAttributedString Image NSImage Image Data NSData Data NSData URL NSURL Date NSDate Size NSString Point NSString Rect NSString

Method Documentation

+ (NSArray*) arrayOfMetadataItemsWithArray: (NSArray *)  array
- (NSAttributedString*) attributedStringValue
- (BOOL) boolValue
+ (Class) classForType: (DKMetadataType)  type
- (NSColor*) colourValue

Reimplemented from NSObject.

- (NSData*) data
+ (NSDictionary*) dictionaryOfMetadataItemsWithDictionary: (NSDictionary *)  aDict
- (double) doubleValue
- (CGFloat) floatValue
- (id) initWithAttributedString: (NSAttributedString *)  attrString
- (id) initWithBoolean: (BOOL aBool
- (id) initWithColour: (NSColor *)  colour
- (id) initWithData: (NSData *)  data
- (id) initWithDate: (NSDate *)  date
- (id) initWithImage: (NSImage *)  image
- (id) initWithImageData: (NSData *)  imageData
- (id) initWithInteger: (NSInteger anInteger
- (id) initWithPoint: (NSPoint)  point
- (id) initWithReal: (CGFloat aReal
- (id) initWithRect: (NSRect rect
- (id) initWithSize: (NSSize)  size
- (id) initWithString: (NSString *)  aString
- (id) initWithType: (DKMetadataType)  type
- (id) initWithUnsigned: (NSUInteger anInteger
- (id) initWithURL: (NSURL *)  url
- (NSInteger) integerValue
- (NSInteger) intValue
- (BOOL) isLossyConversionToType: (DKMetadataType)  type
+ (NSString*) localizedDisplayNameForType: (DKMetadataType)  type
+ (NSDictionary*) metadataItemsWithPasteboard: (NSPasteboard *)  pb
+ (DKMetadataItem*) metadataItemWithAttributedString: (NSAttributedString *)  attrString
+ (DKMetadataItem*) metadataItemWithBoolean: (BOOL aBool
+ (DKMetadataItem*) metadataItemWithColour: (NSColor *)  colour
+ (DKMetadataItem*) metadataItemWithData: (NSData *)  data
+ (DKMetadataItem*) metadataItemWithDate: (NSDate *)  date
+ (DKMetadataItem*) metadataItemWithImage: (NSImage *)  image
+ (DKMetadataItem*) metadataItemWithImageData: (NSData *)  imageData
+ (DKMetadataItem*) metadataItemWithInteger: (NSInteger anInteger
+ (DKMetadataItem*) metadataItemWithObject: (id value
+ (DKMetadataItem*) metadataItemWithPasteboard: (NSPasteboard *)  pb
+ (DKMetadataItem*) metadataItemWithPoint: (NSPoint)  point
+ (DKMetadataItem*) metadataItemWithReal: (CGFloat aReal
+ (DKMetadataItem*) metadataItemWithRect: (NSRect rect
+ (DKMetadataItem*) metadataItemWithSize: (NSSize)  size
+ (DKMetadataItem*) metadataItemWithString: (NSString *)  aString
- (DKMetadataItem*) metadataItemWithType: (DKMetadataType)  type
+ (DKMetadataItem*) metadataItemWithUnsigned: (NSUInteger anInteger
+ (DKMetadataItem*) metadataItemWithURL: (NSURL *)  url
- (id) objectValue
- (NSPoint) pointValue
- (NSRect) rectValue
- (void) setType: (DKMetadataType)  type
- (void) setValue: (id value
- (NSSize) sizeValue
- (NSString*) stringValue

Reimplemented from NSObject.

- (void) takeObjectValueFrom: (id sender
- (DKMetadataType) type
- (NSString*) typeDisplayName
- (id) value
+ (BOOL) writeMetadataItems: (NSArray *)  items
forKeys: (NSArray *)  keys
toPasteboard: (NSPasteboard *)  pb 
- (BOOL) writeToPasteboard: (NSPasteboard *)  pb