MCPcopy Create free account
hub / github.com/derceg/explorerplusplus / DetermineDragEffect

Function DetermineDragEffect

Explorer++/Helper/ShellHelper.cpp:436–504  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

434}
435
436DWORD DetermineDragEffect(
437 DWORD grfKeyState, DWORD dwCurrentEffect, BOOL bDataAccept, BOOL bOnSameDrive)
438{
439 DWORD dwEffect = DROPEFFECT_NONE;
440
441 if (!bDataAccept)
442 {
443 dwEffect = DROPEFFECT_NONE;
444 }
445 else
446 {
447 /* Test the state of modifier keys. */
448 if ((((grfKeyState & MK_CONTROL) == MK_CONTROL && (grfKeyState & MK_SHIFT) == MK_SHIFT)
449 || (grfKeyState & MK_ALT) == MK_ALT)
450 && dwCurrentEffect & DROPEFFECT_LINK)
451 {
452 /* Shortcut. */
453 dwEffect = DROPEFFECT_LINK;
454 }
455 else if ((grfKeyState & MK_SHIFT) == MK_SHIFT && dwCurrentEffect & DROPEFFECT_MOVE)
456 {
457 /* Move. */
458 dwEffect = DROPEFFECT_MOVE;
459 }
460 else if ((grfKeyState & MK_CONTROL) == MK_CONTROL && dwCurrentEffect & DROPEFFECT_COPY)
461 {
462 /* Copy. */
463 dwEffect = DROPEFFECT_COPY;
464 }
465 else
466 {
467 /* No modifier. Determine the drag effect from
468 the location of the source and destination
469 directories. */
470 if (bOnSameDrive && (dwCurrentEffect & DROPEFFECT_MOVE))
471 {
472 dwEffect = DROPEFFECT_MOVE;
473 }
474 else if (dwCurrentEffect & DROPEFFECT_COPY)
475 {
476 dwEffect = DROPEFFECT_COPY;
477 }
478
479 if (dwEffect == DROPEFFECT_NONE)
480 {
481 /* No suitable drop type found above. Use whichever
482 method is available. */
483 if (dwCurrentEffect & DROPEFFECT_MOVE)
484 {
485 dwEffect = DROPEFFECT_MOVE;
486 }
487 else if (dwCurrentEffect & DROPEFFECT_COPY)
488 {
489 dwEffect = DROPEFFECT_COPY;
490 }
491 else if (dwCurrentEffect & DROPEFFECT_LINK)
492 {
493 dwEffect = DROPEFFECT_LINK;

Callers 6

GetCurrentDragEffectMethod · 0.85
DragEnterMethod · 0.85
DragOverMethod · 0.85
DropMethod · 0.85
CopyDroppedFilesMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected