DrawKit
Vector and illustration framework for Mac OS X
Instance Methods | List of all members
DKObjectDrawingLayer(Alignment) Category Reference

This category implements object alignment features for DKObjectDrawingLayer. More...

Instance Methods

(IBAction) - alignBottomEdges:
 Aligns the selected objects on their bottom edges. More...
 
(IBAction) - alignEdgesToGrid:
 
(IBAction) - alignHorizontalCentres:
 Aligns the selected objects on their horizontal centres. More...
 
(IBAction) - alignLeftEdges:
 Aligns the selected objects on their left edges. More...
 
(IBAction) - alignLocationToGrid:
 
(NSUInteger- alignmentMenuItemRequiredObjects:
 Returns the minimum number of objects needed to enable the user interface item. More...
 
(void) - alignObjectEdges:toGrid:
 Aligns the objects to the grid, resizing and positioning as necessary so that all edges lie on the grid. More...
 
(void) - alignObjectLocation:toGrid:
 Aligns a set of objects so their locations lie on a grid intersection. More...
 
(void) - alignObjects:toLocation:withAlignment:
 Aligns a set of objects to a given point. More...
 
(void) - alignObjects:toMasterObject:withAlignment:
 Aligns a set ofobjects. More...
 
(void) - alignObjects:withAlignment:
 Aligns a set of objects. More...
 
(IBAction) - alignRightEdges:
 Aligns the selected objects on their right edges. More...
 
(IBAction) - alignTopEdges:
 Aligns the selected objects on their top edges. More...
 
(IBAction) - alignVerticalCentres:
 Aligns the selected objects on their vertical centres. More...
 
(IBAction) - assignKeyObject:
 
(IBAction) - distributeHorizontalCentres:
 Distributes the selected objects to equalize the horizontal centres. More...
 
(IBAction) - distributeHorizontalSpace:
 Distributes the selected objects to equalize the horizontal space. More...
 
(BOOL- distributeObjects:withAlignment:
 Distributes a set of objects. More...
 
(IBAction) - distributeVerticalCentres:
 Distributes the selected objects to equalize the vertical centres. More...
 
(IBAction) - distributeVerticalSpace:
 Distributes the selected objects to equalize the vertical space. More...
 
(DKDrawableObject *) - keyObject
 Returns the object as the master to be used for alignment operations, etc. More...
 
(NSArray *) - objectsSortedByHorizontalPosition:
 Sorts a set of objects into order of their horizontal location. More...
 
(NSArray *) - objectsSortedByVerticalPosition:
 Sorts a set of objects into order of their vertical location. More...
 
(void) - setKeyObject:
 Nominates an object as the master to be used for alignment operations, etc. More...
 
(CGFloat- totalHorizontalSpace:
 Computes the amount of space available for a horizontal distribution operation. More...
 
(CGFloat- totalVerticalSpace:
 Computes the amount of space available for a vertical distribution operation. More...
 

Detailed Description

This category implements object alignment features for DKObjectDrawingLayer.

Method Documentation

- (IBAction) alignBottomEdges: (id sender

Aligns the selected objects on their bottom edges.

Parameters
senderthe action's sender

Extends class DKObjectDrawingLayer.

- (IBAction) alignEdgesToGrid: (id sender

Extends class DKObjectDrawingLayer.

- (IBAction) alignHorizontalCentres: (id sender

Aligns the selected objects on their horizontal centres.

Parameters
senderthe action's sender

Extends class DKObjectDrawingLayer.

- (IBAction) alignLeftEdges: (id sender

Aligns the selected objects on their left edges.

Parameters
senderthe action's sender

Extends class DKObjectDrawingLayer.

- (IBAction) alignLocationToGrid: (id sender

Extends class DKObjectDrawingLayer.

- (NSUInteger) alignmentMenuItemRequiredObjects: (id< NSValidatedUserInterfaceItem >)  item

Returns the minimum number of objects needed to enable the user interface item.

Call this from a generic validateMenuItem method for the layer as a whole

Parameters
itemthe user interface item to validate
Returns
number of objects needed for validation. If the item isn't a known alignment command, returns 0

Extends class DKObjectDrawingLayer.

- (void) alignObjectEdges: (NSArray *)  objects
toGrid: (DKGridLayer *)  grid 

Aligns the objects to the grid, resizing and positioning as necessary so that all edges lie on the grid.

The logical bounds is used for alignment, consistent with normal snapping behaviour.

May minimally resize the objects.

Parameters
objectsthe objects to align
gridthe grid to use

Extends class DKObjectDrawingLayer.

- (void) alignObjectLocation: (NSArray *)  objects
toGrid: (DKGridLayer *)  grid 

Aligns a set of objects so their locations lie on a grid intersection.

Does not resize the objects

Parameters
objectsthe objects to align
gridthe grid to use

Extends class DKObjectDrawingLayer.

- (void) alignObjects: (NSArray *)  objects
toLocation: (NSPoint)  loc
withAlignment: (NSInteger align 

Aligns a set of objects to a given point.

Parameters
objectsthe objects to align
locthe point to which the objects are aligned
alignthe alignment operation required

Extends class DKObjectDrawingLayer.

- (void) alignObjects: (NSArray *)  objects
toMasterObject: (id object
withAlignment: (NSInteger align 

Aligns a set ofobjects.

Parameters
objectsthe objects to align
objectthe "master" object - the one to which the others are aligned
alignthe alignment operation required

Extends class DKObjectDrawingLayer.

- (void) alignObjects: (NSArray *)  objects
withAlignment: (NSInteger align 

Aligns a set of objects.

Objects are aligned with the layer's nominated key object, by default the first object in the supplied list

Parameters
objectsthe objects to align
alignthe alignment operation required

Extends class DKObjectDrawingLayer.

- (IBAction) alignRightEdges: (id sender

Aligns the selected objects on their right edges.

Parameters
senderthe action's sender

Extends class DKObjectDrawingLayer.

- (IBAction) alignTopEdges: (id sender

Aligns the selected objects on their top edges.

Parameters
senderthe action's sender

Extends class DKObjectDrawingLayer.

- (IBAction) alignVerticalCentres: (id sender

Aligns the selected objects on their vertical centres.

Parameters
senderthe action's sender

Extends class DKObjectDrawingLayer.

- (IBAction) assignKeyObject: (id sender

Extends class DKObjectDrawingLayer.

- (IBAction) distributeHorizontalCentres: (id sender

Distributes the selected objects to equalize the horizontal centres.

Parameters
senderthe action's sender

Extends class DKObjectDrawingLayer.

- (IBAction) distributeHorizontalSpace: (id sender

Distributes the selected objects to equalize the horizontal space.

Parameters
senderthe action's sender

Extends class DKObjectDrawingLayer.

- (BOOL) distributeObjects: (NSArray *)  objects
withAlignment: (NSInteger align 

Distributes a set of objects.

Normally this is called by the higher level alignObjects: methods when a distribution alignment is detected

Parameters
objectsthe objects to distribute
alignthe distribution required
Returns
YES if the operation could be performed, NO otherwise

Extends class DKObjectDrawingLayer.

- (IBAction) distributeVerticalCentres: (id sender

Distributes the selected objects to equalize the vertical centres.

Parameters
senderthe action's sender

Extends class DKObjectDrawingLayer.

- (IBAction) distributeVerticalSpace: (id sender

Distributes the selected objects to equalize the vertical space.

Parameters
senderthe action's sender

Extends class DKObjectDrawingLayer.

- (DKDrawableObject*) keyObject

Returns the object as the master to be used for alignment operations, etc.

If no specific object is set (nil), then the first object in the selection is returned. If there's no selection, returns nil.

Returns
an object that is to be considered key for alignment ops

Extends class DKObjectDrawingLayer.

- (NSArray*) objectsSortedByHorizontalPosition: (NSArray *)  objects

Sorts a set of objects into order of their horizontal location.

Parameters
objectsthe objects to sort
Returns
a copy of the array sorted into horizontal order

Extends class DKObjectDrawingLayer.

- (NSArray*) objectsSortedByVerticalPosition: (NSArray *)  objects

Sorts a set of objects into order of their vertical location.

Parameters
objectsthe objects to sort
Returns
a copy of the array sorted into vertical order

Extends class DKObjectDrawingLayer.

- (void) setKeyObject: (DKDrawableObject *)  keyObject

Nominates an object as the master to be used for alignment operations, etc.

The object is not retained as it should already be owned. A nil object can be set to mean that the topmost select object should be considered key.

Parameters
keyObjectan object that is to be considered key for alignment ops

Extends class DKObjectDrawingLayer.

- (CGFloat) totalHorizontalSpace: (NSArray *)  objects

Computes the amount of space available for a horizontal distribution operation.

The list of objects must be sorted into order of their horizontal location. The space is the total distance between the leftmost and rightmost objects, minus the sum of the widths of the objects in between

Parameters
objectsthe objects to align
Returns
the total space available for distribution in the horizontal direction

Extends class DKObjectDrawingLayer.

- (CGFloat) totalVerticalSpace: (NSArray *)  objects

Computes the amount of space available for a vertical distribution operation.

The list of objects must be sorted into order of their vertical location. The space is the total distance between the top and bottom objects, minus the sum of the heights of the objects in between

Parameters
objectsthe objects to align
Returns
the total space available for distribution in the vertical direction

Extends class DKObjectDrawingLayer.