DrawKit
Vector and illustration framework for Mac OS X
Instance Methods | Class Methods | List of all members
DKStyle Class Reference
Inheritance diagram for DKStyle:
Inheritance graph
[legend]

Instance Methods

(NSString *) - actionNameForTextAttribute:
 
(void) - adoptFromText:
 
(NSTextAlignment) - alignment
 
(void) - applyStrokeAttributesToPath:
 Applies the cap, join, mitre limit, dash and line width attributes of the rear-most stroke to the path. More...
 
(void) - applyToText:
 
(void) - assignUniqueKey
 Sets the unique key of the style. More...
 
(void) - changeKeyPath:ofObject:toValue:
 Vectors undo invocations back to the object from whence they came. More...
 
(void) - changeTextAttribute:toValue:
 
(void) - clearRemergeFlag
 
(id- clone
 Returns a copy of the style having a new unique ID. More...
 
(BOOL- copyToPasteboard:
 Copies the style to the pasteboard. More...
 
(NSUInteger- countOfClients
 Returns the number of client objects using this style. More...
 
(NSUInteger- countOfStrokes
 Returns the number of strokes. More...
 
(id- currentRenderClient
 Returns the current object being rendered by this style. More...
 
(DKStyle *) - derivedStyleWithPasteboard:
 Returns a style based on the receiver plus any data on the clipboard we are able to use. More...
 
(DKStyle *) - derivedStyleWithPasteboard:withOptions:
 Returns a style based on the receiver plus any data on the clipboard we are able to use. More...
 
(DKStyle *) - drawingStyleFromTextAttributes
 
(DKFill *) - fill
 
(NSColor *) - fillColour
 
(NSFont *) - font
 
(CGFloat- fontSize
 
(BOOL- hasFill
 Queries whether the style has at least one filling property. More...
 
(BOOL- hasHatch
 Queries whether the style has at least one hatch property. More...
 
(BOOL- hasImageComponent
 
(BOOL- hasStroke
 Queries whether the style has at least one stroke. More...
 
(BOOL- hasTextAdornment
 Queries whether the style has at least one text adornment property. More...
 
(BOOL- hasTextAttributes
 Return wjether the style has any text attributes set. More...
 
(NSImage *) - image
 
(NSImage *) - imageComponent
 
(NSImage *) - imageToFitSize:
 
(BOOL- isEmpty
 Queries whether the style has any components at all. More...
 
(BOOL- isEqualToStyle:
 Is this style the same as <aStyle>? More...
 
(BOOL- isStyleRegistered
 Returns whether the style is registered with the current style registry. More...
 
(BOOL- isStyleSharable
 Returns whether the style can be shared among multiple objects, or whether unique copies should be used. More...
 
(NSTimeInterval) - lastModificationTimestamp
 
(BOOL- locked
 Returns whether the style is locked and cannot be edited. More...
 
(CGFloat- maxStrokeWidth
 Returns the widest stroke width in the style. More...
 
(CGFloat- maxStrokeWidthDifference
 Returns the difference between the widest and narrowest strokes. More...
 
(void) - notifyClientsAfterChange
 Informs clients that a property of the style has just changed. More...
 
(void) - notifyClientsBeforeChange
 Informs clients that a property of the style is about to change. More...
 
(NSParagraphStyle *) - paragraphStyle
 
(NSArray *) - registryKeys
 Returns the list of keys that the style is registered under (if any) More...
 
(void) - removeTextAttributes
 Remove all of the style's current text attributes. More...
 
(BOOL- requiresRemerge
 Query whether the style should be considered for a re-merge with the registry. More...
 
(void) - scaleStrokeWidthsBy:withoutInformingClients:
 Adjusts all contained stroke widths by the given scale value. More...
 
(void) - setAlignment:
 
(void) - setFillColour:
 
(void) - setFont:
 
(void) - setFontSize:
 
(void) - setImageComponent:
 
(void) - setLocked:
 Set whether style is locked (editable) More...
 
(void) - setParagraphStyle:
 
(void) - setString:
 
(void) - setStrokeColour:
 
(void) - setStrokeDash:
 
(void) - setStrokeLineCapStyle:
 
(void) - setStrokeLineJoinStyle:
 
(void) - setStrokeWidth:
 
(void) - setStyleSharable:
 Sets whether the style can be shared among multiple objects, or whether unique copies should be used. More...
 
(void) - setTextAttributes:
 Sets the text attributes dictionary. More...
 
(void) - setTextColour:
 
(void) - setUnderlined:
 
(void) - setUndoManager:
 Sets the undo manager that style changes will be recorded by. More...
 
(NSImage *) - standardStyleSwatch
 Creates a thumbnail image of the style. More...
 
(NSString *) - string
 
(DKStroke *) - stroke
 
(NSColor *) - strokeColour
 
(DKStrokeDash *) - strokeDash
 
(NSLineCapStyle) - strokeLineCapStyle
 
(NSLineJoinStyle) - strokeLineJoinStyle
 
(CGFloat- strokeWidth
 
(DKStyle *) - styleByMergingFromStyle:
 Returns a new style formed by copying the rasterizers from the receiver and the other style into one object. More...
 
(DKStyle *) - styleByRemovingRenderersOfClass:
 Returns a new style formed by copying the rasterizers from the receiver but not those of <aClass> More...
 
(NSImage *) - styleSwatchWithSize:type:
 Creates a thumbnail image of the style. More...
 
(void) - styleWasAttached:
 Called when a style is attached to an object. More...
 
(void) - styleWillBeRemoved:
 Called when a style is about to be removed from an object. More...
 
(NSString *) - swatchCacheKeyForSize:type:
 Return a key for the swatch cache for the given size and type of swatch. More...
 
(NSDictionary *) - textAttributes
 Returns the attributes dictionary. More...
 
(NSColor *) - textColour
 
(void) - toggleUnderlined
 
(NSInteger- underlined
 
(NSUndoManager *) - undoManager
 Returns the undo manager that style changes will be recorded by. More...
 
(NSString *) - uniqueKey
 Returns the unique key of the style. More...
 
- Instance Methods inherited from DKRastGroup
(void) - addRenderer:
 
(BOOL- containsRendererOfClass:
 
(NSUInteger- countOfRenderList
 
(NSUInteger- indexOfRenderer:
 
(void) - insertObject:inRenderListAtIndex:
 
(void) - insertRenderer:atIndex:
 
(BOOL- isValid
 
(void) - moveRendererAtIndex:toIndex:
 
(id- objectInRenderListAtIndex:
 
(void) - observableWasAdded:
 
(void) - observableWillBeRemoved:
 
(void) - removeAllRenderers
 
(void) - removeObjectFromRenderListAtIndex:
 
(void) - removeRenderer:
 
(void) - removeRendererAtIndex:
 
(void) - removeRenderersOfClass:inSubgroups:
 
(DKRasterizer *) - rendererAtIndex:
 
(NSArray *) - renderersOfClass:
 
(DKRasterizer *) - rendererWithName:
 
(NSArray *) - renderList
 
(DKRastGroup *) - root
 
(void) - setRenderList:
 
- Instance Methods inherited from DKRasterizer
(DKClippingOption) - clipping
 Whether the rasterizer's effect is clipped to the path or not, and if so, which side. More...
 
(DKRastGroup *) - container
 Returns the immediate container of this object, if owned by a group. More...
 
(BOOL- enabled
 
(NSString *) - label
 
(NSString *) - name
 
(NSBezierPath *) - renderingPathForObject:
 Returns the path to render given the object doing the rendering. More...
 
(void) - setClipping:
 
(void) - setClippingWithoutNotifying:
 
(void) - setContainer:
 Sets the immediate container of this object. More...
 
(void) - setEnabled:
 
(void) - setName:
 
(NSString *) - styleScript
 
- Instance Methods inherited from GCObservableObject
(NSString *) - actionNameForKeyPath:
 
(NSString *) - actionNameForKeyPath:changeKind:
 
(NSArray *) - oldArrayValueForKeyPath:
 
(void) - registerActionNames
 
(void) - sendInitialValuesForAllPropertiesToObserver:context:
 
(void) - setActionName:forKeyPath:
 
(BOOL- setUpKVOForObserver:
 
(void) - setUpObservables:forObserver:
 
(BOOL- tearDownKVOForObserver:
 
(void) - tearDownObservables:forObserver:
 
- 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 <DKRasterizer>
(NSSize) - extraSpaceNeeded
 
(BOOL- isFill
 
(void) - render:
 
(void) - renderPath:
 
- Instance Methods inherited from <NSCoding>
(void) - encodeWithCoder:
 
(id- initWithCoder:
 
- Instance Methods inherited from <NSCopying>
(id- copyWithZone:
 
- Instance Methods inherited from <NSMutableCopying>
(id- mutableCopyWithZone:
 

Class Methods

(BOOL+ canInitWithPasteboard:
 
(NSShadow *) + defaultShadow
 Returns a default NSShadow object. More...
 
(DKStyle *) + defaultStyle
 
(DKStyle *) + defaultTextStyle
 
(DKStyle *) + defaultTrackStyle
 
(void) + registerStyle:withPasteboardName:
 
(void) + setShouldAntialias:
 Set whether drawing should be anti-aliased or not. More...
 
(void) + setShouldSubstitutePlaceholderStyle:
 Set whether the style should substitute a simple placeholder when a style is complex and slow to render. More...
 
(void) + setStylesAreSharableByDefault:
 Set whether styles are generally shared or not. More...
 
(BOOL+ setWillDrawShadows:
 Set whether shadow attributes within a style should be drawn. More...
 
(BOOL+ shouldAntialias
 Set whether drawing should be anti-aliased or not. More...
 
(BOOL+ shouldSubstitutePlaceholderStyle
 Set whether the style should substitute a simple placeholder when a style is complex and slow to render. More...
 
(DKStyle *) + styleFromPasteboard:
 
(NSString *) + styleNameForFont:
 Returns the name and size of the font in a form that can be used as a style name. More...
 
(NSArray *) + stylePasteboardTypes
 Return a list of types supported by styles for pasteboard operations. More...
 
(BOOL+ stylesAreSharableByDefault
 Query whether styles are generally shared or not. More...
 
(DKStyle *) + styleWithDotDensity:foreColour:backColour:
 
(DKStyle *) + styleWithFillColour:strokeColour:
 
(DKStyle *) + styleWithFillColour:strokeColour:strokeWidth:
 
(DKStyle *) + styleWithPasteboardName:
 
(DKStyle *) + textStyleWithFont:
 
(BOOL+ willDrawShadows
 Set whether shadow attributes within a style should be drawn. More...
 
- Class Methods inherited from DKRasterizer
(DKRasterizer *) + rasterizerFromPasteboard:
 
- Class Methods inherited from GCObservableObject
(NSString *) + actionNameForKeyPath:objClass:
 
(NSArray *) + observableKeyPaths
 
(void) + registerActionName:forKeyPath:objClass:
 
- Class Methods inherited from NSObject
(id+ alloc
 
(Class+ class
 
(void) + initialize
 
(void) + load
 
(id+ new
 
- Class Methods inherited from <NSKeyValueBindingCreation>
(void) + exposeBinding:
 

Method Documentation

- (NSString*) actionNameForTextAttribute: (NSString *)  attribute

Provided by category DKStyle(TextAdditions).

- (void) adoptFromText: (NSAttributedString *)  text

Provided by category DKStyle(TextAdditions).

- (NSTextAlignment) alignment

Provided by category DKStyle(TextAdditions).

- (void) applyStrokeAttributesToPath: (NSBezierPath *)  path

Applies the cap, join, mitre limit, dash and line width attributes of the rear-most stroke to the path.

This can be used to set up a path for a Quartz operation such as outlining. The rearmost stroke attribute is used if there is more than one on the basis that this forms the largest element of the stroke. However, for the line width the max stroke is applied. If there are no strokes the path is not changed.

Parameters
patha bezier path to apply the attributes to
- (void) applyToText: (NSMutableAttributedString *)  text

Provided by category DKStyle(TextAdditions).

- (void) assignUniqueKey

Sets the unique key of the style.

Called when the object is inited, this assigns a unique key. The key cannot be reassigned - its purpose is to identify this style regardless of any mutations it otherwise undergoes, including its ordinary name.

+ (BOOL) canInitWithPasteboard: (NSPasteboard *)  pb
- (void) changeKeyPath: (NSString *)  keypath
ofObject: (id object
toValue: (id value 

Vectors undo invocations back to the object from whence they came.

Parameters
keypaththe keypath of the action, relative to the object
objectthe real target of the invocation
- (void) changeTextAttribute: (NSString *)  attribute
toValue: (id val 

Provided by category DKStyle(TextAdditions).

- (void) clearRemergeFlag
- (id) clone

Returns a copy of the style having a new unique ID.

Similar to -mutabelCopy except name is copied and the object is returned autoreleased

Returns
a new style object
- (BOOL) copyToPasteboard: (NSPasteboard *)  pb

Copies the style to the pasteboard.

Puts both the archived style and its key (as a separate type) on the pasteboard. When pasting a style, the key should be used in preference to allow a possible shared style to work as expected.

Parameters
pbthe pasteboard to copy to

Implements DKRasterizer.

- (NSUInteger) countOfClients

Returns the number of client objects using this style.

This is for information only - do not base critical code on this value

Returns
an unsigned integer, the number of clients using this style
- (NSUInteger) countOfStrokes

Returns the number of strokes.

Counts all strokes, including those in subgroups.

Returns
the number of stroke rasterizers
- (id) currentRenderClient

Returns the current object being rendered by this style.

This is only valid when called while rendering is in progress - mainly for the benefit of renderers that are part of this style

Returns
the current rendering object
+ (NSShadow*) defaultShadow

Returns a default NSShadow object.

Shadows are set as properties of certain renderers, such as DKFill and DKStroke

Returns
a shadow object
+ (DKStyle*) defaultStyle
+ (DKStyle*) defaultTextStyle

Provided by category DKStyle(TextAdditions).

+ (DKStyle*) defaultTrackStyle
- (DKStyle*) derivedStyleWithPasteboard: (NSPasteboard *)  pb

Returns a style based on the receiver plus any data on the clipboard we are able to use.

This method is used when dragging properties such as colours onto an object. The object's existing style is used as a starting point, then any data on the pasteboard we can use such as colours, images, etc, is used to add or change properties of the style. For example if the pb has a colour, it will be set as the first fill colour, or add a fill if there isn't one. Images are converted to image adornments, text to text adornments, etc. Note that it's impossible for this method to anticipate what the user is really expecting - it does what it sensibly can, but in some cases it won't be appropriate. It is up to the receiver of the drag itself to make the most appropriate choice about what happens to an object's appearance. If the style could not make use of any data on the clipboard, it returns itself, thus avoiding an unnecessary copy of the style when its contents were not actually changed

Parameters
pbthe pasteboard to take additional data from
Returns
a new style
- (DKStyle*) derivedStyleWithPasteboard: (NSPasteboard *)  pb
withOptions: (DKDerivedStyleOptions)  options 

Returns a style based on the receiver plus any data on the clipboard we are able to use.

See notes for derivedStyleWithPasteboard: The options are used to set up renderers in more appropriate ways when the type of object that the style will be attached to is known.

Parameters
pbthe pasteboard to take additional data from
optionssome hints that can influence the outcome of the operation
Returns
a new style
- (DKStyle*) drawingStyleFromTextAttributes

Provided by category DKStyle(TextAdditions).

- (DKFill*) fill

Provided by category DKStyle(SimpleAccess).

- (NSColor*) fillColour

Provided by category DKStyle(SimpleAccess).

- (NSFont*) font

Provided by category DKStyle(TextAdditions).

- (CGFloat) fontSize

Provided by category DKStyle(TextAdditions).

- (BOOL) hasFill

Queries whether the style has at least one filling property.

This queries all rasterizers for the -isFill property

Returns
YES if there are one or more fill properties, NO otherwise
- (BOOL) hasHatch

Queries whether the style has at least one hatch property.

Hatches are not always considered to be 'fills' in the normal sense, so hatches are counted separately

Returns
YES if there are one or more hatches, NO otherwise
- (BOOL) hasImageComponent

Provided by category DKStyle(SimpleAccess).

- (BOOL) hasStroke

Queries whether the style has at least one stroke.

Returns
YES if there are one or more strokes, NO otherwise
- (BOOL) hasTextAdornment

Queries whether the style has at least one text adornment property.

Returns
YES if there are one or more text adornments, NO otherwise
- (BOOL) hasTextAttributes

Return wjether the style has any text attributes set.

Returns
YES if there are any text attributes
- (NSImage*) image
- (NSImage*) imageComponent

Provided by category DKStyle(SimpleAccess).

- (NSImage*) imageToFitSize: (NSSize)  aSize
- (BOOL) isEmpty

Queries whether the style has any components at all.

Returns
YES if there are no components and no text attributes, NO if there is at least 1 or has text
- (BOOL) isEqualToStyle: (DKStyle *)  aStyle

Is this style the same as <aStyle>?

Styles are considered equal if they have the same unique ID and the same timestamp.

Parameters
aStylea style to compare this with
Returns
YES if the styles ar the same, NO otherwise
- (BOOL) isStyleRegistered

Returns whether the style is registered with the current style registry.

This method gives a definitive answer about whether the style is registered. Along with locking, this should prevent accidental editing of styles that an app might prefer to consider "read only".

Returns
YES if known to the registry
- (BOOL) isStyleSharable

Returns whether the style can be shared among multiple objects, or whether unique copies should be used.

Returns
YES to share among several objects, NO to make unique copies.
- (NSTimeInterval) lastModificationTimestamp
- (BOOL) locked

Returns whether the style is locked and cannot be edited.

Returns
YES if locked (non-editable)
- (CGFloat) maxStrokeWidth

Returns the widest stroke width in the style.

Returns
a number, the width of the widest contained stroke, or 0.0 if there are no strokes.
- (CGFloat) maxStrokeWidthDifference

Returns the difference between the widest and narrowest strokes.

Returns
a number, can be 0.0 if there are no strokes or only one stroke
- (void) notifyClientsAfterChange

Informs clients that a property of the style has just changed.

This method is called in response to any observed change to any renderer the style contains

- (void) notifyClientsBeforeChange

Informs clients that a property of the style is about to change.

- (NSParagraphStyle*) paragraphStyle

Provided by category DKStyle(TextAdditions).

+ (void) registerStyle: (DKStyle *)  style
withPasteboardName: (NSString *)  pbname 
- (NSArray*) registryKeys

Returns the list of keys that the style is registered under (if any)

The returned array may contain no keys if the style isn't registered, or >1 key if the style has been registered multiple times with different keys (not recommended). The key is not intended for display in a user interface and has no relationship to the style's name.

Returns
a list of keys (NSStrings)
- (void) removeTextAttributes

Remove all of the style's current text attributes.

Does nothing if the style is locked

- (BOOL) requiresRemerge

Query whether the style should be considered for a re-merge with the registry.

Re-merging is done when a document is opened. Any styles that were registered when it was saved will set this flag when the style is inited from the archive. The document gathers these styles together and remerges them according to the user's settings.

Returns
<YES> if the style should be a candidate for re-merging
- (void) scaleStrokeWidthsBy: (CGFloat scale
withoutInformingClients: (BOOL quiet 

Adjusts all contained stroke widths by the given scale value.

Parameters
scalethe scale factor, e.g. 2.0 will double all stroke widths
quietif YES, will ignore locked state and not inform clients. This is done when making hit
- (void) setAlignment: (NSTextAlignment)  align

Provided by category DKStyle(TextAdditions).

- (void) setFillColour: (NSColor *)  fillColour

Provided by category DKStyle(SimpleAccess).

- (void) setFont: (NSFont *)  font

Provided by category DKStyle(TextAdditions).

- (void) setFontSize: (CGFloat size

Provided by category DKStyle(TextAdditions).

- (void) setImageComponent: (NSImage *)  anImage

Provided by category DKStyle(SimpleAccess).

- (void) setLocked: (BOOL lock

Set whether style is locked (editable)

Locked styles are intended not to be editable, though this cannot be entirely enforced by the style itself - client code should honour the locked state. You cannot add or remove renderers from a locked style. Styles are normally not locked, but styles that are put in the registry are locked by that action. Changing the lock state doesn't inform clients, since in general this does not cause a visual change.

Parameters
lockYES to lock the style
- (void) setParagraphStyle: (NSParagraphStyle *)  style

Provided by category DKStyle(TextAdditions).

+ (void) setShouldAntialias: (BOOL aa

Set whether drawing should be anti-aliased or not.

Default is YES. Turning off anti-aliasing can speed up drawing at the expense of quality.

Parameters
aaYES to anti-alias, NO to turn anti-aliasing off
+ (void) setShouldSubstitutePlaceholderStyle: (BOOL substitute

Set whether the style should substitute a simple placeholder when a style is complex and slow to render.

Default is NO. Typically this method causes a style to render a single simple stroke in place of its actual components. If the style has a simple stroke, it is used, otherwise a default one is used.

Parameters
substituteYES to substitute a faster placeholder style for complex styles
- (void) setString: (NSString *)  aString

Provided by category DKStyle(SimpleAccess).

- (void) setStrokeColour: (NSColor *)  strokeColour

Provided by category DKStyle(SimpleAccess).

- (void) setStrokeDash: (DKStrokeDash *)  aDash

Provided by category DKStyle(SimpleAccess).

- (void) setStrokeLineCapStyle: (NSLineCapStyle)  capStyle

Provided by category DKStyle(SimpleAccess).

- (void) setStrokeLineJoinStyle: (NSLineJoinStyle)  joinStyle

Provided by category DKStyle(SimpleAccess).

- (void) setStrokeWidth: (CGFloat strokeWidth

Provided by category DKStyle(SimpleAccess).

+ (void) setStylesAreSharableByDefault: (BOOL share

Set whether styles are generally shared or not.

Sharing styles means that all object that share that style will change when a style property changes, regardless of any other state information, such as selection, layer owner, etc. Styles are set NOT to be shared by default.

Parameters
shareYES to share styles, NO to return unique copies.
- (void) setStyleSharable: (BOOL share

Sets whether the style can be shared among multiple objects, or whether unique copies should be used.

Default is copied from class setting +shareStyles. Changing this flag is not undoable and does not inform clients. It does send a notification however.

Parameters
shareYES to share among several objects, NO to make unique copies.
- (void) setTextAttributes: (NSDictionary *)  attrs

Sets the text attributes dictionary.

Objects that display text can use a style's text attributes. This together with sharable styles allows text (labels in particular) to have their styling changed for a whole drawing. See also DKStyle+Text which gives more text-oriented methods that manipulate theses attributes.

Parameters
attrsa dictionary of text attributes
- (void) setTextColour: (NSColor *)  aColour

Provided by category DKStyle(TextAdditions).

- (void) setUnderlined: (NSInteger uval

Provided by category DKStyle(TextAdditions).

- (void) setUndoManager: (NSUndoManager *)  undomanager

Sets the undo manager that style changes will be recorded by.

The undo manager is not retained.

Parameters
undomanagerthe manager to use
+ (BOOL) setWillDrawShadows: (BOOL drawShadows

Set whether shadow attributes within a style should be drawn.

Drawing shadows is one of the main performance killers, so this provides a way to turn them off in certain situations. Rasterizers that have a shadow property should check and honour this setting.

Parameters
drawShadowsYES to draw shadows, NO to suppress them
Returns
the previous state of this setting
+ (BOOL) shouldAntialias

Set whether drawing should be anti-aliased or not.

Default is YES. Turning off anti-aliasing can speed up drawing at the expense of quality.

Returns
YES to anti-alias, NO to turn anti-aliasing off
+ (BOOL) shouldSubstitutePlaceholderStyle

Set whether the style should substitute a simple placeholder when a style is complex and slow to render.

Default is NO. Typically this method causes a style to render a single simple stroke in place of its actual components. If the style has a simple stroke, it is used, otherwise a default one is used.

Returns
YES to substitute a faster placeholder style for complex styles
- (NSImage*) standardStyleSwatch

Creates a thumbnail image of the style.

The swatch returned will have the curve path style if it has no fill, otherwise the rect style.

Returns
an image of a path rendered using this style in the default size
- (NSString*) string

Provided by category DKStyle(SimpleAccess).

- (DKStroke*) stroke

Provided by category DKStyle(SimpleAccess).

- (NSColor*) strokeColour

Provided by category DKStyle(SimpleAccess).

- (DKStrokeDash*) strokeDash

Provided by category DKStyle(SimpleAccess).

- (NSLineCapStyle) strokeLineCapStyle

Provided by category DKStyle(SimpleAccess).

- (NSLineJoinStyle) strokeLineJoinStyle

Provided by category DKStyle(SimpleAccess).

- (CGFloat) strokeWidth

Provided by category DKStyle(SimpleAccess).

- (DKStyle*) styleByMergingFromStyle: (DKStyle *)  otherStyle

Returns a new style formed by copying the rasterizers from the receiver and the other style into one object.

The receiver's rasterizers are copied first, then otherStyles are appended, so they draw after (on top) of the receiver's.

Parameters
otherStylea style object
Returns
a new style object
- (DKStyle*) styleByRemovingRenderersOfClass: (Class aClass

Returns a new style formed by copying the rasterizers from the receiver but not those of <aClass>

Parameters
aClassthe rasterizer class not to be copied
Returns
a new style object
+ (DKStyle*) styleFromPasteboard: (NSPasteboard *)  pb
+ (NSString*) styleNameForFont: (NSFont *)  font

Returns the name and size of the font in a form that can be used as a style name.

Parameters
fonta font
Returns
a string, such as "Helvetica Bold 18pt"

Provided by category DKStyle(TextAdditions).

+ (NSArray*) stylePasteboardTypes

Return a list of types supported by styles for pasteboard operations.

Returns
an array listing the pasteboard types usable by DKStyle
+ (BOOL) stylesAreSharableByDefault

Query whether styles are generally shared or not.

Styles are set NOT to be shared by default.

Returns
YES if styles are shared, NO if unique copies will be returned
- (NSImage*) styleSwatchWithSize: (NSSize)  size
type: (DKStyleSwatchType)  type 

Creates a thumbnail image of the style.

Parameters
sizethe desired size of the thumbnail
typethe type of thumbnail - currently rect and path types are supported, or selected automatically
Returns
an image of a default path rendered using this style
- (void) styleWasAttached: (DKDrawableObject *)  toObject

Called when a style is attached to an object.

The notification's object is the drawable, not the style - the style is passed in the user info dictionary with the key 'style'.

Parameters
toObjectthe object the style was attached to
- (void) styleWillBeRemoved: (DKDrawableObject *)  fromObject

Called when a style is about to be removed from an object.

The notification's object is the drawable, not the style - the style is passed in the user info dictionary with the key 'style'. This permits this to be called by the dealloc method of the drawable, which would not be the case if the drawable was retained by the dictionary.

Parameters
toObjectthe object the style was attached to
+ (DKStyle*) styleWithDotDensity: (CGFloat percent
foreColour: (NSColor *)  fore
backColour: (NSColor *)  back 

Provided by category DKStyle(SimpleAccess).

+ (DKStyle*) styleWithFillColour: (NSColor *)  fc
strokeColour: (NSColor *)  sc 
+ (DKStyle*) styleWithFillColour: (NSColor *)  fc
strokeColour: (NSColor *)  sc
strokeWidth: (CGFloat sw 
+ (DKStyle*) styleWithPasteboardName: (NSString *)  name
- (NSString*) swatchCacheKeyForSize: (NSSize)  size
type: (DKStyleSwatchType)  type 

Return a key for the swatch cache for the given size and type of swatch.

The key is a simple concatenation of the size and the type, but don't rely on this anywhere - just ask for the swatch you want and if it's cached it will be returned.

Returns
a string that is used as the key to the swatches in the cache
- (NSDictionary*) textAttributes

Returns the attributes dictionary.

Renderers are not considered attributes in this sense

Returns
a dictionary of attributes
- (NSColor*) textColour

Provided by category DKStyle(TextAdditions).

+ (DKStyle*) textStyleWithFont: (NSFont *)  font

Provided by category DKStyle(TextAdditions).

- (void) toggleUnderlined

Provided by category DKStyle(TextAdditions).

- (NSInteger) underlined

Provided by category DKStyle(TextAdditions).

- (NSUndoManager*) undoManager

Returns the undo manager that style changes will be recorded by.

Returns
the style's current undo manager
- (NSString*) uniqueKey

Returns the unique key of the style.

The unique key is set once and for all time when the style is initialised, and is guaranteed unique as it is a UUID.

Returns
a string
+ (BOOL) willDrawShadows

Set whether shadow attributes within a style should be drawn.

Drawing shadows is one of the main performance killers, so this provides a way to turn them off in certain situations. Rasterizers that have a shadow property should check and honour this setting.

Returns
YES to draw shadows, NO to suppress them