Exemple #1
0
DROPEFFECT BookmarkToolBar::OnDragEnter(COleDataObject *aOleDataObject, DWORD aKeyState, CPoint aPoint)
{
    DROPEFFECT sDropEffect = DROPEFFECT_LINK;

    DragImage &sDragImage = DragImage::instance();

    if (sDragImage.isMyDragging() == XPR_TRUE)
    {
        CImageList *sMyDragImage = sDragImage.getMyDragImage();
        if (XPR_IS_NOT_NULL(sMyDragImage))
        {
            sMyDragImage->DragEnter(GetDesktopWindow(), aPoint);
            sMyDragImage->DragShowNolock(XPR_TRUE);
        }
    }
    else
    {
        if (mDropTarget.isUseDropHelper() == XPR_TRUE)
        {
            CPoint sDragPoint(aPoint);
            IDataObject *sDataObject = aOleDataObject->GetIDataObject(XPR_FALSE);
            mDropTarget.getDropHelper()->DragEnter(GetSafeHwnd(), sDataObject, &sDragPoint, sDropEffect);
        }
    }

    mOldInsert = -1;
    mOldBookmark = -1;

    return sDropEffect;
}
void CSharedDirsTreeCtrl::OnLvnBegindrag(NMHDR* pNMHDR, LRESULT* pResult) 
{
	LPNMTREEVIEW lpnmtv = (LPNMTREEVIEW)pNMHDR;
	*pResult = 0;

	CDirectoryItem* pToDrag = (CDirectoryItem*)lpnmtv->itemNew.lParam;
	if (pToDrag == NULL || pToDrag->m_eItemType != SDI_UNSHAREDDIRECTORY || FileSystemTreeIsShared(pToDrag->m_strFullPath))
		return;

	ASSERT( m_pDraggingItem == NULL );
	delete m_pDraggingItem;
	m_pDraggingItem = pToDrag->CloneContent(); // to be safe we store a copy, as items can be deleted when collapsing the tree etc

	CImageList* piml = NULL;
	POINT ptOffset;
	RECT rcItem;
	if ((piml = CreateDragImage(lpnmtv->itemNew.hItem)) == NULL)
		return;

	/* get the bounding rectangle of the item being dragged (rel to top-left of control) */
	if (GetItemRect(lpnmtv->itemNew.hItem, &rcItem, TRUE))
	{
		CPoint ptDragBegin;
		int nX, nY;
		/* get offset into image that the mouse is at */
		/* item rect doesn't include the image */
		ptDragBegin = lpnmtv->ptDrag;
		ImageList_GetIconSize(piml->GetSafeHandle(), &nX, &nY);
		ptOffset.x = (ptDragBegin.x - rcItem.left) + (nX - (rcItem.right - rcItem.left));
		ptOffset.y = (ptDragBegin.y - rcItem.top) + (nY - (rcItem.bottom - rcItem.top));
		/* convert the item rect to screen co-ords, for use later */
		MapWindowPoints(NULL, &rcItem);
	}
	else
	{
		GetWindowRect(&rcItem);
		ptOffset.x = ptOffset.y = 8;
	}

	if (piml->BeginDrag(0, ptOffset))
	{
		CPoint ptDragEnter = lpnmtv->ptDrag;
		ClientToScreen(&ptDragEnter);
		piml->DragEnter(NULL, ptDragEnter);
	}
	delete piml;

	/* set the focus here, so we get a WM_CANCELMODE if needed */
	SetFocus();

	/* redraw item being dragged, otherwise it remains (looking) selected */
	InvalidateRect(&rcItem, TRUE);
	UpdateWindow();

	/* Hide the mouse cursor, and direct mouse input to this window */
	SetCapture(); 
}
Exemple #3
0
	void		OnDragEnter( CPoint& pointp ){
		if( m_pDragImage ){
			delete m_pDragImage;
		}
	
		m_pDragImage	= m_List.CreateDragImage( m_nDragIndex, &pt );
		ASSERT(m_pDragImage);

		m_pDragImage->BeginDrag( 0, CPoint(8, 8) );
		m_pDragImage->DragEnter( GetDesktopWindow(), ((NM_LISTVIEW *)pnmhdr)->ptAction );

		m_bDragging		= TRUE;
		m_hDropItem		= NULL;
		m_nDropIndex	= -1;
		m_pDropWnd		= &m_List;

		SetCapture();
	}
Exemple #4
0
void hdCLibDlg::OnBegindragMylist(NMHDR* pNMHDR, LRESULT* pResult) 
{
	NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
	m_dragItem = pNMTreeView->itemNew.hItem;

	if(m_dragItem!=ModelParent)
	{
		CImageList* pDragImage;
		pDragImage = m_mylist.CreateDragImage( m_dragItem );
		m_mylist.SelectItem( m_dragItem );
		pDragImage->BeginDrag( 0, CPoint(0,-14) );
		pDragImage->DragEnter(this, pNMTreeView->ptDrag);
		SetCapture();
		m_bIsDragging = TRUE;
		delete pDragImage;
		bDragFromLibrary=FALSE;
		SetTimer ( 1, 75, NULL ) ;
	}

	*pResult = 0;
}
Exemple #5
0
void CSpiroView::OnMouseMove(UINT nFlags, CPoint point) 
{
	if (m_bMovingPencil || m_pFigureDrag != NULL)  // the user is dragging the pencil location
	{
		CPoint ptWindow(point);
		ClientToScreen(&ptWindow);
		CRect	rectWindow;
		GetWindowRect(&rectWindow);
		ptWindow.Offset(-rectWindow.left, -rectWindow.top);

		CImageList* pImList = m_bMovingPencil? &GetApp()->m_imageList : m_pILDragFigure;

		ENSURE(pImList != NULL);
		if (m_bStartDrag)
		{
			ENSURE(m_pFigureDrag != NULL);
			m_bStartDrag = false;
			CSpiroRect rect;
			m_pFigureDrag->GetBoundingRect(&rect);
			rect.Scale(m_nZoomNumer, m_nZoomDenom);
			CDC* pDC = GetDC();
			ENSURE(pDC != NULL);
			OnPrepareDC(pDC);
			pDC->LPtoDP(&rect);
			ReleaseDC(pDC);
			rect.InflateRect(4, 4);
			InvalidateRect(&rect);
			pImList->DragLeave(this);
			UpdateWindow();
			pImList->DragEnter(this, ptWindow);
		}
		else
			pImList->DragMove(ptWindow);

		return;
	}

	CScrollView::OnMouseMove(nFlags, point);
}