ftp.nice.ch/Attic/openStep/developer/resources/IconKit.s.tgz#/IconKit-4.2/Good_Old_Stuff/Documentation/Classes/IKShelf.rtf

This is IKShelf.rtf in view mode; [Download] [Up]

Release 1.2  Copyright ©1994 by H. Scott Roy  All Rights Reserved.






IKShelf






Inherits From:	IKIconPath

Conforms To:	IKDependency

Declared In:	iconkit/IKShelf.h





Class Description

IKShelf recreates the NEXTSTEP shelves found in Workspace and Librarian.  It inherits from IKIconPath and behaves identically for objects already on the shelf, providing methods for editing and dragging.  It implements new methods so that objects can be dragged on and off the shelf.

An IKShelf can be configured to dynamically add and subtract shelf locations whenever its size changes.  When dynamic sizing is enabled, the shelf responds to resizing events by filling itself with as many cells as it can fit in the new frame.

Each shelf location can be individually customized.  The IKShelf class supports locked shelves, in which a dragged object remains on the shelf, in addition to the standard NEXTSTEP behavior.  The documentation for IKCell contains complete details of the various possibilities.  The shelf as a whole can be set up so that it only accepts objects of a specific class.

An IKShelf sends out announcements messages at various stages of a dragging operation.  These methods are collected into the informal IKShelfAnnouncements protocol:

- shelf:isDragging:from:
- shelf:dragWillEnter:
- shelf:dragWillExit:
- shelf:dragWillComplete:

The shelf:isDragging:from: message lets an object intervene to determine the dragging operation.  To receive announcements, an object should send an IKShelf either an addUser: or addListener: message and implement a method for each message it wants to receive.





Instance Variables

id users;
id objectToPaste;
char *classToHold;
BOOL dynamic;
BOOL lastIsEmptyContainer;



users	The IKAnnouncer object the shelf uses to keep track of its users and listeners.

objectToPaste	The current object on the dragging pasteboard.

classToHold	The class of objects that the shelf will accept through drag and drop.

dynamic	True if the shelf dynamically adds and removes cells when resizing.

lastIsEmptyContainer	True if the current cell under the mouse is an empty shelf location.






Method Types

Initialization	- initFrame:
	- initFrame:mode:cellClass:numRows:numCols:

Dynamic resizing	- isDynamic
	- setDynamic:
	- sizeTo::
	- fillWithCells
	- sizeCellsToFit
	
Configure drags	- classToHold
	- setClassToHold:
	
Responding to drags	- cellEntered:
	- cellUpdated:
	- cellExited:
	- draggingEntered:
	- draggingExited:
	- prepareForDragOperation:
	- performDragOperation:
	- concludeDragOperation:
	- draggingOperation:
	
Users and listeners	- addUser:
	- addListener:
	- removeUser:
	- removeListener:

Current selection	- delegate





Instance Methods

addListener:
-  addListener: who

Registers who to receive announcements and polls sent out by the shelf.  An IKShelf makes no distinction between its users and listeners.

See also:  - removeListener:, - addListener: (IKDependency)




addUser:
-  addUser: who

Registers who to receive announcements and polls sent out by the shelf.  An IKShelf makes no distinction between its users and listeners.

See also:  - removeUser:, - addUser: (IKDependency)




cellEntered:
-  (NXDragOperation)cellEntered:(id <NXDraggingInfo>)sender

IKShelf overrides this method to check whether the new cell under the mouse is an empty shelf location.  If it is, the object on the pasteboard is temporarily installed as the current cell's delegate.  It will be removed if the user drags to a different cell.

See also:  - cellEntered: (IKIconPath)




cellExited:
-  cellExited:(id <NXDraggingInfo>)sender

IKShelf overrides this method to remove an object from the previous shelf location.

See also:  - cellExited: (IKIconPath)




cellUpdated:
-  (NXDragOperation)cellUpdated:(id <NXDraggingInfo>)sender

If the mouse is currently over an empty shelf location, this method invokes draggingOperation to determine an appropriate dragging operation.

See also:  - cellUpdated: (IKIconPath)




classToHold
-  (const char *)classToHold

Returns the class of objects that the shelf accepts through drag and drop.   When responding to an incoming dragging event, the shelf invokes the indicated class's readFromPasteboard: method to read an object off the pasteboard.  If classToHold is NULL the shelf will not accept dragged objects.

