Fall back on using tree/list control item text in wxDragImage.
Use the item text instead of its image if it doesn't have any when creating a wxDragImage from a wxTreeCtrl or wxListCtrl item instead of just failing. Closes #4390. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64415 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -250,7 +250,13 @@ bool wxDragImage::Create(const wxTreeCtrl& treeCtrl, wxTreeItemId& id)
|
|||||||
ImageList_Destroy(GetHimageList());
|
ImageList_Destroy(GetHimageList());
|
||||||
m_hImageList = (WXHIMAGELIST)
|
m_hImageList = (WXHIMAGELIST)
|
||||||
TreeView_CreateDragImage(GetHwndOf(&treeCtrl), (HTREEITEM) id.m_pItem);
|
TreeView_CreateDragImage(GetHwndOf(&treeCtrl), (HTREEITEM) id.m_pItem);
|
||||||
return m_hImageList != 0;
|
if ( !m_hImageList )
|
||||||
|
{
|
||||||
|
// fall back on just the item text if there is no image
|
||||||
|
return Create(treeCtrl.GetItemText(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -261,8 +267,17 @@ bool wxDragImage::Create(const wxListCtrl& listCtrl, long id)
|
|||||||
if ( m_hImageList )
|
if ( m_hImageList )
|
||||||
ImageList_Destroy(GetHimageList());
|
ImageList_Destroy(GetHimageList());
|
||||||
POINT pt;
|
POINT pt;
|
||||||
pt.x = 0; pt.y = 0;
|
pt.x =
|
||||||
m_hImageList = (WXHIMAGELIST) ListView_CreateDragImage((HWND) listCtrl.GetHWND(), id, & pt);
|
pt.y = 0;
|
||||||
|
m_hImageList = (WXHIMAGELIST)
|
||||||
|
ListView_CreateDragImage(GetHwndOf(&listCtrl), id, &pt);
|
||||||
|
|
||||||
|
if ( !m_hImageList )
|
||||||
|
{
|
||||||
|
// as for wxTreeCtrl, fall back on dragging just the item text
|
||||||
|
return Create(listCtrl.GetItemText(id));
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user