summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorTobias Weimer <wishmaster51@googlemail.com>2012-07-07 20:15:29 +0000
committerTobias Weimer <wishmaster51@googlemail.com>2012-07-07 20:15:29 +0000
commit990064649ebc7b3df17b3784b6c38d6a09df39ec (patch)
tree914c5a0d8d81f134aa2cf08777998c14837307ff /plugins
parent828952bee9fd651d686b112f4c93a60968fb501a (diff)
Fixed dragging items to top (code ripped from clist_modern)
git-svn-id: http://svn.miranda-ng.org/main/trunk@837 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/TopToolBar/ttbopt.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/plugins/TopToolBar/ttbopt.cpp b/plugins/TopToolBar/ttbopt.cpp
index c377868477..05a0a63221 100644
--- a/plugins/TopToolBar/ttbopt.cpp
+++ b/plugins/TopToolBar/ttbopt.cpp
@@ -450,9 +450,13 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
ScreenToClient(hTree, &hti.pt);
TreeView_HitTest(hTree, &hti);
if (hti.flags & (TVHT_ONITEM | TVHT_ONITEMRIGHT)) {
+ HTREEITEM it=hti.hItem;
hti.pt.y -= TreeView_GetItemHeight(hTree)/2;
TreeView_HitTest(hTree, &hti);
- TreeView_SetInsertMark(hTree, hti.hItem, 1);
+ if (!(hti.flags&TVHT_ABOVE))
+ TreeView_SetInsertMark(hTree,hti.hItem,1);
+ else
+ TreeView_SetInsertMark(hTree,it,0);
}
else {
if (hti.flags & TVHT_ABOVE) SendMessage(hTree, WM_VSCROLL, MAKEWPARAM(SB_LINEUP, 0), 0);
@@ -477,12 +481,14 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
TreeView_HitTest(hTree, &hti);
if (dat->hDragItem == hti.hItem)
break;
+ if (hti.flags&TVHT_ABOVE)
+ hti.hItem=TVI_FIRST;
TVITEM tvi;
tvi.mask = TVIF_HANDLE|TVIF_PARAM;
- tvi.hItem = hti.hItem;
+ tvi.hItem = (HTREEITEM) dat->hDragItem;
TreeView_GetItem(hTree, &tvi);
- if (hti.flags & (TVHT_ONITEM | TVHT_ONITEMRIGHT)) {
+ if ( (hti.flags & (TVHT_ONITEM | TVHT_ONITEMRIGHT)) || (hti.hItem==TVI_FIRST)) {
TVINSERTSTRUCT tvis;
TCHAR name[128];
tvis.item.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_STATE;