EditButtonDragTarget 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. WinoilDragTargets are used as a base class from which to derive drag targets for WINOIL entities (an optional wxWindow*). More...

#include <ccolbar.h>

Inheritance diagram for EditButtonDragTarget:

OilDragTarget DragTarget ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 EditButtonDragTarget (wxWindow *TheWindow, wxRect *ClientArea=NULL)
virtual UINT32 GetCursorID ()
 Set cursor over this target.
virtual BOOL GetStatusLineText (String_256 *TheText)
 provide status line text for this target

Protected Member Functions

BOOL ProcessEvent (DragEventType Event, DragInformation *pDragInfo, wxPoint *pMousePos, KeyPress *pKeyPress)
 Event Handler for Edit Drag.
BOOL CanDropHere (DragInformation *pDragInfo)
 Internal helper function.

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. WinoilDragTargets are used as a base class from which to derive drag targets for WINOIL entities (an optional wxWindow*).

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>.
Date:
2/1/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 136 of file ccolbar.h.


Constructor & Destructor Documentation

EditButtonDragTarget::EditButtonDragTarget wxWindow *  TheWindow,
wxRect *  ClientArea = NULL
 

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/1/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 355 of file ccolbar.cpp.

00356     : OilDragTarget(TheWindow, ClientArea)
00357 {
00358 //  TRACEUSER("Gerry", _T("EditButtonDragTarget created")); 
00359 }


Member Function Documentation

BOOL EditButtonDragTarget::CanDropHere DragInformation pDragInfo  )  [protected]
 

Internal helper function.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/3/96
Returns:
Whether this is something that can be dropped on the edit button

Definition at line 511 of file ccolbar.cpp.

00512 {
00513 //  TRACEUSER("Gerry", _T("EditButtonDragTarget::CanDropHere"));
00514 
00515     if (Document::GetSelected() == NULL)        // No selected docuement? can't edit anything then
00516         return(FALSE);
00517 
00518     if (pDragInfo != NULL && pDragInfo->IsKindOf(CC_RUNTIME_CLASS(ColourDragInformation)))
00519     {
00520         ColourDragInformation *CDInfo = (ColourDragInformation *) pDragInfo;
00521 
00522         // We always allow drops of library colours onto us
00523         if (CDInfo->IsLibraryColour())
00524             return(TRUE);
00525 
00526         // Get the dragged colour and the current colour list
00527         IndexedColour *Col  = CDInfo->GetInitiallyDraggedColour();
00528 
00529         if (Col != NULL)    // NULL means "no colour" or a library colour, which can't be edited
00530         {
00531             ColourList *ColList = NULL;
00532             if (CDInfo->GetParentDoc() != NULL)
00533                 ColList = CDInfo->GetParentDoc()->GetIndexedColours();
00534 
00535             return(ColourEditDlg::CanYouEditThis(ColList, Col));
00536         }
00537     }
00538 
00539     return(FALSE);
00540 }

UINT32 EditButtonDragTarget::GetCursorID void   )  [virtual]
 

Set cursor over this target.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com> (Rewritten, Jason)
Date:
10/1/95 (25/3/96)

Reimplemented from DragTarget.

Definition at line 454 of file ccolbar.cpp.

00455 {
00456 //  TRACEUSER("Gerry", _T("EditButtonDragTarget::GetCursorID"));
00457 
00458     DragInformation *pDragInfo = DragManagerOp::GetCurrentDragInfo();
00459     if (CanDropHere(pDragInfo))
00460         return _R(IDC_CANDROP_EDITBUTTON);
00461 
00462     return 0;
00463 }

BOOL EditButtonDragTarget::GetStatusLineText String_256 TheText  )  [virtual]
 

provide status line text for this target

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com> (Rewritten, Jason)
Date:
15/1/95 (25/3/96)
Returns:
Whether String is valid

Reimplemented from DragTarget.

Definition at line 478 of file ccolbar.cpp.

00479 {
00480 //  TRACEUSER("Gerry", _T("EditButtonDragTarget::GetStatusLineText"));
00481 
00482     ERROR2IF(TheText==NULL,FALSE,_T("NULL string in GetStatusLineText()"));
00483 
00484     // Call our helper function to find out if this can be dropped here
00485     DragInformation *pDragInfo = DragManagerOp::GetCurrentDragInfo();
00486     if (CanDropHere(pDragInfo))
00487     {
00488         String_256 DragString(_R(IDS_COLBAR_DRAGDROP));
00489         *TheText = DragString;
00490         return TRUE;
00491     }
00492 
00493     return FALSE;
00494 }

BOOL EditButtonDragTarget::ProcessEvent DragEventType  Event,
DragInformation pDragInfo,
wxPoint *  pMousePos,
KeyPress pKeyPress
[protected, virtual]
 

Event Handler for Edit Drag.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/1/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Reimplemented from OilDragTarget.

Definition at line 380 of file ccolbar.cpp.

00383 {
00384 //  TRACEUSER("Gerry", _T("EditButtonDragTarget::ProcessEvent"));
00385 
00386     // Not a colour drag? That is kindof unexpected, but lets exit before
00387     // we embarrass ourselves
00388 
00389     if (!pDragInfo->IsKindOf(CC_RUNTIME_CLASS(ColourDragInformation)))
00390         return(FALSE);
00391 
00392     switch(Event)
00393     {
00394         case DRAGEVENT_COMPLETED:
00395             if (CColourBar::TheColourBar != NULL &&
00396                 CColourBar::TheColourBar->m_pCurrentColourList != NULL)
00397             {
00398                 if (CanDropHere(pDragInfo))
00399                 {
00400                     ColourDragInformation *CDI = (ColourDragInformation *) pDragInfo;
00401                     IndexedColour *Col = NULL;
00402 
00403                     if (CDI->IsLibraryColour())
00404                     {
00405                         // We must copy the library colour into the document, but first check with
00406                         // the user that this is what they intended.
00407                     #ifndef WEBSTER
00408                         // Camelot builds ask the user to check that this is what they want
00409                         if (InformError(_R(IDE_CANTEDITLIBCOLOUR), _R(IDS_COPYLIBCOLOUR), _R(IDS_CANCEL)) == 1)
00410                             Col = CDI->GetColourForDocument(Document::GetSelected());
00411                     #else
00412                         // Webster builds just do it. Simplify the UI for the user
00413                         Col = CDI->GetColourForDocument(Document::GetSelected());
00414                     #endif
00415                     }
00416                     else
00417                         Col = CDI->GetInitiallyDraggedColour();
00418 
00419                     if (Col != NULL)
00420                         CColourBar::TheColourBar->EditAColour(CColourBar::TheColourBar->m_pCurrentColourList, Col);
00421                     return(TRUE);
00422                 }
00423             }
00424             break;
00425 
00426 
00427         case DRAGEVENT_MOUSESTOPPED:
00428         case DRAGEVENT_MOUSEMOVED:
00429         case DRAGEVENT_MOUSEIDLE:
00430             // Return TRUE to claim the mouse while over our target area, so that
00431             // our cursor shape is used
00432             return(TRUE);
00433 
00434         default:
00435             break;
00436     }
00437 
00438     // Allow unknown/unwanted events to pass on to other targets
00439     return(FALSE);
00440 }


Friends And Related Function Documentation

friend class DragManagerOp [friend]
 

Reimplemented from OilDragTarget.

Definition at line 138 of file ccolbar.h.


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