#include <sgdfonts.h>
Inheritance diagram for SGFontsDragTarget:
Public Member Functions | |
SGFontsDragTarget (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 Fonts 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 226 of file sgdfonts.h.
|
Constructor.
Definition at line 178 of file sgdfonts.cpp. 00179 : SGListDragTarget(TheDialog, TheGadget) 00180 { 00181 ERROR3IF(!TheDialog->IsKindOf(CC_RUNTIME_CLASS(FontsSGallery)), 00182 "You can only use SGFontsDragTargets with LibFontsSGallery dialogues!"); 00183 }
|
|
Event Handler for SuperGallery listitem drag events. Overrides the base class handler to enable it to sort out the node being dragged for Fonts drags. BOOL SGFontsDragTarget::ProcessEvent(DragEventType Event, DragInformation *pDragInfo, OilCoord *pMousePos, KeyPress* pKeyPress)
Reimplemented from SGListDragTarget. Definition at line 208 of file sgdfonts.cpp. 00210 { 00211 SGDisplayNode *DraggedNode = NULL; 00212 BOOL IsSimpleBitmapDrag = TRUE; 00213 00214 if (IS_A(pDragInfo, GalleryFontsDragInfo)) 00215 { 00216 // We must be dragging an Installed Font 00217 DraggedNode = ((GalleryFontsDragInfo *)pDragInfo)->GetDraggedFont(); 00218 TRACEUSER( "Richard", _T("We're Dragging an installed font\n")); 00219 IsSimpleBitmapDrag = FALSE; 00220 } 00221 else if (IS_A(pDragInfo, GalleryLibFontsDragInfo)) 00222 { 00223 // We must be dragging an Un-installed Font 00224 DraggedNode = ((GalleryLibFontsDragInfo *)pDragInfo)->GetDraggedFont(); 00225 TRACEUSER( "Richard", _T("We're Dragging a library font\n")); 00226 IsSimpleBitmapDrag = FALSE; 00227 } 00228 else 00229 return(FALSE); // We only accept font drags 00230 00231 if (DraggedNode != NULL) 00232 { 00233 switch(Event) 00234 { 00235 case DRAGEVENT_COMPLETED: 00236 HandleDragCompleted((SuperGallery *) TargetDialog, 00237 DraggedNode, pMousePos, IsSimpleBitmapDrag); 00238 return(TRUE); 00239 00240 00241 case DRAGEVENT_MOUSESTOPPED: 00242 case DRAGEVENT_MOUSEMOVED: 00243 case DRAGEVENT_MOUSEIDLE: 00244 { 00245 // Specialised cursor changing code 00246 00247 SuperGallery *ParentGallery = (SuperGallery *) TargetDialog; 00248 if (ParentGallery != NULL && pMousePos != NULL && DraggedNode != NULL) 00249 { 00250 // Convert the OilCoords into DocCoords 00251 DocCoord MousePos(pMousePos->x, pMousePos->y); 00252 SGDisplayNode *DestNode = ParentGallery->FindNodeUnderPointer(&MousePos); 00253 00254 if(DestNode != NULL) 00255 { 00256 SGDisplayNode *DestGroup = DestNode->GetParent(); 00257 SGDisplayNode *SourceGroup = DraggedNode->GetParent(); 00258 00259 if(DestGroup != NULL && SourceGroup != NULL) 00260 { 00261 // We're dragging within a group - that's ok 00262 if(SourceGroup == DestGroup) 00263 return(DetermineCursorShape(ParentGallery, DraggedNode, pMousePos)); 00264 00265 // We're dragging a library font onto the installed section - that's ok 00266 if(SourceGroup->IS_KIND_OF(SGLibGroup) && DestGroup->IS_KIND_OF(SGFontsGroup)) 00267 return(DetermineCursorShape(ParentGallery, DraggedNode, pMousePos)); 00268 } 00269 } 00270 } 00271 } 00272 00273 // If we can't drag a font item into this group, set the default cursor... 00274 CurrentCursorID = _R(IDC_DRAGGING_COLOUR); // No-can-drop cursor shape 00275 return TRUE; 00276 } 00277 } 00278 00279 // Otherwise, we aren't interested in the event, so we don't claim it 00280 return(FALSE); 00281 }
|
|
Reimplemented from SGListDragTarget. Definition at line 228 of file sgdfonts.h. |