SGFontsDragTarget 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 <sgdfonts.h>

Inheritance diagram for SGFontsDragTarget:

SGListDragTarget KernelDragTarget DragTarget ListItem CCObject SimpleCCObject List of all members.

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

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 226 of file sgdfonts.h.


Constructor & Destructor Documentation

SGFontsDragTarget::SGFontsDragTarget 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 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 }


Member Function Documentation

BOOL SGFontsDragTarget::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 Fonts drags.

BOOL SGFontsDragTarget::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 FontsDragInformation 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 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 }


Friends And Related Function Documentation

friend class DragManagerOp [friend]
 

Reimplemented from SGListDragTarget.

Definition at line 228 of file sgdfonts.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