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

This object is responsible for the visual representation of the selection as well as any content. More...

Inheritance diagram for DKDrawableObject:
Inheritance graph
[legend]

Instance Methods

(void) - addMetadata:
 
(void) - addUserInfo:
 
(NSSet *) - allRegisteredStyles
 
(NSSet *) - allStyles
 
(CGFloat- angle
 
(CGFloat- angleInDegrees
 Return the shape's current rotation angle. More...
 
(NSRect- apparentBounds
 
(void) - applyTransform:
 Apply the transform to the object. More...
 
(NSRect- bounds
 
(NSImage *) - cachedImage
 Returns an image of the object representing its current appearance at 100% scale. More...
 
(NSColor *) - colourForKey:
 
(id< DKDrawableContainer >) - container
 Returns the immediate parent of this object. More...
 
(NSAffineTransform *) - containerTransform
 Return the container's transform. More...
 
(CGFloat- convertLength:
 
(NSPoint) - convertPointToDrawing:
 
(IBAction) - copyDrawingStyle:
 
(void) - creationTool:willBeginCreationAtPoint:
 
(void) - creationTool:willEndCreationAtPoint:
 
(NSView *) - currentView
 
(NSCursor *) - cursorForPartcode:mouseButtonDown:
 
(void) - detachStyle
 If the object's style is currently sharable, copy it and make it non-sharable. More...
 
(void) - drawContent
 
(void) - drawContentInRect:fromRect:withStyle:
 
(void) - drawContentWithSelectedState:
 
(void) - drawContentWithStyle:
 
(void) - drawGhostedContent
 
(DKDrawing *) - drawing
 
(void) - drawSelectedState
 
(void) - drawSelectionPath:
 
(NSSize) - extraSpaceNeeded
 
(CGFloat- floatValueForKey:
 
(NSUInteger- geometryChecksum
 
(void) - group:willUngroupObjectWithTransform:
 This object is being ungrouped from a group. More...
 
(void) - groupWillAddObject:
 This object is being added to a group. More...
 
(BOOL- hasMetadataForKey:
 
(NSInteger- hitPart:
 
(NSInteger- hitSelectedPart:forSnapDetection:
 
(NSUInteger- indexInContainer
 Returns the index position of this object in its container layer. More...
 
(id- initWithStyle:
 Initializes the drawable to have the style given. More...
 
(BOOL- intersectsRect:
 
(NSInteger- intValueForKey:
 
(void) - invalidateRenderingCache
 Discard all cached rendering information. More...
 
(BOOL- isBeingHitTested
 Is a hit-test in progress. More...
 
(BOOL- isGhosted
 Retuirn whether the object is ghosted rather than with its full style. More...
 
(BOOL- isKeyObject
 Is the object currently the layer's key object? More...
 
(BOOL- isPendingObject
 Is the object currently a pending object? More...
 
(BOOL- isSelected
 
(BOOL- isTrackingMouse
 
(DKKnobType) - knobTypeForPartCode:
 
(DKObjectOwnerLayer *) - layer
 Returns the layer that this object ultimately belongs to. More...
 
(NSPoint) - location
 
(BOOL- locationLocked
 Whether the object's location is locked or not. More...
 
(IBAction) - lock:
 
(BOOL- locked
 
(IBAction) - lockLocation:
 
(NSRect- logicalBounds
 
(NSMenu *) - menu
 Reurn the menu to use as the object's contextual menu. More...
 
(NSMutableDictionary *) - metadata
 
(NSUInteger- metadataChecksum
 
(void) - metadataDidChangeKey:
 
(DKMetadataItem *) - metadataItemForKey:
 
(DKMetadataItem *) - metadataItemForKey:limitToLocalSearch:
 
(NSArray *) - metadataItemsForKeysInArray:
 
(NSArray *) - metadataItemsForKeysInArray:limitToLocalSearch:
 
(NSArray *) - metadataKeys
 
(id- metadataObjectForKey:
 
(void) - metadataWillChangeKey:
 
(void) - mouseDoubleClickedAtPoint:inPart:event:
 
(void) - mouseDownAtPoint:inPart:event:
 
(void) - mouseDraggedAtPoint:inPart:event:
 
(NSSize) - mouseDragOffset
 
(BOOL- mouseHasMovedSinceStartOfTracking
 
(NSSize) - mouseOffset
 
(BOOL- mouseSnappingEnabled
 
(void) - mouseUpAtPoint:inPart:event:
 
(void) - notifyGeometryChange:
 
(void) - notifyStatusChange
 
(void) - notifyVisualChange
 
(void) - objectDidBecomeSelected
 
(void) - objectIsNoLongerSelected
 
(BOOL- objectIsValid
 
(BOOL- objectMayBecomeSelected
 Is the object able to be selected? More...
 
(void) - objectWasAddedToLayer:
 The object was added to a layer. More...
 
(void) - objectWasRemovedFromLayer:
 The object was removed from the layer. More...
 
(void) - objectWasUngrouped
 This object was ungrouped from a group. More...
 
(NSSize) - offset
 
(void) - offsetLocationByX:byY:
 
(NSAttributedString *) - originalText
 
(IBAction) - pasteDrawingStyle:
 
(NSData *) - pdf
 Returns the single object rendered as a PDF image. More...
 
(NSPoint) - pointForPartcode:
 
(BOOL- pointHitsPath:
 Test a point against the offscreen bitmap representation of the shape. More...
 
(BOOL- populateContextualMenu:
 
(BOOL- populateContextualMenu:atPoint:
 
(void) - readSupplementaryDataFromPasteboard:
 Read additional data from the pasteboard specific to the object. More...
 
(BOOL- rectHitsPath:
 Test if a rect encloses any of the shape's actual pixels. More...
 
(void) - removeMetadataForKey:
 
(NSBezierPath *) - renderingPath
 
(void) - replaceMatchingStylesFromSet:
 
(void) - resetOffset
 
(void) - resizeWidthBy:heightBy:
 
(void) - rotateByAngle:
 Rotate the shape by adding a delta angle to the current angle. More...
 
(DKMetadataSchema) - schema
 
(void) - setAngle:
 Set the object's current angle in radians. More...
 
(void) - setBeingHitTested:
 Set whether a hit-test in progress. More...
 
(void) - setColour:forKey:
 
(void) - setContainer:
 
(void) - setFloatValue:forKey:
 
(void) - setGhosted:
 Set whether the object is ghosted rather than with its full style. More...
 
(void) - setIntValue:forKey:
 
(void) - setLocation:
 
(void) - setLocationLocked:
 Sets whether the object's location is locked or not. More...
 
(void) - setLocked:
 
(void) - setMetadata:
 
(void) - setMetadataItem:forKey:
 
(void) - setMetadataItemType:forKey:
 
(void) - setMetadataItemValue:forKey:
 
(void) - setMetadataObject:forKey:
 
(void) - setMouseDragOffset:
 
(void) - setMouseHasMovedSinceStartOfTracking:
 
(void) - setMouseSnappingEnabled:
 
(void) - setNeedsDisplayInRect:
 
(void) - setNeedsDisplayInRects:
 
(void) - setNeedsDisplayInRects:withExtraPadding:
 
(void) - setOffset:
 
(void) - setOriginalText:
 
(void) - setSize:
 
(void) - setSize:forKey:
 
(void) - setString:forKey:
 
(void) - setStyle:
 
(void) - setTrackingMouse:
 
(void) - setupMetadata
 
(void) - setUserInfo:
 
(void) - setUserInfoObject:forKey:
 Set an item of user info. More...
 
(void) - setVisible:
 
(NSSize) - size
 
(NSSize) - sizeForKey:
 
(NSPoint) - snappedMousePoint:forSnappingPointsWithControlFlag:
 
(NSPoint) - snappedMousePoint:withControlFlag:
 Offset the point to cause snap to grid + guides accoding to the drawing's settings. More...
 
(NSArray *) - snappingPoints
 
(NSArray *) - snappingPointsWithOffset:
 
(NSString *) - stringForKey:
 
(DKStyle *) - style
 
(void) - styleDidChange:
 
(void) - styleWillChange:
 
(NSSet *) - subSelection
 Return the subselection of the object. More...
 
(NSImage *) - swatchImageWithSize:
 
(NSAffineTransform *) - transform
 Return a transform that maps the object's stored path to its true location in the drawing. More...
 
(NSUndoManager *) - undoManager
 
(IBAction) - unlock:
 
(IBAction) - unlockLocation:
 
(void) - updateMetadataKeys
 
(void) - updateRulerMarkers
 
(BOOL- useLowQualityDrawing
 
(NSMutableDictionary *) - userInfo
 Return the attached user info. More...
 
(id- userInfoObjectForKey:
 Return an item of user info. More...
 
(BOOL- visible
 
(void) - willBeAddedAsSubstituteFor:toLayer:
 Some high-level operations substitute a new object in place of an existing one (or several). More...
 
(void) - writeSupplementaryDataToPasteboard:
 Write additional data to the pasteboard specific to the object. More...
 
- Instance Methods inherited from NSObject
(NSString *) - address
 
(DKStyleRegistry *) - applicationWillReturnStyleRegistry
 
(BOOL- canBeUsedWithSelectionTool
 
(id- categoryManager:shouldReplaceObject:withObject:
 
(Class- classForCoder
 
(NSColor *) - colorValue
 
(NSColor *) - colourValue
 
(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:
 
(NSString *) - stringValue
 
(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 <DKStorableObject>
(NSUInteger- index
 
(BOOL- isMarked
 
(void) - setIndex:
 
(void) - setMarked:
 
(void) - setStorage:
 
(id< DKObjectStorage >) - storage
 
- Instance Methods inherited from <NSCoding>
(void) - encodeWithCoder:
 
(id- initWithCoder:
 
- Instance Methods inherited from <NSCopying>
(id- copyWithZone:
 
- Instance Methods inherited from <DKRenderable>
(NSMutableDictionary *) - renderingCache
 

Class Methods

(Class+ classForConversionRequestFor:
 Return the class to use in place of the given class when performing a conversion. More...
 
(NSUInteger+ countOfNativeObjectsOnPasteboard:
 Return the number of native objects held by the pasteboard. More...
 
(BOOL+ displaysSizeInfoWhenDragging
 Return whether an info floater is displayed when resizing an object. More...
 
(NSColor *) + ghostColour
 Return the outline colour to use when drawing objects in their ghosted state. More...
 
(NSInteger+ initialPartcodeForObjectCreation
 
(NSDictionary *) + interconversionTable
 Return the interconversion table. More...
 
(BOOL+ isGroupable
 Return whether obejcts of this class can be grouped. More...
 
(BOOL+ metadataChangesAreUndoable
 
(NSArray *) + nativeObjectsFromPasteboard:
 
(NSArray *) + pasteboardTypesForOperation:
 
(void) + setDisplaysSizeInfoWhenDragging:
 Set whether an info floater is displayed when resizing an object. More...
 
(void) + setGhostColour:
 Set the outline colour to use when drawing objects in their ghosted state. More...
 
(void) + setInterconversionTable:
 Return the interconversion table. More...
 
(void) + setMetadataChangesAreUndoable:
 
(void) + substituteClass:forClass:
 Sets the class to use in place of the a base class when performing a conversion. More...
 
(NSRect+ unionOfBoundsOfDrawablesInArray:
 Returns the union of the bounds of the objects in the array. More...
 
- Class Methods inherited from NSObject
(id+ alloc
 
(Class+ class
 
(void) + initialize
 
(void) + load
 
(id+ new
 
- Class Methods inherited from <NSKeyValueBindingCreation>
(void) + exposeBinding:
 

Protected Attributes

BOOL m_clipToBBox: 1
 
BOOL m_showBBox: 1
 
BOOL m_showPartcodes: 1
 
BOOL m_showTargets: 1
 
BOOL m_unused_padding: 4
 

Detailed Description

This object is responsible for the visual representation of the selection as well as any content.

A drawable object is owned by a DKObjectDrawingLayer, which is responsible for drawing it when required and handling selections. This object is responsible for the visual representation of the selection as well as any content.

It can draw whatever it likes within <bounds>, which it is responsible for calculating correctly.

hitTest can return an integer to indicate which part was hit - a value of 0 means nothing hit. The returned value's meaning is otherwise private to the class, but is returned in the mouse event methods.

This is intended to be a semi-abstract class - it draws nothing itself. Subclasses include DKDrawableShape and DKDrawablePath - often subclassing one of those will be more straightforward than subclassing this. A subclass must implement NSCoding and NSCopying to be archivable, etc. There are also numerous informal protocols for geometry, snapping, hit testing, drawing and ungrouping that need to be implemented correctly for a subclass to work fully correctly within DK.

The user info is a dictionary attached to an object. It plays no part in the graphics system, but can be used by applications to attach arbitrary data to any drawable object.

Method Documentation

- (void) addMetadata: (NSDictionary *)  dict

Provided by category DKDrawableObject(Metadata).

- (void) addUserInfo: (NSDictionary *)  info
- (NSSet*) allRegisteredStyles
- (NSSet*) allStyles
- (CGFloat) angle

Reimplemented from <DKRenderable>.

- (CGFloat) angleInDegrees

Return the shape's current rotation angle.

This method is primarily to supply the angle for display to the user, rather than for doing angular calculations with. It converts negative values -180 to 0 to +180 to 360 degrees.

Returns
the shape's angle in degrees
- (NSRect) apparentBounds
- (void) applyTransform: (NSAffineTransform *)  transform

Apply the transform to the object.

The object's position, size and path are modified by the transform. This is called by the owning layer's applyTransformToObjects method. This ignores locked objects.

Parameters
transforma transform
- (NSRect) bounds

Reimplemented from <DKStorableObject>.

- (NSImage*) cachedImage

Returns an image of the object representing its current appearance at 100% scale.

This image is stored in the rendering cache. If the cache is empty the image is recreated. This image can be used to speed up hit testing.

Returns
an image of the object
+ (Class) classForConversionRequestFor: (Class aClass

Return the class to use in place of the given class when performing a conversion.

The default passes through the input class unchanged. By customising the conversion table, other classes can be substituted when performing a conversion.

Parameters
aClassthe base class which we are converting TO.
Returns
the actual object class to use for that conversion.
- (NSColor*) colourForKey: (NSString *)  key

Provided by category DKDrawableObject(Metadata).

- (id<DKDrawableContainer>) container

Returns the immediate parent of this object.

A parent is usually a layer, same as owner - but can be a group if the object is grouped

Returns
the object's parent
- (NSAffineTransform*) containerTransform

Return the container's transform.

The container transform must be taken into account for rendering this object, as it accounts for groups and other possible containers.

Returns
a transform

Reimplemented from <DKRenderable>.

- (CGFloat) convertLength: (CGFloat len
- (NSPoint) convertPointToDrawing: (NSPoint)  pt
- (IBAction) copyDrawingStyle: (id sender
+ (NSUInteger) countOfNativeObjectsOnPasteboard: (NSPasteboard *)  pb

Return the number of native objects held by the pasteboard.

This efficiently queries the info object rather than dearchiving the objects themselves. A value of 0 means no native objects on the pasteboard (naturally)

Parameters
pbthe pasteboard to read from
Returns
a count
- (void) creationTool: (DKDrawingTool *)  tool
willBeginCreationAtPoint: (NSPoint)  p 
- (void) creationTool: (DKDrawingTool *)  tool
willEndCreationAtPoint: (NSPoint)  p 
- (NSView*) currentView
- (NSCursor*) cursorForPartcode: (NSInteger partcode
mouseButtonDown: (BOOL button 
- (void) detachStyle

If the object's style is currently sharable, copy it and make it non-sharable.

If the style is already non-sharable, this does nothing. The purpose of this is to detach this from it style such that it has its own private copy. It does not change appearance.

+ (BOOL) displaysSizeInfoWhenDragging

Return whether an info floater is displayed when resizing an object.

Size info is width and height

Returns
YES to show the info, NO to not show it
- (void) drawContent
- (void) drawContentInRect: (NSRect destRect
fromRect: (NSRect srcRect
withStyle: (DKStyle *)  aStyle 
- (void) drawContentWithSelectedState: (BOOL selected
- (void) drawContentWithStyle: (DKStyle *)  aStyle
- (void) drawGhostedContent
- (DKDrawing*) drawing
- (void) drawSelectedState
- (void) drawSelectionPath: (NSBezierPath *)  path
- (NSSize) extraSpaceNeeded

Reimplemented from <DKRenderable>.

- (CGFloat) floatValueForKey: (NSString *)  key

Provided by category DKDrawableObject(Metadata).

- (NSUInteger) geometryChecksum

Reimplemented from <DKRenderable>.

+ (NSColor*) ghostColour

Return the outline colour to use when drawing objects in their ghosted state.

The default is light gray

Returns
the colour to use
- (void) group: (DKShapeGroup *)  aGroup
willUngroupObjectWithTransform: (NSAffineTransform *)  aTransform 

This object is being ungrouped from a group.

When ungrouping, an object must help the group to the right thing by resizing, rotating and repositioning itself appropriately. At the time this is called, the object has already has its container set to the layer it will be added to but has not actually been added. Must be overridden.

Parameters
aGroupthe group containing the object
aTransformthe transform that the group is applying to the object to scale rotate and translate it.
- (void) groupWillAddObject: (DKShapeGroup *)  aGroup

This object is being added to a group.

Can be overridden if this event is of interest. Note that for grouping, the object doesn't need to do anything special - the group takes care of it.

Parameters
aGroupthe group adding the object
- (BOOL) hasMetadataForKey: (NSString *)  key

Provided by category DKDrawableObject(Metadata).

- (NSInteger) hitPart: (NSPoint)  pt
- (NSInteger) hitSelectedPart: (NSPoint)  pt
forSnapDetection: (BOOL snap 
- (NSUInteger) indexInContainer

Returns the index position of this object in its container layer.

This is intended for debugging and should generally be avoided by user code.

Returns
the index positionWhere object storage stores the Z-index in the object itself, this returns it.

See DKObjectStorageProtocol.h

Returns
the Z value for the object
+ (NSInteger) initialPartcodeForObjectCreation
- (id) initWithStyle: (DKStyle *)  aStyle

Initializes the drawable to have the style given.

You can use -init to initialize using the default style. Note that if creating many objects at once, supplying the style when initializing is more efficient.

Parameters
aStylethe initial style for the object
Returns
the object
+ (NSDictionary*) interconversionTable

Return the interconversion table.

The interconversion table is used when drawables are converted to another type. The table can be customised to permit conversions to subclasses or other types of object. The default is nil, which simply passes through the requested type unchanged.

Returns
the table (a dictionary)
- (BOOL) intersectsRect: (NSRect rect
- (NSInteger) intValueForKey: (NSString *)  key

Provided by category DKDrawableObject(Metadata).

- (void) invalidateRenderingCache

Discard all cached rendering information.

The rendering cache is simply emptied. The contents of the cache are generally set by individual renderers to speed up drawing, and are not known to this object. The cache is invalidated by any change that alters the object's appearance - size, position, angle, style, etc.

- (BOOL) isBeingHitTested

Is a hit-test in progress.

Drawing methods can check this to see if they can take shortcuts to save time when hit-testing. This will only return YES during calls to -drawContent etc when invoked by the rectHitsPath method.

Returns
YES if hit-testing is taking place, otherwise NO
- (BOOL) isGhosted

Retuirn whether the object is ghosted rather than with its full style.

Ghosting is an alternative to hiding - ghosted objects are still visible but are only drawn using a thin outline. See also: +setGhostingColour:

Returns
YES if the object is ghosted, NO otherwise
+ (BOOL) isGroupable

Return whether obejcts of this class can be grouped.

Default is YES. see also [DKShapeGroup objectsAvailableForGroupingFromArray];

Returns
YES if objects can be included in groups
- (BOOL) isKeyObject

Is the object currently the layer's key object?

DKObjectDrawingLayer maintains a 'key object' for the purposes of alignment operations. The drawable could use this information to draw itself in a particular way for example. Note that DK doesn't use this information except for object alignment operations.

Returns
YES if key, NO if not
- (BOOL) isPendingObject

Is the object currently a pending object?

Esoteric. An object is pending while it is being created and not otherwise. There are few reasons to need to know, but one might be to implement a special selection highlight for this case.

Returns
YES if pending, NO if not
- (BOOL) isSelected
- (BOOL) isTrackingMouse
- (DKKnobType) knobTypeForPartCode: (NSInteger pc
- (DKObjectOwnerLayer*) layer

Returns the layer that this object ultimately belongs to.

This returns the layer even if container isn't the layer, by recursing up the tree as needed

Returns
the containing layer
- (NSPoint) location

Reimplemented from <DKRenderable>.

- (BOOL) locationLocked

Whether the object's location is locked or not.

Location may be locked independently of the general lock

Returns
YES if locked location, NO to unlock
- (IBAction) lock: (id sender
- (BOOL) locked
- (IBAction) lockLocation: (id sender
- (NSRect) logicalBounds
- (NSMenu*) menu

Reurn the menu to use as the object's contextual menu.

The menu is obtained via DKAuxiliaryMenus helper object which in turn loads the menu from a nib, overridable by the app. This is the preferred method of supplying the menu. It doesn't need to be overridden by subclasses generally speaking, since all menu customisation per class is done in the nib.

Returns
the menu
- (NSMutableDictionary*) metadata

Provided by category DKDrawableObject(Metadata).

+ (BOOL) metadataChangesAreUndoable

Provided by category DKDrawableObject(Metadata).

- (NSUInteger) metadataChecksum

Provided by category DKDrawableObject(Metadata).

- (void) metadataDidChangeKey: (NSString *)  key

Provided by category DKDrawableObject(Metadata).

- (DKMetadataItem*) metadataItemForKey: (NSString *)  key

Provided by category DKDrawableObject(Metadata).

- (DKMetadataItem*) metadataItemForKey: (NSString *)  key
limitToLocalSearch: (BOOL local 

Provided by category DKDrawableObject(Metadata).

- (NSArray*) metadataItemsForKeysInArray: (NSArray *)  keyArray

Provided by category DKDrawableObject(Metadata).

- (NSArray*) metadataItemsForKeysInArray: (NSArray *)  keyArray
limitToLocalSearch: (BOOL local 

Provided by category DKDrawableObject(Metadata).

- (NSArray*) metadataKeys

Provided by category DKDrawableObject(Metadata).

- (id) metadataObjectForKey: (NSString *)  key

Provided by category DKDrawableObject(Metadata).

- (void) metadataWillChangeKey: (NSString *)  key

Provided by category DKDrawableObject(Metadata).

- (void) mouseDoubleClickedAtPoint: (NSPoint)  mp
inPart: (NSInteger partcode
event: (NSEvent *)  evt 
- (void) mouseDownAtPoint: (NSPoint)  mp
inPart: (NSInteger partcode
event: (NSEvent *)  evt 
- (void) mouseDraggedAtPoint: (NSPoint)  mp
inPart: (NSInteger partcode
event: (NSEvent *)  evt 
- (NSSize) mouseDragOffset
- (BOOL) mouseHasMovedSinceStartOfTracking
- (NSSize) mouseOffset
- (BOOL) mouseSnappingEnabled
- (void) mouseUpAtPoint: (NSPoint)  mp
inPart: (NSInteger partcode
event: (NSEvent *)  evt 
+ (NSArray*) nativeObjectsFromPasteboard: (NSPasteboard *)  pb
- (void) notifyGeometryChange: (NSRect oldBounds
- (void) notifyStatusChange
- (void) notifyVisualChange
- (void) objectDidBecomeSelected
- (void) objectIsNoLongerSelected
- (BOOL) objectIsValid
- (BOOL) objectMayBecomeSelected

Is the object able to be selected?

Subclasses can override to disallow selection. By default all objects are selectable, but for some specialised use this might be useful.

Returns
YES if selectable, NO if not
- (void) objectWasAddedToLayer: (DKObjectOwnerLayer *)  aLayer

The object was added to a layer.

Purely for information, should an object need to know. Override to make use of this. Subclasses should call super.

Parameters
aLayerthe layer this was added to
- (void) objectWasRemovedFromLayer: (DKObjectOwnerLayer *)  aLayer

The object was removed from the layer.

Purely for information, should an object need to know. Override to make use of this. Subclasses should call super to maintain notifications.

Parameters
aLayerthe layer this was removed from
- (void) objectWasUngrouped

This object was ungrouped from a group.

This is called when the ungrouping operation has finished entirely. The object will belong to its original container and have its location, etc set as required. Override to make use of this notification.

- (NSSize) offset
- (void) offsetLocationByX: (CGFloat dx
byY: (CGFloat dy 
- (NSAttributedString*) originalText
+ (NSArray*) pasteboardTypesForOperation: (DKPasteboardOperationType)  op
- (IBAction) pasteDrawingStyle: (id sender
- (NSData*) pdf

Returns the single object rendered as a PDF image.

This allows the object to be extracted as a single PDF in isolation. It works by creating a temporary view that draws just this object.

Returns
PDF data of the object
- (NSPoint) pointForPartcode: (NSInteger pc
- (BOOL) pointHitsPath: (NSPoint)  p

Test a point against the offscreen bitmap representation of the shape.

Special case of the rectHitsPath call, which is now the fastest way to perform this test

Parameters
pthe point to test
Returns
YES if the point hit the shape's pixels, NO otherwise
- (BOOL) populateContextualMenu: (NSMenu *)  theMenu
- (BOOL) populateContextualMenu: (NSMenu *)  theMenu
atPoint: (NSPoint)  localPoint 
- (void) readSupplementaryDataFromPasteboard: (NSPasteboard *)  pb

Read additional data from the pasteboard specific to the object.

This is invoked by the owning layer after an object has been pasted. Override to make use of. Note that this is not necessarily symmetrical with -writeSupplementaryDataToPasteboard: depending on what data types the other method actually wrote. For example standard text would not normally need to be handled as a special case.

Parameters
pbthe pasteboard to read from
- (BOOL) rectHitsPath: (NSRect r

Test if a rect encloses any of the shape's actual pixels.

Note this can be an expensive way to test this - eliminate all obvious trivial cases first.

Parameters
rthe rect to test
Returns
YES if at least one pixel enclosed by the rect, NO otherwise
- (void) removeMetadataForKey: (NSString *)  key

Provided by category DKDrawableObject(Metadata).

- (NSBezierPath*) renderingPath

Reimplemented from <DKRenderable>.

- (void) replaceMatchingStylesFromSet: (NSSet *)  aSet
- (void) resetOffset
- (void) resizeWidthBy: (CGFloat xFactor
heightBy: (CGFloat yFactor 
- (void) rotateByAngle: (CGFloat da

Rotate the shape by adding a delta angle to the current angle.

Da is a value in radians

Parameters
daadd this much to the current angle
- (DKMetadataSchema) schema

Provided by category DKDrawableObject(Metadata).

- (void) setAngle: (CGFloat angle

Set the object's current angle in radians.

Parameters
anglethe object's angle (radians)
- (void) setBeingHitTested: (BOOL hitTesting

Set whether a hit-test in progress.

Applicaitons should not generally use this. It allows certain container classes (e.g. groups) to flag the they are being hit tested to provide easier hitting of thin objects in groups.

Parameters
hitTestingYES if hit-testing, NO otherwise
- (void) setColour: (NSColor *)  colour
forKey: (NSString *)  key 

Provided by category DKDrawableObject(Metadata).

- (void) setContainer: (id< DKDrawableContainer >)  aContainer
+ (void) setDisplaysSizeInfoWhenDragging: (BOOL doesDisplay

Set whether an info floater is displayed when resizing an object.

Size info is width and height

Parameters
doesDisplayYES to show the info, NO to not show it
- (void) setFloatValue: (float)  val
forKey: (NSString *)  key 

Provided by category DKDrawableObject(Metadata).

+ (void) setGhostColour: (NSColor *)  ghostColour

Set the outline colour to use when drawing objects in their ghosted state.

The ghost colour is persistent, stored using the kDKGhostColourPreferencesKey key

Parameters
ghostColourthe colour to use
- (void) setGhosted: (BOOL ghosted

Set whether the object is ghosted rather than with its full style.

Ghosting is an alternative to hiding - ghosted objects are still visible but are only drawn using a thin outline. See also: +setGhostingColour:

Parameters
ghostedYES to ghost the object, NO to unghost it
+ (void) setInterconversionTable: (NSDictionary *)  icTable

Return the interconversion table.

The interconversion table is used when drawables are converted to another type. The table can be customised to permit conversions to subclasses of the requested class. The default is nil, which simply passes through the requested type unchanged. The dictionary consists of the base class as a string, and returns the class to use in place of that type.

Parameters
icTablea dictionary containing mappings from standard base classes to custom classes
- (void) setIntValue: (int)  val
forKey: (NSString *)  key 

Provided by category DKDrawableObject(Metadata).

- (void) setLocation: (NSPoint)  p
- (void) setLocationLocked: (BOOL lockLocation

Sets whether the object's location is locked or not.

Location may be locked independently of the general lock

Parameters
lockLocationYES to lock location, NO to unlock
- (void) setLocked: (BOOL locked
- (void) setMetadata: (NSDictionary *)  dict

Provided by category DKDrawableObject(Metadata).

+ (void) setMetadataChangesAreUndoable: (BOOL undo

Provided by category DKDrawableObject(Metadata).

- (void) setMetadataItem: (DKMetadataItem *)  item
forKey: (NSString *)  key 

Provided by category DKDrawableObject(Metadata).

- (void) setMetadataItemType: (DKMetadataType)  type
forKey: (NSString *)  key 

Provided by category DKDrawableObject(Metadata).

- (void) setMetadataItemValue: (id value
forKey: (NSString *)  key 

Provided by category DKDrawableObject(Metadata).

- (void) setMetadataObject: (id obj
forKey: (NSString *)  key 

Provided by category DKDrawableObject(MetadataDeprecated).

- (void) setMouseDragOffset: (NSSize)  offset
- (void) setMouseHasMovedSinceStartOfTracking: (BOOL moved
- (void) setMouseSnappingEnabled: (BOOL ems
- (void) setNeedsDisplayInRect: (NSRect rect
- (void) setNeedsDisplayInRects: (NSSet *)  setOfRects
- (void) setNeedsDisplayInRects: (NSSet *)  setOfRects
withExtraPadding: (NSSize)  padding 
- (void) setOffset: (NSSize)  offs
- (void) setOriginalText: (NSAttributedString *)  text
- (void) setSize: (NSSize)  size
- (void) setSize: (NSSize)  size
forKey: (NSString *)  key 

Provided by category DKDrawableObject(Metadata).

- (void) setString: (NSString *)  string
forKey: (NSString *)  key 

Provided by category DKDrawableObject(Metadata).

- (void) setStyle: (DKStyle *)  aStyle
- (void) setTrackingMouse: (BOOL tracking
- (void) setupMetadata

Provided by category DKDrawableObject(Metadata).

- (void) setUserInfo: (NSDictionary *)  info
- (void) setUserInfoObject: (id obj
forKey: (NSString *)  key 

Set an item of user info.

Parameters
objthe object to store
keythe key to use to refer to the item
- (void) setVisible: (BOOL vis
- (NSSize) size

Reimplemented from <DKRenderable>.

- (NSSize) sizeForKey: (NSString *)  key

Provided by category DKDrawableObject(Metadata).

- (NSPoint) snappedMousePoint: (NSPoint)  mp
forSnappingPointsWithControlFlag: (BOOL snapControl 
- (NSPoint) snappedMousePoint: (NSPoint)  mp
withControlFlag: (BOOL snapControl 

Offset the point to cause snap to grid + guides accoding to the drawing's settings.

DKObjectOwnerLayer + DKDrawing implements the details of this method. The snapControl flag is intended to come from a modifier flag - usually <ctrl>.

Parameters
mpa point which is the proposed location of the shape
Returns
a new point which may be offset from the input enough to snap it to the guides and grid
- (NSArray*) snappingPoints
- (NSArray*) snappingPointsWithOffset: (NSSize)  offset
- (NSString*) stringForKey: (NSString *)  key

Provided by category DKDrawableObject(Metadata).

- (DKStyle*) style
- (void) styleDidChange: (NSNotification *)  note
- (void) styleWillChange: (NSNotification *)  note
- (NSSet*) subSelection

Return the subselection of the object.

DK objects do not have subselections without subclassing, but this method provides a common method for subselections to be passed back to a UI, etc. If there is no subselection, this should return either the empty set, nil or a set containing self. Subclasses will override and return whatever is appropriate. They are also responsible for the complete implementation of the selection including hit-testing and highlighting. In addition, the notification 'kDKDrawableSubselectionChangedNotification' should be sent when this changes.

Returns
a set containing the selection within the object. May be empty, nil or contain self.
+ (void) substituteClass: (Class newClass
forClass: (Class baseClass 

Sets the class to use in place of the a base class when performing a conversion.

This is only used when performing conversions, not when creating new objects in other circumstances. <newClass> must be a subclass of <baseClass>

Parameters
newClassthe class which we are converting TO
baseClassthe base class
- (NSImage*) swatchImageWithSize: (NSSize)  size
- (NSAffineTransform*) transform

Return a transform that maps the object's stored path to its true location in the drawing.

Override for real transforms - the default merely returns the identity matrix

Returns
a transform

Implemented in DKDrawableShape.

- (NSUndoManager*) undoManager
+ (NSRect) unionOfBoundsOfDrawablesInArray: (NSArray *)  array

Returns the union of the bounds of the objects in the array.

Utility method as this is a very common task - throws exception if any object in the list is not a DKDrawableObject or subclass thereof

Parameters
arraya list of DKDrawable objects
Returns
a rect, the union of the bounds of all objects
- (IBAction) unlock: (id sender
- (IBAction) unlockLocation: (id sender
- (void) updateMetadataKeys

Provided by category DKDrawableObject(Metadata).

- (void) updateRulerMarkers
- (BOOL) useLowQualityDrawing

Reimplemented from <DKRenderable>.

- (NSMutableDictionary*) userInfo

Return the attached user info.

The user info is returned as a mutable dictionary (which it is), and can thus have its contents mutated directly for certain uses. Doing this cannot cause any notification of the status of the object however.

Returns
the user info
- (id) userInfoObjectForKey: (NSString *)  key

Return an item of user info.

Parameters
keythe key to use to refer to the item
Returns
the user info item
- (BOOL) visible

Reimplemented from <DKStorableObject>.

- (void) willBeAddedAsSubstituteFor: (DKDrawableObject *)  obj
toLayer: (DKObjectOwnerLayer *)  aLayer 

Some high-level operations substitute a new object in place of an existing one (or several).

In those cases this should be called to allow the object to do any special substitution work.

Subclasses should override this to do additional work during a substitution. Note that user info and style is handled for you, this does not need to deal with those properties.

Parameters
objthe original object his is being substituted for
aLayerthe layer this will be added to (but is not yet)
- (void) writeSupplementaryDataToPasteboard: (NSPasteboard *)  pb

Write additional data to the pasteboard specific to the object.

The owning layer generally handles the case of writing the selected objects to the pasteboard but sometimes an object might wish to supplement that data. For example a text-bearing object might add the text to the pasteboard. This is only invoked when the object is the only object selected. The default method does nothing - override to make use of this. Also, your override must declare the types it's writing using addTypes:owner:

Parameters
pbthe pasteboard to write to

Member Data Documentation

- (BOOL) m_clipToBBox
protected
- (BOOL) m_showBBox
protected
- (BOOL) m_showPartcodes
protected
- (BOOL) m_showTargets
protected
- (BOOL) m_unused_padding
protected