SGFillsDragTarget 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 <sglfills.h>

Inheritance diagram for SGFillsDragTarget:

SGListDragTarget KernelDragTarget DragTarget ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 SGFillsDragTarget (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 Fills 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 381 of file sglfills.h.


Constructor & Destructor Documentation

SGFillsDragTarget::SGFillsDragTarget 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 1882 of file sglfills.cpp.

01883                     : SGListDragTarget(TheDialog, TheGadget)
01884 {
01885     ERROR3IF(!TheDialog->IsKindOf(CC_RUNTIME_CLASS(LibFillsSGallery)),
01886             "You can only use SGFillsDragTargets with LibFillsSGallery dialogues!");
01887 }


Member Function Documentation

BOOL SGFillsDragTarget::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 Fills drags.

BOOL SGFillsDragTarget::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 FillsDragInformation 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 1912 of file sglfills.cpp.

01914 {
01915     if (!pDragInfo->IsKindOf(CC_RUNTIME_CLASS(BitmapDragInformation)))
01916         return(FALSE);
01917 
01918     SGDisplayNode *DraggedNode = NULL;
01919     BOOL IsSimpleBitmapDrag = TRUE;
01920 
01921     // This target only knows about Fill gallery items.
01922     if (IS_A(pDragInfo, GalleryFillsDragInfo))
01923     {
01924         DraggedNode = ((GalleryFillsDragInfo *)pDragInfo)->GetDraggedFill();
01925         IsSimpleBitmapDrag = FALSE;
01926     }
01927 
01928     if (DraggedNode != NULL)
01929     {
01930         switch(Event)
01931         {
01932             case DRAGEVENT_COMPLETED:
01933                 // If the DragInfo didn't know what to do, then call our baseclass
01934                 HandleDragCompleted((SuperGallery *) TargetDialog,
01935                                     DraggedNode, pMousePos, IsSimpleBitmapDrag);
01936                 return(TRUE);
01937 
01938 
01939             case DRAGEVENT_MOUSESTOPPED:
01940             case DRAGEVENT_MOUSEMOVED:
01941             case DRAGEVENT_MOUSEIDLE:
01942                 {
01943                     // Specialised cursor changing code - can't drag between groups...
01944 
01945                     SuperGallery *ParentGallery = (SuperGallery *) TargetDialog;
01946                     if (ParentGallery != NULL && pMousePos != NULL && DraggedNode != NULL)
01947                     {
01948                         // Convert the OilCoords into DocCoords
01949                         DocCoord MousePos(pMousePos->x, pMousePos->y);
01950                         SGDisplayNode *DestNode = ParentGallery->FindNodeUnderPointer(&MousePos);
01951 
01952                         if(DestNode != NULL)
01953                         {
01954                             SGDisplayNode *DestGroup = DestNode->GetParent();
01955                             SGDisplayNode *SourceGroup = DraggedNode->GetParent();
01956 
01957                             if(DestGroup != NULL && SourceGroup != NULL)
01958                             {   
01959                                 // We're dragging within a group - that's ok
01960                                 if(SourceGroup == DestGroup)
01961                                     return(DetermineCursorShape(ParentGallery, DraggedNode, pMousePos));
01962                             }
01963                         }       
01964                     }
01965                 }
01966 
01967                 // If we're trying to drag to unimplemented areas (between groups), set the no-can-do cursor
01968                 CurrentCursorID = _R(IDC_DRAGGING_COLOUR);      // No-can-drop cursor shape
01969                 return TRUE;
01970         }
01971     }
01972 
01973     // Otherwise, we aren't interested in the event, so we don't claim it
01974     return(FALSE);
01975 }


Friends And Related Function Documentation

friend class DragManagerOp [friend]
 

Reimplemented from SGListDragTarget.

Definition at line 383 of file sglfills.h.


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