#include <ccolbar.h>
Inheritance diagram for EditButtonDragTarget:
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 |
To remove a drag target at any time, destruct it - it automatically deregisters and cleans up.
Definition at line 136 of file ccolbar.h.
|
Definition at line 355 of file ccolbar.cpp. 00356 : OilDragTarget(TheWindow, ClientArea) 00357 { 00358 // TRACEUSER("Gerry", _T("EditButtonDragTarget created")); 00359 }
|
|
Internal helper function.
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 }
|
|
Set cursor over this target.
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 }
|
|
provide status line text for this target
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 }
|
|
Event Handler for Edit Drag.
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 }
|
|
Reimplemented from OilDragTarget. |