Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CP_M_DragTarget Class Reference

Class used in drag and drop to provide a drag target.

Inheritance diagram for CP_M_DragTarget:

CP_View_Imp CP_View CP_BackgroundView CP_FocusBorder CP_LittleArrowsEditBuddy CP_OpenGLView CP_PlatformControl CP_PrintView CP_QT_MovieView CP_ScrollableView CP_Scroller CP_SelectColorButton CP_Splitter CP_TextView CP_Toolbar CP_Window_Imp List of all members.

Drag Target

virtual void OnDragEnter (CP_DragDrop &inDragDrop, bool inDragHasLeftSender)
virtual void OnDragLeave (CP_DragDrop &inDragDrop)
virtual void OnDragTrack (CP_DragDrop &inDragDrop)
static CP_M_DragTargetFindDragTarget (OSWindow inOSWindow, CP_Point &inMouseLocation, CP_DragDrop &inDragDrop)

Public Member Functions

virtual void HandleDragReceive (CP_DragDrop &)
Constructor / Destructor
 CP_M_DragTarget ()
 Constructor.
virtual ~CP_M_DragTarget () throw ()
 Destructor.

Protected Member Functions

virtual bool OnCanAcceptDrag (UInt32 inItem, CP_DragDrop &inDragDrop)=0
virtual CP_Region GetDropRegion ()=0
virtual bool PtInDropArea (CP_Point &inGlobalPoint)

Protected Attributes

CP_WindowfWindow
bool fDropAreaIsHilited
bool fCanAcceptCurrentDrag

Static Protected Attributes

static CP_DragTarget_ListfsDragTargetList = NULL
static CP_M_DragTargetfsCurrentDragTarget = NULL
static bool fsDragHasLeftSender = false

Constructor & Destructor Documentation

CP_M_DragTarget::CP_M_DragTarget  ) 
 

Constructor.

Exceptions:
none 

CP_M_DragTarget::~CP_M_DragTarget  )  throw () [virtual]
 

Destructor.

Exceptions:
none 


Member Function Documentation

bool CP_M_DragTarget::CanAcceptDrag CP_DragDrop inDragDrop  ) 
 

Called when the user tries to drop an object on this drag target. For each item inn the drag and drop, OnAcceptDrag will be called, which is the method you should override to determine if the object can be dropped onto this target.

If any of the items are not accepted by the object, then false is returned.

Parameters:
inDragDrop The CP_DragDrop object that is performing the drag and drop.
Exceptions:
none 
Returns:
bool Returns true if all of the items in the drag are acceptable.

void CP_M_DragTarget::HiliteDropArea CP_DragDrop inDragDrop  )  [virtual]
 

Called when the drag enters a new drop area. This is used to show the MacOS default drag hiliting.

Parameters:
inDragDrop The CP_DragDrop object that is performing the drag and drop.
Exceptions:
none 
Returns:
void

void CP_M_DragTarget::UnhiliteDropArea CP_DragDrop inDragDrop  )  [virtual]
 

Called when the drag leaves a drop area. This is used to remove the MacOS default drag hiliting.

Parameters:
inDragDrop The CP_DragDrop object that is performing the drag and drop.
Exceptions:
none 
Returns:
void

void CP_M_DragTarget::AddDragTarget CP_M_DragTarget inDragTarget,
CP_Window inWindow
 

Adds the passed in CP_M_DragTarget to the global list of drag targets that this object maintains. This is the list of objects that get checked during a drag and drop operation to see if the object can receive the dropped object when the mouse if over the target object.

Parameters:
inDragTarget The object that can be the receipient of a drag and drop operation.
inWindow The window that contains the drag target.
Exceptions:
none 

void CP_M_DragTarget::RemoveDragTarget CP_M_DragTarget inDragTarget,
CP_Window inWindow
 

Removes a previously added CP_M_DragTarget object. This is called for you automatically when aa CP_M_DragTarget object is destroyed. However you can call this at other times, if you want to remove an object as a postential drop target for drag and drops.

Parameters:
inDragTarget The object that is going to be removed.
inWindow The window that contains the drag target.
Exceptions:
none 

virtual void CP_M_DragTarget::HandleDragReceive CP_DragDrop  )  [virtual]
 

Reimplemented in CP_View_Imp.

pascal::OSErr CP_M_DragTarget::HandleDragTrackingCallback DragTrackingMessage  inMessage,
WindowPtr  inOSWindow,
void *  inRefCon,
DragReference  inDragRef
[static, protected]
 

