Commit 43015435 authored by Mikołaj Zalewski's avatar Mikołaj Zalewski Committed by Alexandre Julliard

comctl32: header: Implement HDM_CREATEDRAGIMAGE.

parent bfe030df
...@@ -875,8 +875,37 @@ HEADER_SendClickNotify (HWND hwnd, UINT code, INT iItem) ...@@ -875,8 +875,37 @@ HEADER_SendClickNotify (HWND hwnd, UINT code, INT iItem)
static LRESULT static LRESULT
HEADER_CreateDragImage (HWND hwnd, WPARAM wParam) HEADER_CreateDragImage (HWND hwnd, WPARAM wParam)
{ {
FIXME("empty stub!\n"); HEADER_INFO *infoPtr = HEADER_GetInfoPtr(hwnd);
return 0; 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;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment