#include <sglcart.h>
Inheritance diagram for SGClipartDragTarget:
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 |
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.
Definition at line 468 of file sglcart.h.
|
Constructor.
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 }
|
|
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)
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 }
|
|
Reimplemented from SGListDragTarget. |