ColEditorDragTarget Class Reference

Handles dragging of colours into the colour editor window. Multiple instances of this class are created to handle the different areas of the colour editor (which one they are working on is determined from the gadget ID for which the target is created). More...

#include <coldlog.h>

Inheritance diagram for ColEditorDragTarget:

KernelDragTarget DragTarget ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 ColEditorDragTarget (DialogOp *TheDialog, CGadgetID TheGadget=NULL)
 Constructs and registers this drag target with the current drag manager.
virtual UINT32 GetCursorID ()
 Base Method to set cursor over this target.
virtual BOOL GetStatusLineText (String_256 *TheText)
 provide status line text for this target

Protected Member Functions

virtual BOOL ProcessEvent (DragEventType Event, DragInformation *pDragInfo, OilCoord *pMousePos, KeyPress *pKeyPress)
 Event Handler for dragging colours over the colour editor.
BOOL CanDropHere (DragInformation *pDragInfo)
 To determine if we should accept the given drag on this target.

Friends

class DragManagerOp

Detailed Description

Handles dragging of colours into the colour editor window. Multiple instances of this class are created to handle the different areas of the colour editor (which one they are working on is determined from the gadget ID for which the target is created).

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/3/95
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
Documentation: Docs.doc

Definition at line 595 of file coldlog.h.


Constructor & Destructor Documentation

ColEditorDragTarget::ColEditorDragTarget DialogOp TheDialog,
CGadgetID  TheGadget = NULL
 

Constructs and registers this drag target with the current drag manager.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/3/95
Parameters:
TheDilaog - The window for which this target is active [INPUTS] ClientArea - NULL, or the gadget ID of the area in the window to target

Definition at line 10823 of file coldlog.cpp.

10824                     : KernelDragTarget(TheDialog, TheGadget)
10825 {
10826     
10827 }


Member Function Documentation

BOOL ColEditorDragTarget::CanDropHere DragInformation pDragInfo  )  [protected]
 

To determine if we should accept the given drag on this target.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/3/96
Parameters:
pDragInfo - info on the drag (it's safe if this is NULL) [INPUTS]
Returns:
TRUE if we'll accept this dragged thing dropped on us

Definition at line 10990 of file coldlog.cpp.

10991 {
10992     if (pDragInfo != NULL && pDragInfo->IsKindOf(CC_RUNTIME_CLASS(ColourDragInformation)))
10993     {
10994         ColourDragInformation *CDInfo = (ColourDragInformation *) pDragInfo;
10995 
10996         // Library colours can always be edited, as they're copied into the document first
10997         if (CDInfo->IsLibraryColour())
10998             return(TRUE);
10999 
11000         // Get the dragged colour and the current colour list
11001         IndexedColour *Col = CDInfo->GetInitiallyDraggedColour();
11002 
11003         if (Col != NULL)    // If it's not "no colour", see if we're happy to edit it
11004         {
11005             ColourList *ColList = NULL;
11006             if (CDInfo->GetParentDoc() != NULL)
11007                 ColList = CDInfo->GetParentDoc()->GetIndexedColours();
11008 
11009             return(ColourEditDlg::CanYouEditThis(ColList, Col));
11010         }   
11011     }
11012 
11013     return(FALSE);
11014 }

UINT32 ColEditorDragTarget::GetCursorID  )  [virtual]
 

Base Method to set cursor over this target.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/1/95

Reimplemented from DragTarget.

Definition at line 10936 of file coldlog.cpp.

10937 {
10938     if (CanDropHere(DragManagerOp::GetCurrentDragInfo()))
10939         return _R(IDC_CANDROP_EDITBUTTON);
10940 
10941     return 0;
10942 }

BOOL ColEditorDragTarget::GetStatusLineText String_256 TheText  )  [virtual]
 

provide status line text for this target

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/3/95
Returns:
TRUE if TheText has been filled in with a valid help string

Reimplemented from DragTarget.

Definition at line 10959 of file coldlog.cpp.

