inline HRESULT __stdcall ISimpleDropTarget::DragOver(DWORD grfKeyState, POINTL ptl, DWORD * pdwEffect) { POINT pt; pt.x = ptl.x; pt.y = ptl.y; if (m_pdth && PrevFancyRenderer) { m_pdth->DragOver(&pt, *pdwEffect); } bool canDrop = m_RightData && AllowDrop(ptl); if (canDrop) { *pdwEffect = OnDragOver(grfKeyState, ptl); } if (m_DataObject && m_pdth) { m_pdth->Show(canDrop); } if (!canDrop) { *pdwEffect = DROPEFFECT_NONE; } return S_OK; }
inline HRESULT __stdcall ISimpleDropTarget::DragEnter(IDataObject * pDataObject, DWORD grfKeyState, POINTL ptl, DWORD * pdwEffect) { POINT pt; pt.x = ptl.x; pt.y = ptl.y; if (m_pdth && PrevFancyRenderer) { m_pdth->DragEnter(m_hwnd, pDataObject, &pt, *pdwEffect); } m_DataObject = pDataObject; dragInAction = true; m_RightData = QueryDataObject(pDataObject); bool canDrop = m_RightData && AllowDrop(ptl); if (canDrop) { SetFocus(m_hwnd); auto files = GetFiles(pDataObject); *pdwEffect = OnDragEnter(files, grfKeyState, ptl); } else { *pdwEffect = DROPEFFECT_NONE; } return S_OK; }
PRBool nsEditorHookUtils::DoAllowDropHook(nsIDOMDocument *aDoc, nsIDOMEvent *aEvent, nsIDragSession *aSession) { nsCOMPtr<nsISimpleEnumerator> enumerator; GetHookEnumeratorFromDocument(aDoc, getter_AddRefs(enumerator)); if (!enumerator) return PR_TRUE; PRBool hasMoreHooks = PR_FALSE; while (NS_SUCCEEDED(enumerator->HasMoreElements(&hasMoreHooks)) && hasMoreHooks) { nsCOMPtr<nsISupports> isupp; if (NS_FAILED(enumerator->GetNext(getter_AddRefs(isupp)))) break; nsCOMPtr<nsIClipboardDragDropHooks> override = do_QueryInterface(isupp); if (override) { PRBool allowDrop = PR_TRUE; nsresult hookResult = override->AllowDrop(aEvent, aSession, &allowDrop); NS_ASSERTION(NS_SUCCEEDED(hookResult), "hook failure in AllowDrop"); if (!allowDrop) return PR_FALSE; } } return PR_TRUE; }
EVisibility SDropTarget::GetDragOverlayVisibility() const { if ( FSlateApplication::Get().IsDragDropping() ) { if ( AllowDrop(FSlateApplication::Get().GetDragDroppingContent()) || (bIsDragOver && bIsDragEventRecognized) ) { return EVisibility::HitTestInvisible; } } return EVisibility::Hidden; }
inline HRESULT __stdcall ISimpleDropTarget::Drop(IDataObject * pDataObject, DWORD grfKeyState, POINTL ptl, DWORD * pdwEffect) { POINT pt; pt.x = ptl.x; pt.y = ptl.y; if (m_pdth) { m_pdth->Drop(pDataObject, &pt, *pdwEffect); } m_DataObject = NULL; dragInAction = false; bool canDrop = m_RightData && AllowDrop(ptl); if (canDrop) { auto files = GetFiles(pDataObject); OnDragDrop(files, grfKeyState, ptl); } else { *pdwEffect = DROPEFFECT_NONE; } return S_OK; }
void InventoryViewController::DragObserver(InventoryView* container, Rocket::Core::Element* element) { std::vector<InventoryView*>::iterator itView = _views.begin(); std::vector<InventoryView*>::iterator end = _views.end(); for (; itView != end && (!((*(*itView)) == element->GetParentNode())) ; ++itView); if (itView != _views.end()) { InventoryView& view = (*(*itView)); if (AllowDrop(view, *container)) { InventoryObject* object = view.GetObjectFromId(std::string(element->GetId().CString())); if (container->GetInventory().CanCarry(object) && CanSwap(object)) { view.GetInventory().DelObject(object); container->GetInventory().AddObject(object); view.UpdateView(); container->UpdateView(); } } } }
FReply SDropTarget::OnDragOver(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent) { // Handle the reply if we are allowed to drop, otherwise do not handle it. return AllowDrop(DragDropEvent.GetOperation()) ? FReply::Handled() : FReply::Unhandled(); }