HRESULT DropTargetWin::DragEnter(IDataObject* data_object,
                                  DWORD key_state,
                                  POINTL cursor_position,
                                  DWORD* effect) {
  if (!callback_)
    return E_UNEXPECTED;

  HRESULT hr;
  IDropTargetHelper* drop_helper = DropHelper();
  if (drop_helper) {
	  hr = drop_helper->DragEnter(hWnd_, data_object,
		  reinterpret_cast<POINT*>(&cursor_position), *effect);
  }

  CefRefPtr<CefDragData> drag_data = current_drag_data_;
  if (!drag_data) {
    drag_data = DataObjectToDragData(data_object);
  }

  CefMouseEvent ev = ToMouseEvent(cursor_position, key_state, hWnd_);
  CefBrowserHost::DragOperationsMask mask = DropEffectToDragOperation(*effect);
  mask = callback_->OnDragEnter(drag_data, ev, mask);
  *effect = DragOperationToDropEffect(mask);
  return S_OK;
}
HRESULT DropTargetWin::DragLeave() {
  if (!callback_)
    return E_UNEXPECTED;

  IDropTargetHelper* drop_helper = DropHelper();
  if (drop_helper)
	  drop_helper->DragLeave();

  callback_->OnDragLeave();
  return S_OK;
}
Esempio n. 3
0
HRESULT DropTarget::DragLeave() {
	// Tell the helper that we moved out of it so it can update the drag image.
	IDropTargetHelper* drop_helper = DropHelper();
	if (drop_helper)
		drop_helper->DragLeave();

	if (suspended_)
		return S_OK;

	OnDragLeave(current_data_object_);

	current_data_object_ = NULL;
	return S_OK;
}
HRESULT DropTargetWin::DragOver(DWORD key_state,
                                POINTL cursor_position,
                                DWORD* effect) {
  if (!callback_)
    return E_UNEXPECTED;

  // Tell the helper that we moved over it so it can update the drag image.
  IDropTargetHelper* drop_helper = DropHelper();
  if (drop_helper)
	  drop_helper->DragOver(reinterpret_cast<POINT*>(&cursor_position), *effect);

  CefMouseEvent ev = ToMouseEvent(cursor_position, key_state, hWnd_);
  CefBrowserHost::DragOperationsMask mask = DropEffectToDragOperation(*effect);
  mask = callback_->OnDragOver(ev, mask);
  *effect = DragOperationToDropEffect(mask);
  return S_OK;
}
Esempio n. 5
0
HRESULT DropTarget::DragOver(DWORD key_state,
							 POINTL cursor_position,
							 DWORD* effect) {
								 // Tell the helper that we moved over it so it can update the drag image.
								 IDropTargetHelper* drop_helper = DropHelper();
								 if (drop_helper)
									 drop_helper->DragOver(reinterpret_cast<POINT*>(&cursor_position), *effect);

								 if (suspended_) {
									 *effect = DROPEFFECT_NONE;
									 return S_OK;
								 }

								 POINT screen_pt = { cursor_position.x, cursor_position.y };
								 *effect = OnDragOver(current_data_object_, key_state, screen_pt, *effect);
								 return S_OK;
}
Esempio n. 6
0
HRESULT DropTarget::DragEnter(IDataObject* data_object,
							  DWORD key_state,
							  POINTL cursor_position,
							  DWORD* effect) {
								  // Tell the helper that we entered so it can update the drag image.
								  IDropTargetHelper* drop_helper = DropHelper();
								  if (drop_helper) {
									  drop_helper->DragEnter(GetHWND(), data_object,
										  reinterpret_cast<POINT*>(&cursor_position), *effect);
								  }

								  // You can't drag and drop within the same HWND.
								  if (suspended_) {
									  *effect = DROPEFFECT_NONE;
									  return S_OK;
								  }

								  current_data_object_ = data_object;
								  POINT screen_pt = { cursor_position.x, cursor_position.y };
								  *effect = OnDragEnter(current_data_object_, key_state, screen_pt, *effect);
								  return S_OK;
}