mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 01:15:09 +00:00
[SHELL32] - CDefView: Implement rudimentary support for drag icons. For now we only show the icon of the first item (no caption or other icons yet).
svn path=/trunk/; revision=73661
This commit is contained in:
parent
926c3cfb05
commit
9d21751b1b
1 changed files with 29 additions and 6 deletions
|
@ -1740,6 +1740,8 @@ LRESULT CDefView::OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandl
|
||||||
|
|
||||||
if (SUCCEEDED(m_pSFParent->GetUIObjectOf(m_hWnd, m_cidl, m_apidl, IID_NULL_PPV_ARG(IDataObject, &pda))))
|
if (SUCCEEDED(m_pSFParent->GetUIObjectOf(m_hWnd, m_cidl, m_apidl, IID_NULL_PPV_ARG(IDataObject, &pda))))
|
||||||
{
|
{
|
||||||
|
LPNMLISTVIEW params = (LPNMLISTVIEW)lParam;
|
||||||
|
|
||||||
if (SUCCEEDED(m_pSFParent->GetAttributesOf(m_cidl, m_apidl, &dwAttributes)))
|
if (SUCCEEDED(m_pSFParent->GetAttributesOf(m_cidl, m_apidl, &dwAttributes)))
|
||||||
{
|
{
|
||||||
if (dwAttributes & SFGAO_CANLINK)
|
if (dwAttributes & SFGAO_CANLINK)
|
||||||
|
@ -1757,9 +1759,18 @@ LRESULT CDefView::OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandl
|
||||||
DWORD dwEffect2;
|
DWORD dwEffect2;
|
||||||
|
|
||||||
m_pSourceDataObject = pda;
|
m_pSourceDataObject = pda;
|
||||||
m_ptFirstMousePos = ((LPNMLISTVIEW)lParam)->ptAction;
|
m_ptFirstMousePos = params->ptAction;
|
||||||
ClientToScreen(&m_ptFirstMousePos);
|
ClientToScreen(&m_ptFirstMousePos);
|
||||||
|
|
||||||
|
HIMAGELIST big_icons, small_icons;
|
||||||
|
Shell_GetImageLists(&big_icons, &small_icons);
|
||||||
|
PCUITEMID_CHILD pidl = _PidlByItem(params->iItem);
|
||||||
|
int iIcon = SHMapPIDLToSystemImageListIndex(m_pSFParent, pidl, 0);
|
||||||
|
POINT ptItem;
|
||||||
|
m_ListView.GetItemPosition(params->iItem, &ptItem);
|
||||||
|
|
||||||
|
ImageList_BeginDrag(big_icons, iIcon, m_ptFirstMousePos.x - ptItem.x, m_ptFirstMousePos.y - ptItem.y);
|
||||||
|
|
||||||
DoDragDrop(pda, this, dwEffect, &dwEffect2);
|
DoDragDrop(pda, this, dwEffect, &dwEffect2);
|
||||||
|
|
||||||
m_pSourceDataObject.Release();
|
m_pSourceDataObject.Release();
|
||||||
|
@ -2913,34 +2924,44 @@ HRESULT CDefView::drag_notify_subitem(DWORD grfKeyState, POINTL pt, DWORD *pdwEf
|
||||||
|
|
||||||
/* If anything failed, m_pCurDropTarget should be NULL now, which ought to be a save state. */
|
/* If anything failed, m_pCurDropTarget should be NULL now, which ought to be a save state. */
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
*pdwEffect = DROPEFFECT_NONE;
|
||||||
return hr;
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
/* Notify the item just entered via DragEnter. */
|
if (m_iDragOverItem != -1)
|
||||||
hr = m_pCurDropTarget->DragEnter(m_pCurDataObject, grfKeyState, pt, pdwEffect);
|
|
||||||
|
|
||||||
if (m_iDragOverItem != -1 && pdwEffect != DROPEFFECT_NONE)
|
|
||||||
{
|
{
|
||||||
SelectItem(m_iDragOverItem, SVSI_SELECT);
|
SelectItem(m_iDragOverItem, SVSI_SELECT);
|
||||||
}
|
}
|
||||||
|
|
||||||
return hr;
|
/* Notify the item just entered via DragEnter. */
|
||||||
|
return m_pCurDropTarget->DragEnter(m_pCurDataObject, grfKeyState, pt, pdwEffect);
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI CDefView::DragEnter(IDataObject *pDataObject, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
|
HRESULT WINAPI CDefView::DragEnter(IDataObject *pDataObject, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
|
||||||
{
|
{
|
||||||
|
POINT ptClient = {pt.x, pt.y};
|
||||||
|
ScreenToClient(&ptClient);
|
||||||
|
|
||||||
/* Get a hold on the data object for later calls to DragEnter on the sub-folders */
|
/* Get a hold on the data object for later calls to DragEnter on the sub-folders */
|
||||||
m_pCurDataObject = pDataObject;
|
m_pCurDataObject = pDataObject;
|
||||||
|
|
||||||
|
ImageList_DragEnter(m_hWnd, ptClient.x, ptClient.y);
|
||||||
return drag_notify_subitem(grfKeyState, pt, pdwEffect);
|
return drag_notify_subitem(grfKeyState, pt, pdwEffect);
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI CDefView::DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
|
HRESULT WINAPI CDefView::DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
|
||||||
{
|
{
|
||||||
|
POINT ptClient = {pt.x, pt.y};
|
||||||
|
ScreenToClient(&ptClient);
|
||||||
|
ImageList_DragMove(ptClient.x, ptClient.y);
|
||||||
return drag_notify_subitem(grfKeyState, pt, pdwEffect);
|
return drag_notify_subitem(grfKeyState, pt, pdwEffect);
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI CDefView::DragLeave()
|
HRESULT WINAPI CDefView::DragLeave()
|
||||||
{
|
{
|
||||||
|
ImageList_DragLeave(m_hWnd);
|
||||||
|
|
||||||
if (m_pCurDropTarget)
|
if (m_pCurDropTarget)
|
||||||
{
|
{
|
||||||
m_pCurDropTarget->DragLeave();
|
m_pCurDropTarget->DragLeave();
|
||||||
|
@ -2961,6 +2982,8 @@ HRESULT WINAPI CDefView::Drop(IDataObject* pDataObject, DWORD grfKeyState, POINT
|
||||||
{
|
{
|
||||||
ERR("GetKeyState(VK_LBUTTON): %d\n", GetKeyState(VK_LBUTTON));
|
ERR("GetKeyState(VK_LBUTTON): %d\n", GetKeyState(VK_LBUTTON));
|
||||||
|
|
||||||
|
ImageList_EndDrag();
|
||||||
|
|
||||||
if ((m_iDragOverItem == -1 || m_pCurDropTarget == NULL) &&
|
if ((m_iDragOverItem == -1 || m_pCurDropTarget == NULL) &&
|
||||||
(*pdwEffect & DROPEFFECT_MOVE) &&
|
(*pdwEffect & DROPEFFECT_MOVE) &&
|
||||||
/*(GetKeyState(VK_LBUTTON) != 0) &&*/
|
/*(GetKeyState(VK_LBUTTON) != 0) &&*/
|
||||||
|
|
Loading…
Reference in a new issue