Mikołaj Zalewski : comctl32: header: Implement HDM_CREATEDRAGIMAGE.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri May 26 05:42:14 CDT 2006
Module: wine
Branch: master
Commit: 4301543533261a6c58abf3a9a9a9908d31d636c9
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=4301543533261a6c58abf3a9a9a9908d31d636c9
Author: Mikołaj Zalewski <mikolaj at zalewski.pl>
Date: Thu May 25 23:46:53 2006 +0200
comctl32: header: Implement HDM_CREATEDRAGIMAGE.
---
dlls/comctl32/header.c | 33 +++++++++++++++++++++++++++++++--
1 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/dlls/comctl32/header.c b/dlls/comctl32/header.c
index 81a8b92..f034e7b 100644
--- a/dlls/comctl32/header.c
+++ b/dlls/comctl32/header.c
@@ -875,8 +875,37 @@ HEADER_SendClickNotify (HWND hwnd, UINT
static LRESULT
HEADER_CreateDragImage (HWND hwnd, WPARAM wParam)
{
- FIXME("empty stub!\n");
- return 0;
+ HEADER_INFO *infoPtr = HEADER_GetInfoPtr(hwnd);
+ HEADER_ITEM *lpItem;
+ HIMAGELIST himl;
+ HBITMAP hMemory, hOldBitmap;
+ HDC hMemoryDC;
+ HDC hDeviceDC;
+ int height, width;
+
+ if (wParam < 0 || wParam >= infoPtr->uNumItem)
+ return FALSE;
+ lpItem = &infoPtr->items[wParam];
+ width = lpItem->rect.right - lpItem->rect.left;
+ height = lpItem->rect.bottom - lpItem->rect.top;
+
+ hDeviceDC = GetDC(NULL);
+ hMemoryDC = CreateCompatibleDC(hDeviceDC);
+ hMemory = CreateCompatibleBitmap(hDeviceDC, width, height);
+ ReleaseDC(NULL, hDeviceDC);
+ hOldBitmap = SelectObject(hMemoryDC, hMemory);
+ SetViewportOrgEx(hMemoryDC, -lpItem->rect.left, -lpItem->rect.top, NULL);
+ HEADER_DrawItem(hwnd, hMemoryDC, wParam, FALSE);
+ hMemory = SelectObject(hMemoryDC, hOldBitmap);
+ DeleteDC(hMemoryDC);
+
+ if (hMemory == NULL) /* if anything failed */
+ return FALSE;
+
+ himl = ImageList_Create(width, height, ILC_COLORDDB, 1, 1);
+ ImageList_Add(himl, hMemory, NULL);
+ DeleteObject(hMemory);
+ return (LRESULT)himl;
}
More information about the wine-cvs
mailing list