See also:  - setClassToHold:




concludeDragOperation:
-  concludeDragOperation:(id <NXDraggingInfo>)sender

Sends out a shelf:dragWillComplete: announcement to all users and listeners that can respond.

See also:  - concludeDragOperation (IKIconPath)




delegate
-  delegate

Returns the delegate of the currently selected cell.




draggingEntered:
-  (NXDragOperation)draggingEntered:(id <NXDraggingInfo>)sender

The shelf sends out a shelf:dragWillEnter: announcement, then looks for an object on the dragging pasteboard that it can add to the shelf.  It first tries the readFromPasteboard: method of the class it's set up to hold, falling back on IKReadID() if that method is unimplemented.  The shelf temporarily adds itself as a user of whatever object it reads.

See also:  - cellEntered:




draggingExited:
-  draggingExited:(id <NXDraggingInfo>)sender

The shelf sends out a shelf:dragWillExit: announcement, removes itself as a user of whatever object it read off the pasteboard, and invokes the draggingExited: method of its superclass.

See also:  - cellEntered:




draggingOperation:
-  (NXDragOperation)draggingOperation:(id <NXDraggingInfo>)sender

A shelf uses this method to determine which dragging operation it should perform.  It sends out a shelf:isDragging:from: message to the first user that can responds to it, and that user should reply with the desired dragging operation.  The first argument of this message is the shelf; the second is the object the shelf wants to add; the third is sender, which the user can query for information about the dragging session.

The shelf returns NX_DragOperationAll if no user implements shelf:isDragging:from:.

See also:  - cellEntered:




fillWithCells
-  fillWithCells

Fills the shelf with as many cells of the current size as will fit in the current frame.  Returns self.

See also:  - sizeCellsToFit




initFrame:
-  initFrame:(const NXRect *)frameRect

Initializes a new IKShelf.  The shelf is set up to use a prototype IKCell that is a locked shelf location.

See also:  - initFrame:mode:cellClass:numRows:numCols:




initFrame:
-  initFrame:(const NXRect *)frameRect
mode:(int)aMode
cellClass: class
numRows:(int)numRows
numCols:(int)numCols

The designated initializer for an IKShelf.  The shelf is set up to dynamically resize itself with a cell size of 70x74,  and will initially accept any object that copies itself to the pasteboard using local id.

See also:  - initFrame:mode:cellClass:numRows:numCols: (IKIconPath)




isDynamic
-  (BOOL)isDynamic

Returns YES if the shelf dynamically adds and subtracts rows and columns when its size changes, and NO otherwise.

See also:  - setDynamic:




performDragOperation:
-  (BOOL)performDragOperation:(id <NXDraggingInfo>)sender

The shelf removes itself as a user of whatever object it read off the pasteboard.  The object will have already been added to the appropriate shelf location during cellEntered:.  Returns YES if the mouse was released over an empty shelf location.

See also:  - performDragOperation: (IKIconPath)




prepareForDragOperation:
-  (BOOL)prepareForDragOperation:(id <NXDraggingInfo>)sender

IKShelf overrides this method to return YES if the mouse was released over an empty shelf location.

See also:  - prepareForDragOperation (IKIconPath)




removeListener:
-  removeListener: who

Removes who as a user of the shelf.  Returns self.

See also:  - removeListener: (IKDependency)




removeUser:
-  removeUser: who

Removes who as a user of the shelf.  Returns self.

See also:  - removeUser: (IKDependency)




setClassToHold:
-  setClassToHold:(const char *)class

Sets the class of objects that the shelf will accept through drag and drop.  Drags are effectively disabled if class is NULL.

See also:  - classToHold




setDynamic:
-  setDynamic:(BOOL)flag

Sets whether or not the shelf performs dynamic resizing.

See also:  - isDynamic




sizeCellsToFit
-  sizeCellsToFit

Adjusts the shelf's intercell spacing so that the cells exactly fill out the cell frame.

See also:  - fillWithCells




sizeTo::
-  sizeTo:(NXCoord)width
:(NXCoord)height

Resizes the shelf.  The shelf will automatically add or subtract rows if dynamic sizing is enabled.

See also:  - isDynamic




These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.