LDragTask is a PowerPlant class that is used for encapsulating a single drag action initiated using the Mac OS Drag Manager.
Methods :
The methods in this class are:
Data Members:
The data members in this class are:
Operation :
Normally, you will use this class in conjunction with the LDragAndDrop class. To learn more information about using this class, refer to PowerPlant Advanced Topics.
Source files:
See also:
Purpose:
The constructors create objects from the passed-in parameters.
Access:
Prototypes:
LDragTask( const EventRecord &inEventRecord );
// This constructor is for dragging a single, rectangular item
LDragTask( const EventRecord &inEventRecord,
const Rect &inItemRect,
ItemReference inItemRef,
FlavorType inFlavor,
void *inDataPtr,
Size inDataSize,
FlavorFlags inFlags );
// This constructor is for dragging an item outlined by a region
LDragTask( const EventRecord &inEventRecord,Parameters:
RgnHandle inItemRgn,
ItemReference inItemRef,
FlavorType inFlavor,
void *inDataPtr,
Size inDataSize,
FlavorFlags inFlags );
These constructors have the following parameters:
Remarks:
The inItemRect is in the local coordinates of the current port, so you may need
to call SetPort (or FocusDraw) beforehand.
Purpose:
The destructor destroys the object.
Access:
Prototype:
virtual ~LDragTask();
Purpose:
Add flavored items to the DragTask. If you use the short form
of the LDragTask() constructor (EventRecord only), you must override this function to add items to the drag
task.
Access:
Prototype:
void AddFlavors(DragReference inDragRef );Parameters:
The parameter for this method is:
Return:
Purpose:
This is a utility method for adding a rectangular item to the drag.
Access:
Prototype:
void AddRectDragItem( ItemReference inItemRef,Parameters:
const Rect &inItemRect);
This method has the following parameters:
Return:
Purpose:
This method performs a drag task. This function calls other member functions to add items to the drag and build the drag region, then calls the Drag Mananger to track the drag. You will not normally override this function.
Access:
Prototype:
OSErr DoDrag();Parameters:
Return:
This method returns an OSErr error code if an error occurs executing the drag. If no error
occurs, the return value will be noErr.
Purpose:
Return whether the drop location of the Drag is the Finder's Trash can Normally, you'll call this routine after the Drag completes to determine whether to delete the dragged items.
Access:
Prototype:
Boolean DropLocationIsFinderTrash();Parameters:
Return:
A Boolean indicating whether the drop location of the drag is the Finder's trash can.
Remarks:
Normally, you'll call this routine after the drag completes to determine whether to delete the dragged items.
Purpose:
This method returns the value of mDragRef.
Access:
Prototype:
DragReference GetDragReference();Parameters:
Return:
A DragReference containing the value of mDragRef.
Purpose:
This method returns the value of mDragRegion.
Access:
Prototype:
RgnHandle GetDragRegion();Parameters:
Return:
A RgnHandle containing the value of mDragRegion.
Purpose:
This method is a private initializer for the class.
Access:
Prototype:
void InitDragTask();Parameters:
Return:
Purpose:
Build the region outlining the items to be dragged.
Access:
Prototype:
void MakeDragRegion( DragReference inDragRef,Parameters:
RgnHandle inDragRegion );
This method has the following parameters:
Return:
Remarks:
If you use the short form of the LDragTask() constructor (EventRecord only), you must override this function to specify the drag region
for each item in the drag task.
Purpose:
This data member is the drag reference.
Access:
Prototype:
DragReference mDragRef;
Purpose:
This data member is the drag region.
Access:
Prototype:
RgnHandle mDragRegion;
Purpose:
This data member is the eent record, containing information about the event that just occurred.
Access:
Prototype:
const EventRecord &mEventRecord;