MCPcopy Create free account
hub / github.com/Kitware/VTK / OnDropFiles

Method OnDropFiles

Rendering/UI/vtkWin32RenderWindowInteractor.cxx:958–1003  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

956
957//------------------------------------------------------------------------------
958int vtkWin32RenderWindowInteractor::OnDropFiles(HWND, WPARAM wParam)
959{
960 if (!this->Enabled)
961 {
962 return 0;
963 }
964
965 HDROP hdrop = reinterpret_cast<HDROP>(wParam);
966
967 POINT pt;
968 if (DragQueryPoint(hdrop, &pt))
969 {
970 double location[2];
971 location[0] = static_cast<double>(pt.x);
972 location[1] = static_cast<double>(this->Size[1] - pt.y - 1); // flip Y
973
974 int ctrl, shift, alt;
975 ::RecoverModifiersStatus(ctrl, shift, alt);
976 this->SetEventInformationFlipY(location[0], location[1], ctrl, shift);
977 this->SetAltKey(alt);
978 this->InvokeEvent(vtkCommand::UpdateDropLocationEvent, location);
979 }
980
981 UINT cFiles = DragQueryFileW(hdrop, 0xFFFFFFFF, nullptr, 0);
982
983 int ret = 0;
984 if (cFiles > 0)
985 {
986 vtkNew<vtkStringArray> filePaths;
987 filePaths->Allocate(cFiles);
988
989 for (UINT i = 0; i < cFiles; i++)
990 {
991 wchar_t file[MAX_PATH];
992 UINT cch = DragQueryFileW(hdrop, i, file, MAX_PATH);
993 if (cch > 0 && cch < MAX_PATH)
994 {
995 filePaths->InsertNextValue(vtksys::Encoding::ToNarrow(file));
996 ret = 1;
997 }
998 }
999 this->InvokeEvent(vtkCommand::DropFilesEvent, filePaths);
1000 }
1001
1002 return ret;
1003}
1004
1005//------------------------------------------------------------------------------
1006// This is only called when InstallMessageProc is true

Callers 1

vtkHandleMessage2Function · 0.45

Calls 4

RecoverModifiersStatusFunction · 0.85
InvokeEventMethod · 0.80
AllocateMethod · 0.45
InsertNextValueMethod · 0.45

Tested by

no test coverage detected