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

This tool class is used to make all kinds of drawable objects. More...

Inheritance diagram for DKObjectCreationTool:
Inheritance graph
[legend]

Instance Methods

(NSImage *) - image
 Return an image showing what the tool creates. More...
 
(id- initWithPrototypeObject:
 Initialize the tool. More...
 
(id- objectFromPrototype
 Return a new object copied from the prototype, but with the current class style if there is one. More...
 
(id- prototype
 Return the object to be copied when the tool creates a new one. More...
 
(void) - setPrototype:
 Set the object to be copied when the tool created a new one. More...
 
(void) - setStyle:
 
(void) - setStylePickupEnabled:
 
(DKStyle *) - style
 
(BOOL- stylePickupEnabled
 
- Instance Methods inherited from DKDrawingTool
(void) - drawRect:inView:
 
(void) - flagsChanged:inLayer:
 
(BOOL- isSelectionTool
 Return whether the tool is some sort of object selection tool. More...
 
(BOOL- isValidTargetLayer:
 
(NSString *) - keyboardEquivalent
 
(NSUInteger- keyboardModifierFlags
 
(void) - mouseMoved:inView:
 
(NSData *) - persistentData
 
(NSString *) - registeredName
 Return the registry name for this tool. More...
 
(void) - set
 Sets the tool as the current tool for the key view in the main window, if possible. More...
 
(void) - setCursorForPoint:targetObject:inLayer:event:
 
(void) - setKeyboardEquivalent:modifierFlags:
 
(void) - shouldLoadPersistentData:
 
(void) - toolControllerDidSetTool:
 Called when this tool is set by a tool controller. More...
 
(void) - toolControllerDidUnsetTool:
 Called when this tool is unset by a tool controller. More...
 
(void) - toolControllerWillUnsetTool:
 Called when this tool is about to be unset by a tool controller. 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 <DKDrawingTool>
(NSString *) - actionName
 
(NSCursor *) - cursor
 
(NSInteger- mouseDownAtPoint:targetObject:layer:event:delegate:
 
(void) - mouseDraggedToPoint:partCode:layer:event:delegate:
 
(BOOL- mouseUpAtPoint:partCode:layer:event:delegate:
 

Class Methods

(void) + registerDrawingToolForObject:withName:
 Create a tool for an existing object. More...
 
(void) + setStyleForCreatedObjects:
 Set a style to be used for subsequently created objects. More...
 
(DKStyle *) + styleForCreatedObjects
 Return a style to be used for subsequently created objects. More...
 
- Class Methods inherited from DKDrawingTool
(DKDrawingTool *) + drawingToolWithKeyboardEquivalent:
 Retrieve a tool from the registry matching the key equivalent indicated by the key event passed. More...
 
(DKDrawingTool *) + drawingToolWithName:
 Retrieve a tool from the registry with the given name. More...
 
(id+ firstResponderAbleToSetTool
 
(void) + loadDefaults
 Load tool defaults from the user defaults. More...
 
(void) + registerDrawingTool:withName:
 Register a tool in th eregistry with the given name. More...
 
(void) + registerStandardTools
 Set a "standard" set of tools in the registry. More...
 
(void) + saveDefaults
 Save tool defaults to the user defaults. More...
 
(NSDictionary *) + sharedToolRegistry
 Return the shared instance of the tool registry. More...
 
(NSArray *) + toolNames
 Return a list of registered tools' names, sorted alphabetically. More...
 
(BOOL+ toolPerformsUndoableAction
 Does the tool ever implement undoable actions? 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

id m_protoObject
 

Detailed Description

This tool class is used to make all kinds of drawable objects.

This tool class is used to make all kinds of drawable objects. It works by copying a prototype object which will be some kind of drawable, adding it to the target layer as a pending object, then proceeding as for an edit operation. When complete, if the object is valid it is committed to the layer as a permanent item.

The prototype object can have all of its parameters set up in advance as required, including an attached style.

You can also set up a style to be applied to all new objects initially as an independent parameter.

Method Documentation

- (NSImage*) image

Return an image showing what the tool creates.

The image may be used as an icon for this tool in a UI, for example

Returns
an image
- (id) initWithPrototypeObject: (id< NSObject >)  aPrototype

Initialize the tool.

Parameters
aPrototypean object that will be used as the tool's prototype - each new object created will
Returns
the tool object
- (id) objectFromPrototype

Return a new object copied from the prototype, but with the current class style if there is one.

The returned object is autoreleased

Returns
a new object based on the prototype.
- (id) prototype

Return the object to be copied when the tool creates a new one.

Returns
an object - each new object created will be a copy of this one.
+ (void) registerDrawingToolForObject: (id< NSCopying >)  shape
withName: (NSString *)  name 

Create a tool for an existing object.

This method conveniently allows you to create tools for any object you already have. For example if you create a complex shape from others, or make a group of objects, you can turn that object into an interactive tool to make more of the same.

Parameters
shapea drawable object that can be created by the tool - typically a DKDrawableShape
namethe name of the tool to register this with
- (void) setPrototype: (id< NSObject >)  aPrototype

Set the object to be copied when the tool created a new one.

Parameters
aPrototypean object that will be used as the tool's prototype - each new object created will
- (void) setStyle: (DKStyle *)  aStyle
+ (void) setStyleForCreatedObjects: (DKStyle *)  aStyle

Set a style to be used for subsequently created objects.

If you set nil, the style set in the prototype object for the individual tool will be used instead.

Parameters
aStylea style object that will be applied to each new object as it is created
- (void) setStylePickupEnabled: (BOOL pickup
- (DKStyle*) style
+ (DKStyle*) styleForCreatedObjects

Return a style to be used for subsequently created objects.

If you set nil, the style set in the prototype object for the individual tool will be used instead.

Returns
a style object that will be applied to each new object as it is created, or nil
- (BOOL) stylePickupEnabled

Member Data Documentation

- (id) m_protoObject
protected