LDropArea is a PowerPlant abstract base class that is used for providing the interface to implement tracking and receiving functionality.
Methods :
The methods in this class are:
Data Members:
The data members in this class are:
Operation:
LDropArea uses the LArray class. Most of the data members of LDropArea are used internally by PowerPlant, and you won't need to use them.
Source files:
See also:
Purpose:
The constructor creates an object from the passed-in parameters. It initializes drag and drop if needed.
Access:
Prototype:
LDropArea ( WindowPtr inWindow );Parameters:
This constructor has the following parameter:
Purpose:
The destructor destroys the object.
Access:
Prototype:
virtual ~LDropArea();
Purpose:
Add a drop area to the list maintained by this class.
Access:
Prototype:
void AddDropArea( LDropArea *inDropArea,Parameters:
WindowPtr inMacWindow );
This method has the following parameter:
Return:
Purpose:
Draw the items for a drag in progress. This method gets called if you installed the optional DragDrawingProc for this drop area.
Access:
Prototype:
virtual void DoDragDrawing(Parameters:
DragRegionMessage inMessage,
RgnHandle inShowRgn,
Point inShowOrigin,
RgnHandle inHideRgn,
Point inHideOrigin,
DragReference inDragRef );
This method has the following parameter:
Return:
Purpose:
Modify the state of the mouse and modifier keys during a drag. This method gets called if you installed the optional DragInputProc for this drop area.
Access:
Prototype:
virtual void DoDragInput( Point ioMouse,Parameters:
SInt16 ioModifiers,
DragReference inDragRef );
This method has the following parameter:
Return:
Purpose:
Receive the items from a completed drag and drop. This method gets called after items are dropped into a drop area. The drag contains items that are acceptable, as defined by the and member functions. This method repeatedly calls ReceiveDragItem() for each item in the drag. You should override this method if you want to process the dragged items all at once.
Access:
Prototype:
virtual void DoDragReceive(Parameters:
DragReference inDragRef );
This method has the following parameter:
Return:
Purpose:
Send the data associated with a particular drag item. This method
gets called if you installed the optional DragSendDataProc for
this drop area, in which case you should override this function
to provide the requested data by calling SetDragItemFlavorData().
Access:
Prototype:
virtual void DoDragSendData( FlavorType inFlavor,Parameters:
ItemReference inItemRef,
DragReference inDragRef );
This method has the following parameters:
Return:
Purpose:
Indicates whether drag and drop is implemented on the running Mac OS system.
Access:
Prototype:
static Boolean DragAndDropIsPresent();Parameters:
Return:
Boolean of true if drag and drop is installed, else false.
Purpose:
Indicate whether a drop area can accept the specified drag. A drag is acceptable if all items in the drag are acceptable.
Access:
Prototype:
virtual Boolean DragIsAcceptable(Parameters:
DragReference inDragRef);
This method has the following parameter:
Return:
Boolean of true if the drop area can accept the drag, else false.
Purpose:
This method is called when a drag is entering a drop area. This call will be followed by a corresponding LeaveDropArea() call (when the drag moves out of the drop area or after the drag is received by this drop area). If the drop area can accept the drag and the drag is coming from outside the drop area, hilite the drop area.
Access:
Prototype:
virtual void EnterDropArea( DragReference inDragRef,Parameters:
Boolean inDragHasLeftSender);
This method has the following parameters:
Return:
Purpose:
Return the drop area in the specified window containing the specified point which can receive the drag.
Access:
Prototype:
static LDropArea* FindDropArea(Parameters:
WindowPtr inMacWindow,
Point inGlobalPt,
DragReference inDragRef);
This method has the following parameters:
Return:
Returns nil if no drop area meets the requirements, else returns a pointer
to the drop area.
Purpose:
Set up local coordinate system and clipping region for a drop area. The Drag Manager sets the port to the Window containing the drop rectangle. However, it doesn't know anything about the local coordinates and clipping region.
Access:
Prototype:
void FocusDropArea();Parameters:
Return:
Purpose:
Drag Manager callback for drawing the items during a drag.
Access:
Prototype:
static pascal OSErr HandleDragDrawing(Parameters:
DragRegionMessage inMessage,
RgnHandle inShowRgn,
Point inShowOrigin,
RgnHandle inHideRgn,
Point inHideOrigin,
void *inRefCon,
DragReference inDragRef);
This method has the following parameters:
Return:
Returns an OSErr value, which will be noErr if everything succeeds.
Purpose:
This is a Drag Manager callback for manipulating the mouse and modifier keys during a drag. This is basically an exception-handling wrapper for calling DoDragInput().
Access:
Prototype:
static pascal OSErr HandleDragInput(Parameters:
Point *ioMouse,
SInt16 *ioModifiers,
void *inRefCon,
DragReference inDragRef);
This method has the following parameters:
Return:
Returns an OSErr value, which will be noErr if everything succeeds.
Purpose:
This is a Drag Manager callback for receiving a successful drop.
Access:
Prototype:
static pascal OSErr HandleDragReceive(Parameters:
WindowPtr inMacWindow,
void* inRefCon,
DragReference inDragRef);
This method has the following parameters:
Return:
Returns an OSErr value, which will be noErr if everything succeeds.
Purpose:
This is a Drag Manager callback for sending the data for an item that is part of an accepted drag and drop.
Access:
Prototype:
static pascal OSErr HandleDragSendData(Parameters:
FlavorType inFlavor,
void *inRefCon,
ItemReference inItemRef,
DragReference inDragRef);
This method has the following parameters:
Return:
Returns an OSErr value, which will be noErr if everything succeeds.
Purpose:
This is the Drag Manager callback for tracking a drag in progress.
Access:
Prototype:
static pascal OSErr HandleDragTracking(Parameters:
DragTrackingMessage inMessage,
WindowPtr inMacWindow,
void* inRefCon,
DragReference inDragRef);
This method has the following parameters:
Return:
Returns an OSErr value, which will be noErr if everything succeeds.
Purpose:
Hilite a drop area to indicate that it can accept the current
drag. Any subclasses should override this function to create a
region representing the drop area, and call ShowDragHilite().
Access:
Prototype:
virtual void HiliteDropArea(Parameters:
DragReference inDragRef );
This method has the following parameter:
Return:
Purpose:
Track a Drag while it is inside a Window.
Access:
Prototype:
static void InTrackingWindow(Parameters:
WindowPtr inMacWindow,
DragReference inDragRef);
This method has the following parameters:
Return:
Purpose:
Track a Drag while it is inside a drop area. This method is called repeatedly while an acceptable drag is inside a drop area. Any subclasses may override to provide additional visual feedback during a drag, such as indicating an insertion point
Access:
Prototype:
virtual void InsideDropArea(Parameters:
DragReference inDragRef);
This method has the following parameter:
Return:
Purpose:
Install Tracking and Receive Handlers for the Drag Manager. We use a single Tracking handler and a single Receive handler for all drag and drop operations. With the Drag Manager, you can register handlers globally or for specific windows. With PowerPlant, we want to have separate handlers for each Pane that supports drag and drop. Therefore, this class maintains a list of all drag and drop Panes and dispatches calls to the proper Panes.
Access:
Prototype:
static void InstallHandlers();Parameters:
Return:
Purpose:
This method checks for each acceptable flavor, exiting immediatelyupon finding an acceptable flavor.
Access:
Prototype:
virtual Boolean ItemIsAcceptable(Parameters:
DragReference inDragRef,
ItemReference inItemRef );
This method has the following parameters:
Return:
Boolean returning true if the item is acceptable, false if it is not.
Purpose:
This method is called when a drag is leaving a drop area. This call will have been preceded by a corresponding EnterDropArea() call.
Access:
Prototype:
virtual void LeaveDropArea(DragReference inDragRef);Parameters:
This method has the following parameter:
Return:
Remarks:
Remove hiliting of the drop area if necessary.
Purpose:
This method takes a point and indicates whether the point lies within the drop area or not.
Access:
Prototype:
virtual Boolean PointInDropArea(Parameters:
Point inGlobalPt) = 0;
This method has the following parameter:
Return:
Boolean of true if the point is in the drop area, else false.
Remarks:
This method is a pure virtual method, and your subclass must implement it.
Purpose:
Process an item which has been dragged into a drop area. This
method gets called once for each item contained in a completed
drag. The item will have returned true from ItemIsAcceptable(). The drop area is focused upon entry and inItemBounds is specified in the local coordinates of the drop area. Override
this function if the drop area can accept dropped items. You may
want to call GetFlavorData() and GetFlavorDataSize() if there is information associated with the dragged Item.
Access:
Prototype:
virtual, void ReceiveDragItem(Parameters:
DragReference inDragRef,
DragAttributes inDragAttrs,
ItemReference inItemRef,
Rect& inItemBounds );
This method has the following parameters:
| The Rect in local coordinates. |
Return:
Purpose:
Remove a drop area from the list maintained by this class.
Access:
Prototype:
static void RemoveDropArea(Parameters:
LDropArea *inDropArea,
WindowPtr inMacWindow);
This method has the following parameters:
Return:
Purpose:
Unhilite a drop area when a drag leaves the area. Subclasses should
override this function if they override HiliteDropArea() to do something other than call ShowDragHilite().
Access:
Prototype:
virtual void UnhiliteDropArea(Parameters:
DragReference inDragRef);
This method has the following parameter:
Return:
Purpose:
This data member is the WindowPtr for the window containing the drop area.
Access:
Prototype:
WindowPtr mDragWindow;
Purpose:
This data member indicates whether the drop area can receive the drag.
Access:
Prototype:
Boolean mCanAcceptCurrentDrag;
Purpose:
This data member indicates whether the drop area is currently highlighted.
Access:
Prototype:
Boolean mIsHilited;
Purpose:
This data member stores the procedure pointer for the drag tracking procedure.
Access:
Prototype:
static DragTrackingHandlerUPP sDragTrackingProc;
Purpose:
This data member stores the procedure pointer for the drag receive procedure.
Access:
Prototype:
static DragReceiveHandlerUPP sDragReceiveProc;
Purpose:
This data member stores the drop area list.
Access:
Prototype:
static TArray<SDropAreaEntry> *sDropAreaList;
Purpose:
This data member stores the current drop area.
Access:
Prototype:
static LDropArea *sCurrentDropArea;
Purpose:
This data member indicates whether the drag has left the sender window.
Access:
Prototype:
static Boolean sDragHasLeftSender;