337 dnd.dndstartargs = args; |
337 dnd.dndstartargs = args; |
338 dnd.dndcompletedargs = { nullptr }; |
338 dnd.dndcompletedargs = { nullptr }; |
339 dnd.drageventargs = { nullptr }; |
339 dnd.drageventargs = { nullptr }; |
340 dnd.data = args.Data(); |
340 dnd.data = args.Data(); |
341 |
341 |
342 UiListDnd dndevt; |
|
343 dndevt.selection = uiselection(); |
|
344 dndevt.dnd = &dnd; |
|
345 |
|
346 UiEvent evt; |
342 UiEvent evt; |
347 evt.obj = this->obj; |
343 evt.obj = this->obj; |
348 evt.window = evt.obj->window; |
344 evt.window = evt.obj->window; |
349 evt.document = obj->ctx->document; |
345 evt.document = obj->ctx->document; |
350 evt.eventdata = &dndevt; |
346 evt.eventdata = &dnd; |
351 evt.intval = 0; |
347 evt.intval = 0; |
352 |
348 |
353 this->ondragstart(&evt, this->ondragstartdata); |
349 this->ondragstart(&evt, this->ondragstartdata); |
354 |
|
355 if (dndevt.selection.rows) { |
|
356 free(dndevt.selection.rows); |
|
357 } |
|
358 }); |
350 }); |
359 cellBorder.DropCompleted([this](IInspectable const& sender, DropCompletedEventArgs args) { |
351 cellBorder.DropCompleted([this](IInspectable const& sender, DropCompletedEventArgs args) { |
360 UiDnD dnd; |
352 UiDnD dnd; |
361 dnd.evttype = 1; |
353 dnd.evttype = 1; |
362 dnd.dndstartargs = { nullptr }; |
354 dnd.dndstartargs = { nullptr }; |
363 dnd.dndcompletedargs = args; |
355 dnd.dndcompletedargs = args; |
364 dnd.drageventargs = { nullptr }; |
356 dnd.drageventargs = { nullptr }; |
365 dnd.data = { nullptr }; |
357 dnd.data = { nullptr }; |
366 |
358 |
367 UiListDnd dndevt; |
|
368 dndevt.selection = uiselection(); |
|
369 dndevt.dnd = &dnd; |
|
370 |
|
371 UiEvent evt; |
359 UiEvent evt; |
372 evt.obj = this->obj; |
360 evt.obj = this->obj; |
373 evt.window = evt.obj->window; |
361 evt.window = evt.obj->window; |
374 evt.document = obj->ctx->document; |
362 evt.document = obj->ctx->document; |
375 evt.eventdata = &dndevt; |
363 evt.eventdata = &dnd; |
376 evt.intval = 0; |
364 evt.intval = 0; |
377 |
365 |
378 if (this->ondragcomplete) { |
366 if (this->ondragcomplete) { |
379 this->ondragcomplete(&evt, this->ondragcompletedata); |
367 this->ondragcomplete(&evt, this->ondragcompletedata); |
380 } |
|
381 if (dndevt.selection.rows) { |
|
382 free(dndevt.selection.rows); |
|
383 } |
368 } |
384 }); |
369 }); |
385 } |
370 } |
386 if (ondrop) { |
371 if (ondrop) { |
387 cellBorder.AllowDrop(true); |
372 cellBorder.AllowDrop(true); |
391 dnd.dndstartargs = { nullptr }; |
376 dnd.dndstartargs = { nullptr }; |
392 dnd.dndcompletedargs = { nullptr }; |
377 dnd.dndcompletedargs = { nullptr }; |
393 dnd.drageventargs = args; |
378 dnd.drageventargs = args; |
394 dnd.dataview = args.DataView(); |
379 dnd.dataview = args.DataView(); |
395 |
380 |
396 UiListDnd dndevt; |
|
397 dndevt.selection = uiselection(); |
|
398 dndevt.dnd = &dnd; |
|
399 |
|
400 UiEvent evt; |
381 UiEvent evt; |
401 evt.obj = this->obj; |
382 evt.obj = this->obj; |
402 evt.window = evt.obj->window; |
383 evt.window = evt.obj->window; |
403 evt.document = obj->ctx->document; |
384 evt.document = obj->ctx->document; |
404 evt.eventdata = &dndevt; |
385 evt.eventdata = &dnd; |
405 evt.intval = 0; |
386 evt.intval = 0; |
406 |
387 |
407 this->ondrop(&evt, this->ondropdata); |
388 this->ondrop(&evt, this->ondropdata); |
408 |
|
409 if (dndevt.selection.rows) { |
|
410 free(dndevt.selection.rows); |
|
411 } |
|
412 })); |
389 })); |
413 cellBorder.DragOver(DragEventHandler([this](winrt::Windows::Foundation::IInspectable const& sender, DragEventArgs const& args){ |
390 cellBorder.DragOver(DragEventHandler([this](winrt::Windows::Foundation::IInspectable const& sender, DragEventArgs const& args){ |
414 args.AcceptedOperation(winrt::Windows::ApplicationModel::DataTransfer::DataPackageOperation::Copy); |
391 args.AcceptedOperation(winrt::Windows::ApplicationModel::DataTransfer::DataPackageOperation::Copy); |
415 })); |
392 })); |
416 } |
393 } |