[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

 

LDropArea



Description:

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:

 

LDropArea()  
~LDropArea()  
AddDropArea()  
DoDragDrawing()  
DoDragInput()  
DoDragReceive()  
DoDragSendData()  
DragAndDropIsPresent()  
DragIsAcceptable()  
EnterDropArea()  
FindDropArea()  
FocusDropArea()  
HandleDragDrawing()  
HandleDragInput()  
HandleDragReceive()  
HandleDragSendData()  
HandleDragTracking()  
HiliteDropArea()  
InTrackingWindow()  
InsideDropArea()  
InstallHandlers()  
ItemIsAcceptable()  
LeaveDropArea()  
PointInDropArea()  
ReceiveDragItem()  
RemoveDropArea()  
UnhiliteDropArea()  
 
 
 

Data Members:

The data members in this class are:

 

mDragWindow  
mCanAcceptCurrentDrag  
mIsHilited  
sDragTrackingProc  
sDragReceiveProc  
sDropAreaList  
sCurrentDropArea  
sDragHasLeftSender  

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:

(Feature Classes)

LDragTask.h

LDragTask.cp

See also:

LArray

LDragAndDrop

LDragTask

LDropArea()

Purpose:

The constructor creates an object from the passed-in parameters. It initializes drag and drop if needed.

Access:

Public

Prototype:

LDropArea ( WindowPtr inWindow );
Parameters:

This constructor has the following parameter:

 

WindowPtr  
inWindow  
The window in which to establish a drop area.  

~LDropArea()

Purpose:

The destructor destroys the object.

Access:

Virtual, Public

Prototype:

virtual ~LDropArea();

AddDropArea()

Purpose:

Add a drop area to the list maintained by this class.

Access:

Protected, Static

Prototype:

void AddDropArea( LDropArea *inDropArea,
WindowPtr inMacWindow );
Parameters:

This method has the following parameter:

 

LDropArea*  
inDropArea  
A pointer to the drop area object to add to the list.  
WindowPtr  
inMacWindow  
The window pointer for the drop area to be added.  

Return:

None

DoDragDrawing()

Purpose:

Draw the items for a drag in progress. This method gets called if you installed the optional DragDrawingProc for this drop area.

Access:

Virtual, Protected

Prototype:

virtual void DoDragDrawing( 
DragRegionMessage inMessage,
RgnHandle inShowRgn,
Point inShowOrigin,
RgnHandle inHideRgn,
Point inHideOrigin,
DragReference inDragRef );
Parameters:

This method has the following parameter:

 

DragRegionMessage  
inMessage  
The message passed to this object from the framework.  
RgnHandle  
inShowRgn  
The show region.  
Point  
inShowOrigin  
The origin point.  
RgnHandle  
inHideRgn  
The hide region.  
Point  
inHideOrigin  
The hide origin point.  
DragReference  
inDragRef  
The reference to the area.  

Return:

None

DoDragInput()

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:

Virtual, Protected

Prototype:

virtual void DoDragInput( Point ioMouse,
SInt16 ioModifiers,
DragReference inDragRef );
Parameters:

This method has the following parameter:

 

Point  
ioMouse  
The point to check against.  
SInt16  
ioModifiers  
The modifier keys, if any.  
DragReference  
inDragRef  
The reference to the area.  

Return:

None

DoDragReceive()

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:

Virtual, Protected

Prototype:

virtual void DoDragReceive( 
DragReference inDragRef );
Parameters:

This method has the following parameter:

 

DragReference  
inDragRef  
The reference to the area.  

Return:

None

DoDragSendData()

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:

Virtual, Protected

Prototype:

virtual void DoDragSendData( FlavorType inFlavor,
ItemReference inItemRef,
DragReference inDragRef );
Parameters:

This method has the following parameters:

 

FlavorType  
inFlavor  
This is the "flavor," or data type for the drag.  
ItemReference  
inItemRef  
A reference to the item that is in the drag.  
DragReference  
inDragRef  
The reference to the area.  

Return:

None

DragAndDropIsPresent()

Purpose:

Indicates whether drag and drop is implemented on the running Mac OS system.

Access:

Static, Public

Prototype:

static Boolean DragAndDropIsPresent();
Parameters:

None

Return:

Boolean of true if drag and drop is installed, else false.

DragIsAcceptable()

Purpose:

Indicate whether a drop area can accept the specified drag. A drag is acceptable if all items in the drag are acceptable.

Access:

Virtual, Protected

Prototype:

virtual Boolean DragIsAcceptable(
DragReference inDragRef);
Parameters:

This method has the following parameter:

 

DragReference  
inDragRef  
The reference to the area.  

Return:

Boolean of true if the drop area can accept the drag, else false.

EnterDropArea()

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:

Virtual, Protected

Prototype:

virtual void EnterDropArea( DragReference 
inDragRef,
Boolean inDragHasLeftSender);
Parameters:

This method has the following parameters:

 

DragReference  
inDragRef  
The reference to the area.  
Boolean  
inDragHasLeftSender  
 

Return:

None

FindDropArea()

Purpose:

Return the drop area in the specified window containing the specified point which can receive the drag.

Access:

Static, Protected

Prototype:

static LDropArea* FindDropArea( 
WindowPtr inMacWindow,
Point inGlobalPt,
DragReference inDragRef);
Parameters:

This method has the following parameters:

 

WindowPtr  
inMacWindow  
The window to search in.  
Point  
inGlobalPt  
The point (in global coordinates).  
DragReference  
inDragRef  
The reference to the area.  

Return:

Returns nil if no drop area meets the requirements, else returns a pointer to the drop area.

FocusDropArea()

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:

Virtual, Public

Prototype:

void FocusDropArea();
Parameters:

None

Return:

None

HandleDragDrawing()

Purpose:

Drag Manager callback for drawing the items during a drag.

Access:

Static, Protected

Prototype:

static pascal OSErr HandleDragDrawing(
DragRegionMessage inMessage,
RgnHandle inShowRgn,
Point inShowOrigin,
RgnHandle inHideRgn,
Point inHideOrigin,
void *inRefCon,
DragReference inDragRef);
Parameters:

This method has the following parameters:

 

DragRegionMessage  
inMessage  
The message passed to this method from the framework.  
RgnHandle  
inShowRgn  
The show region.  
Point  
inShowOrigin  
The point in the show region.  
RgnHandle  
inHideRgn  
The hide region.  
Point  
inHideOrigin  
The point in the hide region.  
void*  
inRefCon  
A pointer to the Mac OS refcon.  
DragReference  
inDragRef  
The reference to the area.  

Return:

Returns an OSErr value, which will be noErr if everything succeeds.

HandleDragInput()

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:

Static, Protected

Prototype:

static pascal OSErr HandleDragInput(
Point *ioMouse,
SInt16 *ioModifiers,
void *inRefCon,
DragReference inDragRef);
Parameters:

This method has the following parameters:

 

Point*  
ioMouse  
The pointer to a point structure.  
SInt16*  
ioModifiers  
The show region.  
void*  
inRefCon  
The point in the show region.  
DragReference  
inDragRef  
The reference to the area.  

Return:

Returns an OSErr value, which will be noErr if everything succeeds.

HandleDragReceive()

Purpose:

This is a Drag Manager callback for receiving a successful drop.

Access:

Static, Protected

Prototype:

static pascal OSErr HandleDragReceive(
WindowPtr inMacWindow,
void* inRefCon,
DragReference inDragRef);
Parameters:

This method has the following parameters:

 

WindowPtr  
inMacWindow  
The pointer to the window receiving the drag.  
void*  
inRefCon  
The Mac OS refcon pointer.  
DragReference  
inDragRef  
The reference to the area.  

Return:

Returns an OSErr value, which will be noErr if everything succeeds.

HandleDragSendData()

Purpose:

This is a Drag Manager callback for sending the data for an item that is part of an accepted drag and drop.

Access:

Static, Protected

Prototype:

static pascal OSErr HandleDragSendData(
FlavorType inFlavor,
void *inRefCon,
ItemReference inItemRef,
DragReference inDragRef);
Parameters:

This method has the following parameters:

 

FlavorType  
inFlavor  
The flavor type of the drag and drop (enumerated in Drag.h).  
void*  
inRefCon  
The Mac OS refcon pointer.  
ItemReference  
inItemRef  
The reference to the item that was drag and dropped.  
DragReference  
inDragRef  
The reference to the area.  

Return:

Returns an OSErr value, which will be noErr if everything succeeds.

HandleDragTracking()

Purpose:

This is the Drag Manager callback for tracking a drag in progress.

Access:

Static, Protected

Prototype:

static pascal OSErr HandleDragTracking(
DragTrackingMessage inMessage,
WindowPtr inMacWindow,
void* inRefCon,
DragReference inDragRef);
Parameters:

This method has the following parameters:

 

DragTrackingMessage  
inMessage  
The message that is passed to this method.  
WindowPtr  
inMacWindow  
The window pointer.  
void*  
inRefCon  
The Mac OS refcon pointer.  
DragReference  
inDragRef  
The reference to the area.  

Return:

Returns an OSErr value, which will be noErr if everything succeeds.

HiliteDropArea()

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:

Virtual, Protected

Prototype:

virtual void HiliteDropArea( 
DragReference inDragRef );
Parameters:

This method has the following parameter:

 

DragReference  
inDragRef  
The reference to the area.  

Return:

None

InTrackingWindow()

Purpose:

Track a Drag while it is inside a Window.

Access:

Static, Protected

Prototype:

static void InTrackingWindow(
WindowPtr inMacWindow,
DragReference inDragRef);
Parameters:

This method has the following parameters:

 

WindowPtr  
inMacWindow  
The window pointer.  
DragReference  
inDragRef  
The reference to the area.  

Return:

None

InsideDropArea()

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:

Virtual, Protected

Prototype:

virtual void InsideDropArea( 
DragReference inDragRef);
Parameters:

This method has the following parameter:

 

DragReference  
inDragRef  
The reference to the area.  

Return:

None

InstallHandlers()

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:

Static, Protected

Prototype:

static void InstallHandlers();
Parameters:

None

Return:

None

ItemIsAcceptable()

Purpose:

This method checks for each acceptable flavor, exiting immediatelyupon finding an acceptable flavor.

Access:

Virtual, Protected

Prototype:

virtual Boolean ItemIsAcceptable(
DragReference inDragRef,
ItemReference inItemRef );
Parameters:

This method has the following parameters:

 

DragReference  
inDragRef  
The reference to the area.  
ItemReference  
inItemRef  
The reference to the drag item.  

Return:

Boolean returning true if the item is acceptable, false if it is not.

LeaveDropArea()

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:

Virtual, Protected

Prototype:

virtual void LeaveDropArea(DragReference 
inDragRef);
Parameters:

This method has the following parameter:

 

DragReference  
inDragRef  
The reference to the area.  

Return:

None

Remarks:

Remove hiliting of the drop area if necessary.

PointInDropArea()

Purpose:

This method takes a point and indicates whether the point lies within the drop area or not.

Access:

Pure Virtual, Public

Prototype:

virtual Boolean PointInDropArea(
Point inGlobalPt) = 0;
Parameters:

This method has the following parameter:

 

Point  
inGlobalPt  
The point to check.  

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.

ReceiveDragItem()

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:

Virtual, Protected

Prototype:

virtual, void ReceiveDragItem(
DragReference inDragRef,
DragAttributes inDragAttrs,
ItemReference inItemRef,
Rect& inItemBounds );
Parameters:

This method has the following parameters:

 

DragReference  
inDragRef  
The reference to the drag.  
DragAttributes  
inDragAttrs  
The drag attributes.  
ItemReference  
inItemRef  
The reference to the item that was drag and dropped.  
Rect&  
inItemBounds  
The Rect in local coordinates.

Return:

None

RemoveDropArea()

Purpose:

Remove a drop area from the list maintained by this class.

Access:

Static, Protected

Prototype:

static void RemoveDropArea(
LDropArea *inDropArea,
WindowPtr inMacWindow);
Parameters:

This method has the following parameters:

 

LDropArea*  
inDropArea  
The window pointer.  
WindowPtr  
inMacWindow  
The reference to the area.  

Return:

None

UnhiliteDropArea()

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:

Virtual, Protected

Prototype:

virtual void UnhiliteDropArea(
DragReference inDragRef);
Parameters:

This method has the following parameter:

 

DragReference  
inDragRef  
The reference to the area.  

Return:

None

mDragWindow

Purpose:

This data member is the WindowPtr for the window containing the drop area.

Access:

Protected

Prototype:

WindowPtr mDragWindow;

mCanAcceptCurrentDrag

Purpose:

This data member indicates whether the drop area can receive the drag.

Access:

Protected

Prototype:

Boolean mCanAcceptCurrentDrag;

mIsHilited

Purpose:

This data member indicates whether the drop area is currently highlighted.

Access:

Protected

Prototype:

Boolean mIsHilited;

sDragTrackingProc

Purpose:

This data member stores the procedure pointer for the drag tracking procedure.

Access:

Static

Prototype:

static DragTrackingHandlerUPP sDragTrackingProc;

sDragReceiveProc

Purpose:

This data member stores the procedure pointer for the drag receive procedure.

Access:

Static

Prototype:

static DragReceiveHandlerUPP sDragReceiveProc;

sDropAreaList

Purpose:

This data member stores the drop area list.

Access:

Static

Prototype:

static TArray<SDropAreaEntry> *sDropAreaList;

sCurrentDropArea

Purpose:

This data member stores the current drop area.

Access:

Static

Prototype:

static LDropArea *sCurrentDropArea;

sDragHasLeftSender

Purpose:

This data member indicates whether the drag has left the sender window.

Access:

Static

Prototype:

static Boolean sDragHasLeftSender;

 


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: July 21, 2000