#include <sglfills.h>
Inheritance diagram for SGFillsDragTarget:
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 |
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 381 of file sglfills.h.
|
Constructor.
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 }
|
|
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)
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 }
|
|
Reimplemented from SGListDragTarget. Definition at line 383 of file sglfills.h. |