Callback to the MacOS Drag Manager that is called during a drag and drop tracking operation.

Parameters:
inMessage The message or reason that this callback was called.
inOSWindow The MacOS window that the drag is ocurring in.
inRefCon Not used.
inDragRef The Drag Manager DragReference for this drag and drop.
Exceptions:
none 
Returns:
OSErr The result of this operation.

pascal OSErr CP_M_DragTarget::HandleDragReceiveCallback WindowPtr  inOSWindow,
void *  inRefCon,
DragReference  inDragRef
[static, protected]
 

Callback to the MacOS Drag Manager when the user has dropped an object over a drag target.

Parameters:
inOSWindow The MacOS window that the drop occured over.
inRefCon Not used.
inDragRef The Drag Manager DragReference for this drag and drop.
Exceptions:
none 
Returns:
OSErr The result of this operation.

CP_M_DragTarget * CP_M_DragTarget::FindDragTarget OSWindow  inOSWindow,
CP_Point inMouseLocation,
CP_DragDrop inDragDrop
[static, protected]
 

Finds and returns the CP_M_DragTarget that is in the passed in OSWindow at the passed in mouse location. The mouse location is in global coordinates.

If no target was found at the passed in location, then NULL is returned.

Parameters:
inOSWindow The MacOS window that the mouse is over.
inMouseLocation Global location of the mouse.
inDragDrop The CP_DragDrop object that is performing the drag and drop.
Exceptions:
none 
Returns:
CP_M_DragTarget * The object that was registered to handle a drag and drop at the passed in mouse location. NULL is returned if no target object was found.

void CP_M_DragTarget::OnDragEnter CP_DragDrop inDragDrop,
bool  inDragHasLeftSender
[protected, virtual]
 

Called when the user has entered a registered drag target object.

Parameters:
inDragDrop The CP_DragDrop object that is performing the drag and drop.
inDragHasLeftSender Flag to indicate if the drag operation has left the sending object, and is now in another object.
Exceptions:
none 
Returns:
void

void CP_M_DragTarget::OnDragLeave CP_DragDrop inDragDrop  )  [protected, virtual]
 

Called when the user is has left the current drag target object.

Parameters:
inDragDrop The CP_DragDrop object that is performing the drag and drop.
Exceptions:
none 
Returns:
void

void CP_M_DragTarget::OnDragTrack CP_DragDrop inDragDrop  )  [protected, virtual]
 

Called when the user is tracking or moving the mouse during a drag and drop operationn.

Parameters:
inDragDrop The CP_DragDrop object that is performing the drag and drop.
Exceptions:
none 
Returns:
void

virtual bool CP_M_DragTarget::OnCanAcceptDrag UInt32  inItem,
CP_DragDrop inDragDrop
[protected, pure virtual]
 

virtual CP_Region CP_M_DragTarget::GetDropRegion  )  [protected, pure virtual]
 

Implemented in CP_View_Imp.

bool CP_M_DragTarget::PtInDropArea CP_Point inGlobalPoint  )  [protected, virtual]
 

Returns true if the passed in global point is over this drag target.

Parameters:
inGlobalPoint The location of the mouse in global coordinates to test against. The default implmentation gets the drop region for the target, and compares the location to the drop region.
Exceptions:
none 
Returns:
bool Returns true if the passed in point is over the drop region for this drag target.

void CP_M_DragTarget::HandleTrackInWindow WindowPtr  inOSWindow,
CP_DragDrop inDragDrop
[static, protected]
 

Called when the user is dragging an object around in a window. This is called from the MacOS Drag Manager callback.

Parameters:
inOSWindow The MacOS window that the user is dragging an object over.
inDragDrop The CP_DragDrop object that is performing the drag and drop.
Exceptions:
none 
Returns:
void


Member Data Documentation

CPLAT_Begin_Namespace_CPLAT CP_DragTarget_List * CP_M_DragTarget::fsDragTargetList = NULL [static, protected]
 

CP_M_DragTarget * CP_M_DragTarget::fsCurrentDragTarget = NULL [static, protected]
 

bool CP_M_DragTarget::fsDragHasLeftSender = false [static, protected]
 

CP_Window* CP_M_DragTarget::fWindow [protected]
 

bool CP_M_DragTarget::fDropAreaIsHilited [protected]
 

bool CP_M_DragTarget::fCanAcceptCurrentDrag [protected]
 


The documentation for this class was generated from the following files:
Generated on Tue Sep 20 20:21:52 2005 for CPLAT_MacOS by  doxygen 1.4.0