SGClipartDragTarget Class Reference

An instantiation of this class is created by each entity which wishes to provide a 'destination' to which the mouse can go to complete a drag. More...

#include <sglcart.h>

Inheritance diagram for SGClipartDragTarget:

SGListDragTarget KernelDragTarget DragTarget ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 SGClipartDragTarget (DialogOp *TheDialog, CGadgetID TheGadget=NULL)
 Constructor.

Protected Member Functions

virtual BOOL ProcessEvent (DragEventType Event, DragInformation *pDragInfo, OilCoord *pMousePos, KeyPress *pKeyPress)
 Event Handler for SuperGallery listitem drag events. Overrides the base class handler to enable it to sort out the node being dragged for Clipart drags.

Friends

class DragManagerOp

Detailed Description

An instantiation of this class is created by each entity which wishes to provide a 'destination' to which the mouse can go to complete a drag.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/4/95
This particular target is used for handling drags of BitmapSGalllery items within their displayed list. It automatically handles drags with draginfo derived from BitmapDragInformation.

Notes: Drag targets are destructed automatically when a drag finishes by the drag manager with which they were registered.

To remove a drag target at any time, destruct it - it automatically deregisters and cleans up.

See also:
DragManagerOp::StartDrag; DragInformation; DragTarget; SGBitmapDragTarget::ProcessEvent
Documentation: Docs.doc; Docs.doc

Definition at line 468 of file sglcart.h.


Constructor & Destructor Documentation

SGClipartDragTarget::SGClipartDragTarget DialogOp TheDialog,
CGadgetID  TheGadget = NULL
 

Constructor.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/3/95
Parameters:
TheDialog - The kernel dialog in which the target exists [INPUTS] TheGadget - The gadget within that dialogue which is the target

Definition at line 2776 of file sglcart.cpp.

02777                     : SGListDragTarget(TheDialog, TheGadget)
02778 {
02779     ERROR3IF(!TheDialog->IsKindOf(CC_RUNTIME_CLASS(LibClipartSGallery)),
02780             "You can only use SGClipartDragTargets with LibClipartSGallery dialogues!");
02781 }


Member Function Documentation

BOOL SGClipartDragTarget::ProcessEvent DragEventType  Event,
DragInformation pDragInfo,
OilCoord pMousePos,
KeyPress pKeyPress
[protected, virtual]
 

Event Handler for SuperGallery listitem drag events. Overrides the base class handler to enable it to sort out the node being dragged for Clipart drags.

BOOL SGClipartDragTarget::ProcessEvent(DragEventType Event, DragInformation *pDragInfo, OilCoord *pMousePos, KeyPress* pKeyPress)

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/3/95
Parameters:
Event - Indicates what has happened [INPUTS] pDragInfo - points to drag information describing this drag. This should be a ClipartDragInformation or derivation thereof pMousePos - points to information on the current mouse position, in OIL coords pKeyPress - NULL, or if for a keypress event, keypress information
Returns:
TRUE to claim the event, FALSE to let it through to other targets

Reimplemented from SGListDragTarget.

Definition at line 2806 of file sglcart.cpp.

02808 {
02809     TRACEUSER( "Matt", _T("SGClipartDragTarget::ProcessEvent called\n"));
02810     if (!pDragInfo->IsKindOf(CC_RUNTIME_CLASS(BitmapDragInformation)))
02811         return(FALSE);
02812 
02813     SGDisplayNode *DraggedNode = NULL;
02814     BOOL IsSimpleBitmapDrag = TRUE;
02815 
02816     if (IS_A(pDragInfo, GalleryClipartDragInfo))
02817     {
02818         DraggedNode = ((GalleryClipartDragInfo *)pDragInfo)->GetDraggedClipart();
02819         IsSimpleBitmapDrag = FALSE;
02820     }
02821 
02822     if (DraggedNode != NULL)
02823     {
02824         switch(Event)
02825         {
02826             case DRAGEVENT_COMPLETED:
02827                 HandleDragCompleted((SuperGallery *) TargetDialog,
02828                                     DraggedNode, pMousePos, IsSimpleBitmapDrag);
02829                 return(TRUE);
02830 
02831 
02832             case DRAGEVENT_MOUSESTOPPED:
02833             case DRAGEVENT_MOUSEMOVED:
02834             case DRAGEVENT_MOUSEIDLE:
02835                 {
02836                     // Specialised cursor changing code - can't drag between groups...
02837 
02838                     SuperGallery *ParentGallery = (SuperGallery *) TargetDialog;
02839                     if (ParentGallery != NULL && pMousePos != NULL && DraggedNode != NULL)
02840                     {
02841                         // Convert the OilCoords into DocCoords
02842                         DocCoord MousePos(pMousePos->x, pMousePos->y);
02843                         SGDisplayNode *DestNode = ParentGallery->FindNodeUnderPointer(&MousePos);
02844 
02845                         if(DestNode != NULL)
02846                         {
02847                             SGDisplayNode *DestGroup = DestNode->GetParent();
02848                             SGDisplayNode *SourceGroup = DraggedNode->GetParent();
02849 
02850                             if(DestGroup != NULL && SourceGroup != NULL)
02851                             {   
02852                                 // We're dragging within a group - that's ok
02853                                 if(SourceGroup == DestGroup)
02854                                     return(DetermineCursorShape(ParentGallery, DraggedNode, pMousePos));
02855                             }
02856                         }       
02857                     }
02858                 }
02859 
02860                 // If we're trying to drag to unimplemented areas (between groups), set the no-can-do cursor
02861                 CurrentCursorID = _R(IDC_DRAGGING_COLOUR);      // No-can-drop cursor shape
02862                 return TRUE;
02863         }
02864     }
02865 
02866     // Otherwise, we aren't interested in the event, so we don't claim it
02867     return(FALSE);
02868 }


Friends And Related Function Documentation

friend class DragManagerOp [friend]
 

Reimplemented from SGListDragTarget.

Definition at line 470 of file sglcart.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 04:00:56 2007 for Camelot by  doxygen 1.4.4