10960 {
10961     ERROR2IF(TheText==NULL,FALSE,"NULL string in GetStatusLineText()");
10962 
10963     if (CanDropHere(DragManagerOp::GetCurrentDragInfo()))
10964     {
10965         String_256 DragString(_R(IDS_K_COLDLOG_DROPTOEDIT));
10966         *TheText = DragString;
10967         return TRUE;
10968     }
10969 
10970     return FALSE;
10971 }

BOOL ColEditorDragTarget::ProcessEvent DragEventType  Event,
DragInformation pDragInfo,
OilCoord pMousePos,
KeyPress pKeyPress
[protected, virtual]
 

Event Handler for dragging colours over the colour editor.

Parameters:
Event - The drag event to be processed [INPUTS] pDragInfo - Information describing the current drag pMousePos - The current mouse pos, in client coords pKeyPress - NULL, or keypress event info
Returns:
TRUE to claim the event (in which case it will not be passed on)

Reimplemented from KernelDragTarget.

Definition at line 10850 of file coldlog.cpp.

10853 {
10854     // Not a colour drag? That is kindof unexpected, but lets exit before
10855     // we embarrass ourselves
10856     if (pDragInfo == NULL || !pDragInfo->IsKindOf(CC_RUNTIME_CLASS(ColourDragInformation)))
10857         return(FALSE);
10858 
10859     ColourDragInformation *ColDragInfo = (ColourDragInformation *) pDragInfo;
10860 
10861     BOOL IsLibColour = ColDragInfo->IsLibraryColour();
10862 
10863     IndexedColour *Col = ColDragInfo->GetInitiallyDraggedColour();
10864     if (!IsLibColour && Col == NULL)                // Don't allow dropping of "No colour"
10865         return(FALSE);
10866 
10867     switch(Event)
10868     {
10869         case DRAGEVENT_COMPLETED:
10870             if (ColourEditDlg::TheEditor != NULL && CanDropHere(pDragInfo))
10871             {
10872                 Document *ParentDoc = NULL;
10873                 if (!IsLibColour)
10874                     ParentDoc = ColDragInfo->GetParentDoc();
10875 
10876                 if (ParentDoc == NULL)
10877                     ParentDoc = Document::GetSelected();
10878 
10879                 if (ParentDoc != NULL)
10880                 {
10881                     ColourList *ColList = ParentDoc->GetIndexedColours();
10882 
10883                     if (IsLibColour)
10884                     {
10885                         Col = NULL;     // Just to be on the safe side
10886 
10887                         // We must copy the library colour into the document, but first check with
10888                         // the user that this is what they intended.
10889                         // WEBSTER - markn 30/1/97
10890                         // Don't ask in webster, just copy it over
10891                         #ifndef WEBSTER
10892                         if (InformError(_R(IDE_CANTEDITLIBCOLOUR), _R(IDS_COPYLIBCOLOUR), _R(IDS_CANCEL)) == 1)
10893                             Col = ColDragInfo->GetColourForDocument(ParentDoc);
10894                         #else
10895                             Col = ColDragInfo->GetColourForDocument(ParentDoc);
10896                         #endif // WEBSTER
10897                     }
10898 
10899                     if (Col != NULL && ColourEditDlg::CanYouEditThis(ColList, Col))
10900                         ColourEditDlg::InvokeDialog(ColList, Col);
10901                 }
10902 
10903                 return(TRUE);
10904             }
10905             break;
10906 
10907 
10908         case DRAGEVENT_MOUSESTOPPED:
10909         case DRAGEVENT_MOUSEMOVED:
10910         case DRAGEVENT_MOUSEIDLE:
10911             // Return TRUE to claim the mouse while over our target area, so that
10912             // our cursor shape is used
10913             return(TRUE);
10914 
10915         default:
10916             break;
10917     }
10918 
10919     // Allow unknown/unwanted events to pass on to other targets
10920     return(FALSE);
10921 }


Friends And Related Function Documentation

friend class DragManagerOp [friend]
 

Reimplemented from KernelDragTarget.

Definition at line 597 of file coldlog.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:52:46 2007 for Camelot by  doxygen 1.4.4