Changeset 75:f824f1836871
- Timestamp:
- 02/04/08 21:50:39
(1 year ago)
- Author:
- Frank Benoit <benoit@tionex.de>
- branch:
- default
- Message:
Tree
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r70 |
r75 |
|
| 4364 | 4364 | alias WINAPI.InterlockedDecrement InterlockedDecrement; |
|---|
| 4365 | 4365 | alias WINAPI.InterlockedIncrement InterlockedIncrement; |
|---|
| | 4366 | alias WINAPI.IntersectClipRect IntersectClipRect; |
|---|
| 4366 | 4367 | alias WINAPI.IntersectRect IntersectRect; |
|---|
| 4367 | 4368 | alias WINAPI.InvalidateRect InvalidateRect; |
|---|
| r67 |
r75 |
|
| 153 | 153 | LPCWSTR pszSubAppName, |
|---|
| 154 | 154 | LPCWSTR pszSubIdList |
|---|
| | 155 | ); |
|---|
| | 156 | int IntersectClipRect( |
|---|
| | 157 | HDC hdc, // handle to DC |
|---|
| | 158 | int nLeftRect, // x-coord of upper-left corner |
|---|
| | 159 | int nTopRect, // y-coord of upper-left corner |
|---|
| | 160 | int nRightRect, // x-coord of lower-right corner |
|---|
| | 161 | int nBottomRect // y-coord of lower-right corner |
|---|
| 155 | 162 | ); |
|---|
| 156 | 163 | } |
|---|
| r69 |
r75 |
|
| 70 | 70 | int idNew; |
|---|
| 71 | 71 | DWORD dwFlags; |
|---|
| | 72 | } |
|---|
| | 73 | struct NMTVDISPINFO { |
|---|
| | 74 | NMHDR hdr; |
|---|
| | 75 | TVITEM item; |
|---|
| | 76 | } |
|---|
| | 77 | struct NMTVITEMCHANGE { |
|---|
| | 78 | NMHDR hdr; |
|---|
| | 79 | UINT uChanged; |
|---|
| | 80 | HTREEITEM hItem; |
|---|
| | 81 | UINT uStateNew; |
|---|
| | 82 | UINT uStateOld; |
|---|
| | 83 | LPARAM lParam; |
|---|
| 72 | 84 | } |
|---|
| 73 | 85 | // .... |
|---|
| … | … | |
| 2082 | 2094 | alias ULARGE_INTEGER * PULARGE_INTEGER; |
|---|
| 2083 | 2095 | |
|---|
| | 2096 | alias extern(Windows) int (*PFNTVCOMPARE)(LPARAM, LPARAM, LPARAM); |
|---|
| | 2097 | struct TVSORTCB { |
|---|
| | 2098 | HTREEITEM hParent; |
|---|
| | 2099 | PFNTVCOMPARE lpfnCompare; |
|---|
| | 2100 | LPARAM lParam; |
|---|
| | 2101 | } |
|---|
| | 2102 | |
|---|
| | 2103 | |
|---|
| | 2104 | |
|---|
| | 2105 | |
|---|
| 2084 | 2106 | //struct WINDOWPLACEMENT { |
|---|
| 2085 | 2107 | // UINT length; |
|---|
| … | … | |
| 2091 | 2113 | //} |
|---|
| 2092 | 2114 | // |
|---|
| 2093 | | struct WINDOWPOS { |
|---|
| 2094 | | HWND hwnd; |
|---|
| 2095 | | HWND hwndInsertAfter; |
|---|
| 2096 | | int x; |
|---|
| 2097 | | int y; |
|---|
| 2098 | | int cx; |
|---|
| 2099 | | int cy; |
|---|
| 2100 | | UINT flags; |
|---|
| 2101 | | } |
|---|
| | 2115 | // struct WINDOWPOS { |
|---|
| | 2116 | // HWND hwnd; |
|---|
| | 2117 | // HWND hwndInsertAfter; |
|---|
| | 2118 | // int x; |
|---|
| | 2119 | // int y; |
|---|
| | 2120 | // int cx; |
|---|
| | 2121 | // int cy; |
|---|
| | 2122 | // UINT flags; |
|---|
| | 2123 | // } |
|---|
| 2102 | 2124 | |
|---|
| 2103 | 2125 | // WNDCLASSA is declared in phobos |
|---|
| r54 |
r75 |
|
| 743 | 743 | // } |
|---|
| 744 | 744 | if (defer) { |
|---|
| 745 | | hdwp = DeferWindowPos (hdwp, wp.hwnd, null, wp.x, wp.y, wp.cx, wp.cy, wp.flags); |
|---|
| | 745 | hdwp = DeferWindowPos (hdwp, wp._hwnd, null, wp.x, wp.y, wp.cx, wp.cy, wp.flags); |
|---|
| 746 | 746 | if (hdwp is null) return false; |
|---|
| 747 | 747 | } else { |
|---|
| 748 | | SetWindowPos (wp.hwnd, null, wp.x, wp.y, wp.cx, wp.cy, wp.flags); |
|---|
| | 748 | SetWindowPos (wp._hwnd, null, wp.x, wp.y, wp.cx, wp.cy, wp.flags); |
|---|
| 749 | 749 | } |
|---|
| 750 | 750 | } |
|---|
| r54 |
r75 |
|
| 1013 | 1013 | for (int i=0; i<lpwp.length; i++) { |
|---|
| 1014 | 1014 | WINDOWPOS* wp = lpwp [i]; |
|---|
| 1015 | | if (wp !is null && wp.hwnd is handle) { |
|---|
| | 1015 | if (wp !is null && wp._hwnd is handle) { |
|---|
| 1016 | 1016 | /* |
|---|
| 1017 | 1017 | * This code is intentionally commented. All widgets that |
|---|
| … | … | |
| 1024 | 1024 | // if ((bits & OS.WS_CLIPSIBLINGS) is 0) wp.flags |= OS.SWP_NOCOPYBITS; |
|---|
| 1025 | 1025 | // } |
|---|
| 1026 | | SetWindowPos (wp.hwnd, null, wp.x, wp.y, wp.cx, wp.cy, wp.flags); |
|---|
| | 1026 | SetWindowPos (wp._hwnd, null, wp.x, wp.y, wp.cx, wp.cy, wp.flags); |
|---|
| 1027 | 1027 | lpwp [i] = null; |
|---|
| 1028 | 1028 | return; |
|---|
| … | … | |
| 2573 | 2573 | } |
|---|
| 2574 | 2574 | WINDOWPOS* wp = new WINDOWPOS; |
|---|
| 2575 | | wp.hwnd = topHandle_; |
|---|
| | 2575 | wp._hwnd = topHandle_; |
|---|
| 2576 | 2576 | wp.x = x; |
|---|
| 2577 | 2577 | wp.y = y; |
|---|
| r73 |
r75 |
|
| 1274 | 1274 | checkDevice (); |
|---|
| 1275 | 1275 | Control control = getControl (handle); |
|---|
| 1276 | | return control !is null ? control.findItem (id) : null; |
|---|
| | 1276 | return control !is null ? control.findItem (cast(HANDLE) id) : null; |
|---|
| 1277 | 1277 | } |
|---|
| 1278 | 1278 | |
|---|
| r74 |
r75 |
|
| 107 | 107 | TreeColumn sortColumn; |
|---|
| 108 | 108 | HWND hwndParent, hwndHeader; |
|---|
| 109 | | HANDLE hAnchor, hInsert, lastID, hSelect; |
|---|
| 110 | | int hFirstIndexOf, hLastIndexOf, lastIndexOf, itemCount, sortDirection; |
|---|
| | 109 | HANDLE hAnchor, hInsert, hSelect; |
|---|
| | 110 | int lastID; |
|---|
| | 111 | HANDLE hFirstIndexOf, hLastIndexOf; |
|---|
| | 112 | int lastIndexOf, itemCount, sortDirection; |
|---|
| 111 | 113 | bool dragStarted, gestureCompleted, insertAfter, shrink, ignoreShrink; |
|---|
| 112 | 114 | bool ignoreSelect, ignoreExpand, ignoreDeselect, ignoreResize; |
|---|
| … | … | |
| 115 | 117 | bool ignoreCustomDraw, ignoreDrawForeground, ignoreDrawBackground, ignoreDrawFocus; |
|---|
| 116 | 118 | bool ignoreDrawSelection, ignoreDrawHot, ignoreFullSelection, explorerTheme; |
|---|
| 117 | | int scrollWidth, itemToolTipHandle, selectionForeground; |
|---|
| 118 | | HANDLE headerToolTipHandle; |
|---|
| | 119 | int scrollWidth, selectionForeground; |
|---|
| | 120 | HANDLE headerToolTipHandle, itemToolTipHandle; |
|---|
| 119 | 121 | static const int INSET = 3; |
|---|
| 120 | 122 | static const int GRID_WIDTH = 1; |
|---|
| … | … | |
| 125 | 127 | static const int EXPLORER_EXTRA = 2; |
|---|
| 126 | 128 | static const bool EXPLORER_THEME = true; |
|---|
| 127 | | static const int TreeProc; |
|---|
| | 129 | static const WNDPROC TreeProc; |
|---|
| 128 | 130 | static const TCHAR[] TreeClass = OS.WC_TREEVIEW; |
|---|
| 129 | 131 | static const WNDPROC HeaderProc; |
|---|
| 130 | 132 | static const TCHAR[] HeaderClass = OS.WC_HEADER; |
|---|
| 131 | 133 | static this() { |
|---|
| 132 | | WNDCLASS lpWndClass = new WNDCLASS (); |
|---|
| 133 | | OS.GetClassInfo (0, TreeClass, lpWndClass); |
|---|
| | 134 | WNDCLASS lpWndClass; |
|---|
| | 135 | OS.GetClassInfo (null, TreeClass.ptr, &lpWndClass); |
|---|
| 134 | 136 | TreeProc = lpWndClass.lpfnWndProc; |
|---|
| 135 | | OS.GetClassInfo (0, HeaderClass, lpWndClass); |
|---|
| | 137 | OS.GetClassInfo (null, HeaderClass.ptr, &lpWndClass); |
|---|
| 136 | 138 | HeaderProc = lpWndClass.lpfnWndProc; |
|---|
| 137 | 139 | } |
|---|
| 138 | | |
|---|
| | 140 | private static Tree sThis; |
|---|
| 139 | 141 | /** |
|---|
| 140 | 142 | * Constructs a new instance of this class given its parent |
|---|
| … | … | |
| 237 | 239 | |
|---|
| 238 | 240 | TreeItem _getItem (HANDLE hItem) { |
|---|
| 239 | | TVITEM tvItem = new TVITEM (); |
|---|
| | 241 | TVITEM tvItem; |
|---|
| 240 | 242 | tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_PARAM; |
|---|
| 241 | 243 | tvItem.hItem = hItem; |
|---|
| 242 | | if (OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem) !is 0) { |
|---|
| | 244 | if (OS.SendMessage (handle, OS.TVM_GETITEM, 0, &tvItem) !is 0) { |
|---|
| 243 | 245 | return _getItem (tvItem.hItem, tvItem.lParam); |
|---|
| 244 | 246 | } |
|---|
| … | … | |
| 248 | 250 | TreeItem _getItem (HANDLE hItem, int id) { |
|---|
| 249 | 251 | if ((style & DWT.VIRTUAL) is 0) return items [id]; |
|---|
| 250 | | return id !is -1 ? items [id] : new TreeItem (this, DWT.NONE, -1, -1, hItem); |
|---|
| | 252 | return id !is -1 ? items [id] : new TreeItem (this, DWT.NONE, cast(HANDLE)-1, cast(HANDLE)-1, hItem); |
|---|
| 251 | 253 | } |
|---|
| 252 | 254 | |
|---|
| … | … | |
| 352 | 354 | |
|---|
| 353 | 355 | override HWND borderHandle () { |
|---|
| 354 | | return hwndParent !is 0 ? hwndParent : handle; |
|---|
| 355 | | } |
|---|
| 356 | | |
|---|
| 357 | | LRESULT CDDS_ITEMPOSTPAINT (NMTVCUSTOMDRAW nmcd, int wParam, int lParam) { |
|---|
| 358 | | if (ignoreCustomDraw) return null; |
|---|
| 359 | | if (nmcd.left is nmcd.right) return new LRESULT (OS.CDRF_DODEFAULT); |
|---|
| 360 | | int hDC = nmcd.hdc; |
|---|
| | 356 | return hwndParent !is null ? hwndParent : handle; |
|---|
| | 357 | } |
|---|
| | 358 | |
|---|
| | 359 | LRESULT CDDS_ITEMPOSTPAINT (NMTVCUSTOMDRAW* nmcd, int wParam, int lParam) { |
|---|
| | 360 | if (ignoreCustomDraw) return LRESULT.NULL; |
|---|
| | 361 | if (nmcd.nmcd.rc.left is nmcd.nmcd.rc.right) return cast(LRESULT) (OS.CDRF_DODEFAULT); |
|---|
| | 362 | auto hDC = nmcd.nmcd.hdc; |
|---|
| 361 | 363 | OS.RestoreDC (hDC, -1); |
|---|
| 362 | 364 | TreeItem item = getItem (nmcd); |
|---|
| … | … | |
| 372 | 374 | * COMCTL32.DLL, |
|---|
| 373 | 375 | */ |
|---|
| 374 | | if (item is null) return null; |
|---|
| | 376 | if (item is null) return LRESULT.NULL; |
|---|
| 375 | 377 | |
|---|
| 376 | 378 | /* |
|---|
| … | … | |
| 385 | 387 | * TVM_SETITEM. |
|---|
| 386 | 388 | */ |
|---|
| 387 | | if (nmcd.left >= nmcd.right || nmcd.top >= nmcd.bottom) return null; |
|---|
| 388 | | if (!OS.IsWindowVisible (handle)) return null; |
|---|
| | 389 | if (nmcd.nmcd.rc.left >= nmcd.nmcd.rc.right || nmcd.nmcd.rc.top >= nmcd.nmcd.rc.bottom) return LRESULT.NULL; |
|---|
| | 390 | if (!OS.IsWindowVisible (handle)) return LRESULT.NULL; |
|---|
| 389 | 391 | if ((style & DWT.FULL_SELECTION) !is 0 || findImageControl () !is null || ignoreDrawSelection || explorerTheme) { |
|---|
| 390 | 392 | OS.SetBkMode (hDC, OS.TRANSPARENT); |
|---|
| 391 | 393 | } |
|---|
| 392 | 394 | bool selected = isItemSelected (nmcd); |
|---|
| 393 | | bool hot = explorerTheme && (nmcd.uItemState & OS.CDIS_HOT) !is 0; |
|---|
| | 395 | bool hot = explorerTheme && (nmcd.nmcd.uItemState & OS.CDIS_HOT) !is 0; |
|---|
| 394 | 396 | if (OS.IsWindowEnabled (handle)) { |
|---|
| 395 | 397 | if (explorerTheme) { |
|---|
| … | … | |
| 406 | 408 | int count = 0; |
|---|
| 407 | 409 | int [] order = null; |
|---|
| 408 | | RECT clientRect = new RECT (); |
|---|
| 409 | | OS.GetClientRect (scrolledHandle (), clientRect); |
|---|
| 410 | | if (hwndHeader !is 0) { |
|---|
| 411 | | OS.MapWindowPoints (hwndParent, handle, clientRect, 2); |
|---|
| | 410 | RECT clientRect; |
|---|
| | 411 | OS.GetClientRect (scrolledHandle (), &clientRect); |
|---|
| | 412 | if (hwndHeader !is null) { |
|---|
| | 413 | OS.MapWindowPoints (hwndParent, handle, cast(POINT*) &clientRect, 2); |
|---|
| 412 | 414 | count = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0); |
|---|
| 413 | 415 | if (count !is 0) { |
|---|
| 414 | 416 | order = new int [count]; |
|---|
| 415 | | OS.SendMessage (hwndHeader, OS.HDM_GETORDERARRAY, count, order); |
|---|
| | 417 | OS.SendMessage (hwndHeader, OS.HDM_GETORDERARRAY, count, cast(int) order.ptr); |
|---|
| 416 | 418 | } |
|---|
| 417 | 419 | } |
|---|
| … | … | |
| 428 | 430 | Point size = null; |
|---|
| 429 | 431 | for (int i=0; i<Math.max (1, count); i++) { |
|---|
| 430 | | int index = order is null ? i : order [i], width = nmcd.right - nmcd.left; |
|---|
| 431 | | if (count > 0 && hwndHeader !is 0) { |
|---|
| 432 | | HDITEM hdItem = new HDITEM (); |
|---|
| | 432 | int index = order is null ? i : order [i], width = nmcd.nmcd.rc.right - nmcd.nmcd.rc.left; |
|---|
| | 433 | if (count > 0 && hwndHeader !is null) { |
|---|
| | 434 | HDITEM hdItem; |
|---|
| 433 | 435 | hdItem.mask = OS.HDI_WIDTH; |
|---|
| 434 | | OS.SendMessage (hwndHeader, OS.HDM_GETITEM, index, hdItem); |
|---|
| | 436 | OS.SendMessage (hwndHeader, OS.HDM_GETITEM, index, &hdItem); |
|---|
| 435 | 437 | width = hdItem.cxy; |
|---|
| 436 | 438 | } |
|---|
| … | … | |
| 440 | 442 | if (clear || (selected && !ignoreDrawSelection) || (hot && !ignoreDrawHot)) { |
|---|
| 441 | 443 | bool draw = true; |
|---|
| 442 | | RECT pClipRect = new RECT (); |
|---|
| 443 | | OS.SetRect (pClipRect, width, nmcd.top, nmcd.right, nmcd.bottom); |
|---|
| | 444 | RECT pClipRect; |
|---|
| | 445 | OS.SetRect (&pClipRect, width, nmcd.nmcd.rc.top, nmcd.nmcd.rc.right, nmcd.nmcd.rc.bottom); |
|---|
| 444 | 446 | if (explorerTheme) { |
|---|
| 445 | 447 | if (hooks (DWT.EraseItem)) { |
|---|
| … | … | |
| 449 | 451 | pClipRect.left = itemRect.left; |
|---|
| 450 | 452 | pClipRect.right = itemRect.right; |
|---|
| 451 | | if (count > 0 && hwndHeader !is 0) { |
|---|
| 452 | | HDITEM hdItem = new HDITEM (); |
|---|
| | 453 | if (count > 0 && hwndHeader !is null) { |
|---|
| | 454 | HDITEM hdItem; |
|---|
| 453 | 455 | hdItem.mask = OS.HDI_WIDTH; |
|---|
| 454 | | OS.SendMessage (hwndHeader, OS.HDM_GETITEM, index, hdItem); |
|---|
| 455 | | pClipRect.right = Math.min (pClipRect.right, nmcd.left + hdItem.cxy); |
|---|
| | 456 | OS.SendMessage (hwndHeader, OS.HDM_GETITEM, index, &hdItem); |
|---|
| | 457 | pClipRect.right = Math.min (pClipRect.right, nmcd.nmcd.rc.left + hdItem.cxy); |
|---|
| 456 | 458 | } |
|---|
| 457 | 459 | } |
|---|
| 458 | | RECT pRect = new RECT (); |
|---|
| 459 | | OS.SetRect (pRect, nmcd.left, nmcd.top, nmcd.right, nmcd.bottom); |
|---|
| 460 | | if (count > 0 && hwndHeader !is 0) { |
|---|
| | 460 | RECT pRect; |
|---|
| | 461 | OS.SetRect (&pRect, nmcd.nmcd.rc.left, nmcd.nmcd.rc.top, nmcd.nmcd.rc.right, nmcd.nmcd.rc.bottom); |
|---|
| | 462 | if (count > 0 && hwndHeader !is null) { |
|---|
| 461 | 463 | int totalWidth = 0; |
|---|
| 462 | | HDITEM hdItem = new HDITEM (); |
|---|
| | 464 | HDITEM hdItem; |
|---|
| 463 | 465 | hdItem.mask = OS.HDI_WIDTH; |
|---|
| 464 | 466 | for (int j=0; j<count; j++) { |
|---|
| 465 | | OS.SendMessage (hwndHeader, OS.HDM_GETITEM, j, hdItem); |
|---|
| | 467 | OS.SendMessage (hwndHeader, OS.HDM_GETITEM, j, &hdItem); |
|---|
| 466 | 468 | totalWidth += hdItem.cxy; |
|---|
| 467 | 469 | } |
|---|
| … | … | |
| 475 | 477 | } |
|---|
| 476 | 478 | draw = false; |
|---|
| 477 | | int hTheme = OS.OpenThemeData (handle, Display.TREEVIEW); |
|---|
| | 479 | auto hTheme = OS.OpenThemeData (handle, cast(TCHAR*) Display.TREEVIEW); |
|---|
| 478 | 480 | int iStateId = selected ? OS.TREIS_SELECTED : OS.TREIS_HOT; |
|---|
| 479 | 481 | if (OS.GetFocus () !is handle && selected && !hot) iStateId = OS.TREIS_SELECTEDNOTFOCUS; |
|---|
| 480 | | OS.DrawThemeBackground (hTheme, hDC, OS.TVP_TREEITEM, iStateId, pRect, pClipRect); |
|---|
| | 482 | OS.DrawThemeBackground (hTheme, hDC, OS.TVP_TREEITEM, iStateId, &pRect, &pClipRect); |
|---|
| 481 | 483 | OS.CloseThemeData (hTheme); |
|---|
| 482 | 484 | } |
|---|
| 483 | | if (draw) fillBackground (hDC, OS.GetBkColor (hDC), pClipRect); |
|---|
| | 485 | if (draw) fillBackground (hDC, OS.GetBkColor (hDC), &pClipRect); |
|---|
| 484 | 486 | } |
|---|
| 485 | 487 | } else { |
|---|
| … | … | |
| 492 | 494 | pClipRect.left -= EXPLORER_EXTRA; |
|---|
| 493 | 495 | pClipRect.right += EXPLORER_EXTRA; |
|---|
| 494 | | int hTheme = OS.OpenThemeData (handle, Display.TREEVIEW); |
|---|
| | 496 | auto hTheme = OS.OpenThemeData (handle, cast(TCHAR*) Display.TREEVIEW); |
|---|
| 495 | 497 | int iStateId = selected ? OS.TREIS_SELECTED : OS.TREIS_HOT; |
|---|
| 496 | 498 | if (OS.GetFocus () !is handle && selected && !hot) iStateId = OS.TREIS_SELECTEDNOTFOCUS; |
|---|
| 497 | | OS.DrawThemeBackground (hTheme, hDC, OS.TVP_TREEITEM, iStateId, pRect, pClipRect); |
|---|
| | 499 | OS.DrawThemeBackground (hTheme, hDC, OS.TVP_TREEITEM, iStateId, &pRect, &pClipRect); |
|---|
| 498 | 500 | OS.CloseThemeData (hTheme); |
|---|
| 499 | 501 | } |
|---|
| … | … | |
| 502 | 504 | } |
|---|
| 503 | 505 | if (x + width > clientRect.left) { |
|---|
| 504 | | RECT rect = new RECT (), backgroundRect = null; |
|---|
| | 506 | RECT rect; |
|---|
| | 507 | RECT* backgroundRect = null; |
|---|
| | 508 | RECT rectTmp; |
|---|
| 505 | 509 | bool drawItem = true, drawText = true, drawImage = true, drawBackground = false; |
|---|
| 506 | 510 | if (i is 0) { |
|---|
| … | … | |
| 526 | 530 | gc.setClipping (iconRect.left, iconRect.top, iconRect.right - iconRect.left, iconRect.bottom - iconRect.top); |
|---|
| 527 | 531 | gc.drawImage (image, 0, 0, bounds.width, bounds.height, iconRect.left, iconRect.top, size.x, size.y); |
|---|
| 528 | | OS.SelectClipRgn (hDC, 0); |
|---|
| | 532 | OS.SelectClipRgn (hDC, null); |
|---|
| 529 | 533 | gc.dispose (); |
|---|
| 530 | 534 | } |
|---|
| … | … | |
| 541 | 545 | } |
|---|
| 542 | 546 | if (selected && !ignoreDrawSelection && !ignoreDrawBackground) { |
|---|
| 543 | | if (!explorerTheme) fillBackground (hDC, OS.GetBkColor (hDC), rect); |
|---|
| | 547 | if (!explorerTheme) fillBackground (hDC, OS.GetBkColor (hDC), &rect); |
|---|
| 544 | 548 | drawBackground = false; |
|---|
| 545 | 549 | } |
|---|
| 546 | | backgroundRect = rect; |
|---|
| | 550 | backgroundRect = ▭ |
|---|
| 547 | 551 | if (hooks (DWT.EraseItem)) { |
|---|
| 548 | 552 | drawItem = drawText = drawImage = true; |
|---|
| 549 | 553 | rect = item.getBounds (index, true, true, false, false, true, hDC); |
|---|
| 550 | 554 | if ((style & DWT.FULL_SELECTION) !is 0) { |
|---|
| 551 | | backgroundRect = rect; |
|---|
| | 555 | backgroundRect = ▭ |
|---|
| 552 | 556 | } else { |
|---|
| 553 | | backgroundRect = item.getBounds (index, true, false, false, false, true, hDC); |
|---|
| | 557 | rectTmp = item.getBounds (index, true, false, false, false, true, hDC); |
|---|
| | 558 | backgroundRect = &rectTmp; |
|---|
| 554 | 559 | } |
|---|
| 555 | 560 | } |
|---|
| … | … | |
| 557 | 562 | selectionForeground = -1; |
|---|
| 558 | 563 | ignoreDrawForeground = ignoreDrawBackground = ignoreDrawSelection = ignoreDrawFocus = ignoreDrawHot = false; |
|---|
| 559 | | OS.SetRect (rect, x, nmcd.top, x + width, nmcd.bottom); |
|---|
| 560 | | backgroundRect = rect; |
|---|
| | 564 | OS.SetRect (&rect, x, nmcd.nmcd.rc.top, x + width, nmcd.nmcd.rc.bottom); |
|---|
| | 565 | backgroundRect = ▭ |
|---|
| 561 | 566 | } |
|---|
| 562 | 567 | int clrText = -1, clrTextBk = -1; |
|---|
| 563 | | int hFont = item.cellFont !is null ? item.cellFont [index] : -1; |
|---|
| 564 | | if (hFont is -1) hFont = item.font; |
|---|
| | 568 | HFONT hFont = item.cellFont !is null ? item.cellFont [index] : cast(HFONT)-1; |
|---|
| | 569 | if (hFont is cast(HFONT)-1) hFont = item.font; |
|---|
| 565 | 570 | if (selectionForeground !is -1) clrText = selectionForeground; |
|---|
| 566 | 571 | if (OS.IsWindowEnabled (handle)) { |
|---|
| … | … | |
| 591 | 596 | } |
|---|
| 592 | 597 | if (explorerTheme) { |
|---|
| 593 | | if (selected || (nmcd.uItemState & OS.CDIS_HOT) !is 0) { |
|---|
| | 598 | if (selected || (nmcd.nmcd.uItemState & OS.CDIS_HOT) !is 0) { |
|---|
| 594 | 599 | if ((style & DWT.FULL_SELECTION) !is 0) { |
|---|
| 595 | 600 | drawBackground = false; |
|---|
| … | … | |
| 651 | 656 | if (!explorerTheme) { |
|---|
| 652 | 657 | //if ((nmcd.uItemState & OS.CDIS_FOCUS) !is 0) { |
|---|
| 653 | | if (OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0) is nmcd.dwItemSpec) { |
|---|
| | 658 | if (OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0) is nmcd.nmcd.dwItemSpec) { |
|---|
| 654 | 659 | if (handle is OS.GetFocus ()) { |
|---|
| 655 | 660 | int uiState = OS.SendMessage (handle, OS.WM_QUERYUISTATE, 0, 0); |
|---|
| … | … | |
| 697 | 702 | } |
|---|
| 698 | 703 | if (!ignoreFullSelection && index is count - 1) { |
|---|
| 699 | | RECT selectionRect = new RECT (); |
|---|
| 700 | | OS.SetRect (selectionRect, backgroundRect.left, backgroundRect.top, nmcd.right, backgroundRect.bottom); |
|---|
| | 704 | RECT* selectionRect = new RECT (); |
|---|
| | 705 | OS.SetRect (selectionRect, backgroundRect.left, backgroundRect.top, nmcd.nmcd.rc.right, backgroundRect.bottom); |
|---|
| 701 | 706 | backgroundRect = selectionRect; |
|---|
| 702 | 707 | } |
|---|
| 703 | 708 | } else { |
|---|
| 704 | | RECT pRect = new RECT (); |
|---|
| 705 | | OS.SetRect (pRect, nmcd.left, nmcd.top, nmcd.right, nmcd.bottom); |
|---|
| 706 | | if (count > 0 && hwndHeader !is 0) { |
|---|
| | 709 | RECT pRect; |
|---|
| | 710 | OS.SetRect (&pRect, nmcd.nmcd.rc.left, nmcd.nmcd.rc.top, nmcd.nmcd.rc.right, nmcd.nmcd.rc.bottom); |
|---|
| | 711 | if (count > 0 && hwndHeader !is null) { |
|---|
| 707 | 712 | int totalWidth = 0; |
|---|
| 708 | | HDITEM hdItem = new HDITEM (); |
|---|
| | 713 | HDITEM hdItem; |
|---|
| 709 | 714 | hdItem.mask = OS.HDI_WIDTH; |
|---|
| 710 | 715 | for (int j=0; j<count; j++) { |
|---|
| 711 | | OS.SendMessage (hwndHeader, OS.HDM_GETITEM, j, hdItem); |
|---|
| | 716 | OS.SendMessage (hwndHeader, OS.HDM_GETITEM, j, &hdItem); |
|---|
| 712 | 717 | totalWidth += hdItem.cxy; |
|---|
| 713 | 718 | } |
|---|
| … | … | |
| 720 | 725 | } |
|---|
| 721 | 726 | if (index is count - 1) { |
|---|
| 722 | | RECT selectionRect = new RECT (); |
|---|
| | 727 | RECT* selectionRect = new RECT (); |
|---|
| 723 | 728 | OS.SetRect (selectionRect, backgroundRect.left, backgroundRect.top, pRect.right, backgroundRect.bottom); |
|---|
| 724 | 729 | backgroundRect = selectionRect; |
|---|
| 725 | 730 | } |
|---|
| 726 | 731 | } |
|---|
| 727 | | int hTheme = OS.OpenThemeData (handle, Display.TREEVIEW); |
|---|
| | 732 | auto hTheme = OS.OpenThemeData (handle, cast(TCHAR*) Display.TREEVIEW); |
|---|
| 728 | 733 | int iStateId = selected ? OS.TREIS_SELECTED : OS.TREIS_HOT; |
|---|
| 729 | 734 | if (OS.GetFocus () !is handle && selected && !hot) iStateId = OS.TREIS_SELECTEDNOTFOCUS; |
|---|
| 730 | | OS.DrawThemeBackground (hTheme, hDC, OS.TVP_TREEITEM, iStateId, pRect, backgroundRect); |
|---|
| | 735 | OS.DrawThemeBackground (hTheme, hDC, OS.TVP_TREEITEM, iStateId, &pRect, backgroundRect); |
|---|
| 731 | 736 | OS.CloseThemeData (hTheme); |
|---|
| 732 | 737 | } |
|---|
| … | … | |
| 756 | 761 | if (i is 0) { |
|---|
| 757 | 762 | int right = Math.min (rect.right, width); |
|---|
| 758 | | OS.SetRect (rect, rect.left, rect.top, right, rect.bottom); |
|---|
| 759 | | if (drawBackground) fillImageBackground (hDC, control, rect); |
|---|
| | 763 | OS.SetRect (&rect, rect.left, rect.top, right, rect.bottom); |
|---|
| | 764 | if (drawBackground) fillImageBackground (hDC, control, &rect); |
|---|
| 760 | 765 | } else { |
|---|
| 761 | | if (drawBackground) fillImageBackground (hDC, control, rect); |
|---|
| | 766 | if (drawBackground) fillImageBackground (hDC, control, &rect); |
|---|
| 762 | 767 | } |
|---|
| 763 | 768 | } |
|---|
| … | … | |
| 791 | 796 | gc.dispose (); |
|---|
| 792 | 797 | } |
|---|
| 793 | | OS.SetRect (rect, rect.left + size.x + offset, rect.top, rect.right - inset, rect.bottom); |
|---|
| | 798 | OS.SetRect (&rect, rect.left + size.x + offset, rect.top, rect.right - inset, rect.bottom); |
|---|
| 794 | 799 | } else { |
|---|
| 795 | 800 | if (i is 0) { |
|---|
| … | … | |
| 799 | 804 | } |
|---|
| 800 | 805 | } else { |
|---|
| 801 | | OS.SetRect (rect, rect.left + offset, rect.top, rect.right - inset, rect.bottom); |
|---|
| | 806 | OS.SetRect (&rect, rect.left + offset, rect.top, rect.right - inset, rect.bottom); |
|---|
| 802 | 807 | } |
|---|
| 803 | 808 | } |
|---|
| … | … | |
| 819 | 824 | } |
|---|
| 820 | 825 | if (string !is null) { |
|---|
| 821 | | if (hFont !is -1) hFont = OS.SelectObject (hDC, hFont); |
|---|
| | 826 | if (hFont !is cast(HFONT)-1) hFont = OS.SelectObject (hDC, hFont); |
|---|
| 822 | 827 | if (clrText !is -1) clrText = OS.SetTextColor (hDC, clrText); |
|---|
| 823 | 828 | if (clrTextBk !is -1) clrTextBk = OS.SetBkColor (hDC, clrTextBk); |
|---|
| … | … | |
| 829 | 834 | if ((column.style & DWT.RIGHT) !is 0) flags |= OS.DT_RIGHT; |
|---|
| 830 | 835 | } |
|---|
| 831 | | TCHAR buffer = new TCHAR (getCodePage (), string, false); |
|---|
| 832 | | if (!ignoreDrawForeground) OS.DrawText (hDC, buffer, buffer.length (), rect, flags); |
|---|
| 833 | | OS.DrawText (hDC, buffer, buffer.length (), rect, flags | OS.DT_CALCRECT); |
|---|
| 834 | | if (hFont !is -1) hFont = OS.SelectObject (hDC, hFont); |
|---|
| | 836 | TCHAR[] buffer = StrToTCHARs (getCodePage (), string, false); |
|---|
| | 837 | if (!ignoreDrawForeground) OS.DrawText (hDC, buffer.ptr, buffer.length, &rect, flags); |
|---|
| | 838 | OS.DrawText (hDC, buffer.ptr, buffer.length, &rect, flags | OS.DT_CALCRECT); |
|---|
| | 839 | if (hFont !is cast(HFONT)-1) hFont = OS.SelectObject (hDC, hFont); |
|---|
| 835 | 840 | if (clrText !is -1) clrText = OS.SetTextColor (hDC, clrText); |
|---|
| 836 | 841 | if (clrTextBk !is -1) clrTextBk = OS.SetBkColor (hDC, clrTextBk); |
|---|
| … | … | |
| 868 | 873 | if (!explorerTheme) { |
|---|
| 869 | 874 | //if ((nmcd.uItemState & OS.CDIS_FOCUS) !is 0) { |
|---|
| 870 | | if (OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0) is nmcd.dwItemSpec) { |
|---|
| | 875 | if (OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0) is nmcd.nmcd.dwItemSpec) { |
|---|
| 871 | 876 | if (i is 0 /*nmcd.iSubItem is 0*/ || (style & DWT.FULL_SELECTION) !is 0) { |
|---|
| 872 | 877 | if (handle is OS.GetFocus ()) { |
|---|
| … | … | |
| 897 | 902 | if (linesVisible) { |
|---|
| 898 | 903 | if ((style & DWT.FULL_SELECTION) !is 0) { |
|---|
| 899 | | if (hwndHeader !is 0) { |
|---|
| | 904 | if (hwndHeader !is null) { |
|---|
| 900 | 905 | if (OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0) !is 0) { |
|---|
| 901 | | HDITEM hdItem = new HDITEM (); |
|---|
| | 906 | HDITEM hdItem; |
|---|
| 902 | 907 | hdItem.mask = OS.HDI_WIDTH; |
|---|
| 903 | | OS.SendMessage (hwndHeader, OS.HDM_GETITEM, 0, hdItem); |
|---|
| 904 | | RECT rect = new RECT (); |
|---|
| 905 | | OS.SetRect (rect, nmcd.left + hdItem.cxy, nmcd.top, nmcd.right, nmcd.bottom); |
|---|
| 906 | | OS.DrawEdge (hDC, rect, OS.BDR_SUNKENINNER, OS.BF_BOTTOM); |
|---|
| 907 | | } |
|---|
| 908 | | } |
|---|
| 909 | | } |
|---|
| 910 | | RECT rect = new RECT (); |
|---|
| 911 | | OS.SetRect (rect, nmcd.left, nmcd.top, nmcd.right, nmcd.bottom); |
|---|
| 912 | | OS.DrawEdge (hDC, rect, OS.BDR_SUNKENINNER, OS.BF_BOTTOM); |
|---|
| | 908 | OS.SendMessage (hwndHeader, OS.HDM_GETITEM, 0, &hdItem); |
|---|
| | 909 | RECT rect; |
|---|
| | 910 | OS.SetRect (&rect, nmcd.nmcd.rc.left + hdItem.cxy, nmcd.nmcd.rc.top, nmcd.nmcd.rc.right, nmcd.nmcd.rc.bottom); |
|---|
| | 911 | OS.DrawEdge (hDC, &rect, OS.BDR_SUNKENINNER, OS.BF_BOTTOM); |
|---|
| | 912 | } |
|---|
| | 913 | } |
|---|
| | 914 | } |
|---|
| | 915 | RECT rect; |
|---|
| | 916 | OS.SetRect (&rect, nmcd.nmcd.rc.left, nmcd.nmcd.rc.top, nmcd.nmcd.rc.right, nmcd.nmcd.rc.bottom); |
|---|
| | 917 | OS.DrawEdge (hDC, &rect, OS.BDR_SUNKENINNER, OS.BF_BOTTOM); |
|---|
| 913 | 918 | } |
|---|
| 914 | 919 | if (!explorerTheme) { |
|---|
| … | … | |
| 916 | 921 | int uiState = OS.SendMessage (handle, OS.WM_QUERYUISTATE, 0, 0); |
|---|
| 917 | 922 | if ((uiState & OS.UISF_HIDEFOCUS) is 0) { |
|---|
| 918 | | int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0); |
|---|
| | 923 | auto hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0); |
|---|
| 919 | 924 | if (hItem is item.handle) { |
|---|
| 920 | 925 | if (!ignoreDrawFocus && findImageControl () !is null) { |
|---|
| 921 | 926 | if ((style & DWT.FULL_SELECTION) !is 0) { |
|---|
| 922 | | RECT focusRect = new RECT (); |
|---|
| 923 | | OS.SetRect (focusRect, nmcd.left, nmcd.top, nmcd.right, nmcd.bottom); |
|---|
| 924 | | if (count > 0 && hwndHeader !is 0) { |
|---|
| | 927 | RECT focusRect; |
|---|
| | 928 | OS.SetRect (&focusRect, nmcd.nmcd.rc.left, nmcd.nmcd.rc.top, nmcd.nmcd.rc.right, nmcd.nmcd.rc.bottom); |
|---|
| | 929 | if (count > 0 && hwndHeader !is null) { |
|---|
| 925 | 930 | int width = 0; |
|---|
| 926 | | HDITEM hdItem = new HDITEM (); |
|---|
| | 931 | HDITEM hdItem; |
|---|
| 927 | 932 | hdItem.mask = OS.HDI_WIDTH; |
|---|
| 928 | 933 | for (int j=0; j<count; j++) { |
|---|
| 929 | | OS.SendMessage (hwndHeader, OS.HDM_GETITEM, j, hdItem); |
|---|
| | 934 | OS.SendMessage (hwndHeader, OS.HDM_GETITEM, j, &hdItem); |
|---|
| 930 | 935 | width += hdItem.cxy; |
|---|
| 931 | 936 | } |
|---|
| 932 | 937 | focusRect.left = 0; |
|---|
| 933 | | RECT rect = new RECT (); |
|---|
| 934 | | OS.GetClientRect (handle, rect); |
|---|
| | 938 | RECT rect; |
|---|
| | 939 | OS.GetClientRect (handle, &rect); |
|---|
| 935 | 940 | focusRect.right = Math.max (width, rect.right - OS.GetSystemMetrics (OS.SM_CXVSCROLL)); |
|---|
| 936 | 941 | } |
|---|
| 937 | | OS.DrawFocusRect (hDC, focusRect); |
|---|
| | 942 | OS.DrawFocusRect (hDC, &focusRect); |
|---|
| 938 | 943 | } else { |
|---|
| 939 | 944 | int index = OS.SendMessage (hwndHeader, OS.HDM_ORDERTOINDEX, 0, 0); |
|---|
| … | … | |
| 941 | 946 | RECT clipRect = item.getBounds (index, true, false, false, false, true, hDC); |
|---|
| 942 | 947 | OS.IntersectClipRect (hDC, clipRect.left, clipRect.top, clipRect.right, clipRect.bottom); |
|---|
| 943 | | OS.DrawFocusRect (hDC, focusRect); |
|---|
| 944 | | OS.SelectClipRgn (hDC, 0); |
|---|
| | 948 | OS.DrawFocusRect (hDC, &focusRect); |
|---|
| | 949 | OS.SelectClipRgn (hDC, null); |
|---|
| 945 | 950 | } |
|---|
| 946 | 951 | } |
|---|
| … | … | |
| 949 | 954 | } |
|---|
| 950 | 955 | } |
|---|
| 951 | | return new LRESULT (OS.CDRF_DODEFAULT); |
|---|
| 952 | | } |
|---|
| 953 | | |
|---|
| 954 | | LRESULT CDDS_ITEMPREPAINT (NMTVCUSTOMDRAW nmcd, int wParam, int lParam) { |
|---|
| | 956 | return cast(LRESULT) (OS.CDRF_DODEFAULT); |
|---|
| | 957 | } |
|---|
| | 958 | |
|---|
| | 959 | LRESULT CDDS_ITEMPREPAINT (NMTVCUSTOMDRAW* nmcd, int wParam, int lParam) { |
|---|
| 955 | 960 | /* |
|---|
| 956 | 961 | * Even when custom draw is being ignored, the font needs |
|---|
| … | … | |
| 969 | 974 | * COMCTL32.DLL, |
|---|
| 970 | 975 | */ |
|---|
| 971 | | if (item is null) return null; |
|---|
| 972 | | int hDC = nmcd.hdc; |
|---|
| 973 | | int index = hwndHeader !is 0 ? OS.SendMessage (hwndHeader, OS.HDM_ORDERTOINDEX, 0, 0) : 0; |
|---|
| 974 | | int hFont = item.cellFont !is null ? item.cellFont [index] : -1; |
|---|
| 975 | | if (hFont is -1) hFont = item.font; |
|---|
| 976 | | if (hFont !is -1) OS.SelectObject (hDC, hFont); |
|---|
| 977 | | if (ignoreCustomDraw || nmcd.left is nmcd.right) { |
|---|
| 978 | | return new LRESULT (hFont is -1 ? OS.CDRF_DODEFAULT : OS.CDRF_NEWFONT); |
|---|
| | 976 | if (item is null) return LRESULT.NULL; |
|---|
| | 977 | auto hDC = nmcd.nmcd.hdc; |
|---|
| | 978 | int index = hwndHeader !is null ? OS.SendMessage (hwndHeader, OS.HDM_ORDERTOINDEX, 0, 0) : 0; |
|---|
| | 979 | HFONT hFont = item.cellFont !is null ? item.cellFont [index] : cast(HFONT)-1; |
|---|
| | 980 | if (hFont is cast(HFONT)-1) hFont = item.font; |
|---|
| | 981 | if (hFont !is cast(HFONT)-1) OS.SelectObject (hDC, hFont); |
|---|
| | 982 | if (ignoreCustomDraw || nmcd.nmcd.rc.left is nmcd.nmcd.rc.right) { |
|---|
| | 983 | return cast(LRESULT) (hFont is cast(HFONT)-1 ? OS.CDRF_DODEFAULT : OS.CDRF_NEWFONT); |
|---|
| 979 | 984 | } |
|---|
| 980 | 985 | int count = 0; |
|---|
| 981 | | RECT clipRect = null; |
|---|
| 982 | | if (hwndHeader !is 0) { |
|---|
| | 986 | RECT* clipRect = null; |
|---|
| | 987 | if (hwndHeader !is null) { |
|---|
| 983 | 988 | count = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0); |
|---|
| 984 | 989 | if (count !is 0) { |
|---|
| … | … | |
| 989 | 994 | if (clip) { |
|---|
| 990 | 995 | clipRect = new RECT (); |
|---|
| 991 | | HDITEM hdItem = new HDITEM (); |
|---|
| | 996 | HDITEM hdItem; |
|---|
| 992 | 997 | hdItem.mask = OS.HDI_WIDTH; |
|---|
| 993 | | OS.SendMessage (hwndHeader, OS.HDM_GETITEM, index, hdItem); |
|---|
| 994 | | OS.SetRect (clipRect, nmcd.left, nmcd.top, nmcd.left + hdItem.cxy, nmcd.bottom); |
|---|
| | 998 | OS.SendMessage (hwndHeader, OS.HDM_GETITEM, index, &hdItem); |
|---|
| | 999 | OS.SetRect (clipRect, nmcd.nmcd.rc.left, nmcd.nmcd.rc.top, nmcd.nmcd.rc.left + hdItem.cxy, nmcd.nmcd.rc.bottom); |
|---|
| 995 | 1000 | } |
|---|
| 996 | 1001 | } |
|---|
| … | … | |
| 1015 | 1020 | } |
|---|
| 1016 | 1021 | bool selected = isItemSelected (nmcd); |
|---|
| 1017 | | bool hot = explorerTheme && (nmcd.uItemState & OS.CDIS_HOT) !is 0; |
|---|
| 1018 | | if (OS.IsWindowVisible (handle) && nmcd.left < nmcd.right && nmcd.top < nmcd.bottom) { |
|---|
| 1019 | | if (hFont !is -1) OS.SelectObject (hDC, hFont); |
|---|
| | 1022 | bool hot = explorerTheme && (nmcd.nmcd.uItemState & OS.CDIS_HOT) !is 0; |
|---|
| | 1023 | if (OS.IsWindowVisible (handle) && nmcd.nmcd.rc.left < nmcd.nmcd.rc.right && nmcd.nmcd.rc.top < nmcd.nmcd.rc.bottom) { |
|---|
| | 1024 | if (hFont !is cast(HFONT)-1) OS.SelectObject (hDC, hFont); |
|---|
| 1020 | 1025 | if (linesVisible) { |
|---|
| 1021 | | RECT rect = new RECT (); |
|---|
| 1022 | | OS.SetRect (rect, nmcd.left, nmcd.top, nmcd.right, nmcd.bottom); |
|---|
| 1023 | | OS.DrawEdge (hDC, rect, OS.BDR_SUNKENINNER, OS.BF_BOTTOM); |
|---|
| | 1026 | RECT rect; |
|---|
| | 1027 | OS.SetRect (&rect, nmcd.nmcd.rc.left, nmcd.nmcd.rc.top, nmcd.nmcd.rc.right, nmcd.nmcd.rc.bottom); |
|---|
| | 1028 | OS.DrawEdge (hDC, &rect, OS.BDR_SUNKENINNER, OS.BF_BOTTOM); |
|---|
| 1024 | 1029 | } |
|---|
| 1025 | 1030 | //TODO - BUG - measure and erase sent when first column is clipped |
|---|
| … | … | |
| 1043 | 1048 | gc.dispose (); |
|---|
| 1044 | 1049 | OS.RestoreDC (hDC, nSavedDC); |
|---|
| 1045 | | if (isDisposed () || item.isDisposed ()) return null; |
|---|
| 1046 | | if (hwndHeader !is 0) { |
|---|
| | 1050 | if (isDisposed () || item.isDisposed ()) return LRESULT.NULL; |
|---|
| | 1051 | if (hwndHeader !is null) { |
|---|
| 1047 | 1052 | if (count is 0) { |
|---|
| 1048 | 1053 | if (event.x + event.width > scrollWidth) { |
|---|
| … | … | |
| 1056 | 1061 | ignoreDrawForeground = ignoreDrawBackground = ignoreDrawSelection = ignoreDrawFocus = ignoreDrawHot = ignoreFullSelection = false; |
|---|
| 1057 | 1062 | if (hooks (DWT.EraseItem)) { |
|---|
| 1058 | | RECT rect = new RECT (); |
|---|
| 1059 | | OS.SetRect (rect, nmcd.left, nmcd.top, nmcd.right, nmcd.bottom); |
|---|
| | 1063 | RECT rect; |
|---|
| | 1064 | OS.SetRect (&rect, nmcd.nmcd.rc.left, nmcd.nmcd.rc.top, nmcd.nmcd.rc.right, nmcd.nmcd.rc.bottom); |
|---|
| 1060 | 1065 | if (OS.IsWindowEnabled (handle) || findImageControl () !is null) { |
|---|
| 1061 | | drawBackground (hDC, rect); |
|---|
| | 1066 | drawBackground (hDC, &rect); |
|---|
| 1062 | 1067 | } else { |
|---|
| 1063 | | fillBackground (hDC, OS.GetBkColor (hDC), rect); |
|---|
| | 1068 | fillBackground (hDC, OS.GetBkColor (hDC), &rect); |
|---|
| 1064 | 1069 | } |
|---|
| 1065 | 1070 | RECT cellRect = item.getBounds (index, true, true, true, true, true, hDC); |
|---|
| 1066 | 1071 | if (clrSortBk !is -1) { |
|---|
| 1067 | 1072 | RECT fullRect = item.getBounds (index, true, true, true, true, true, hDC); |
|---|
| 1068 | | drawBackground (hDC, fullRect, clrSortBk); |
|---|
| | 1073 | drawBackground (hDC, &fullRect, clrSortBk); |
|---|
| 1069 | 1074 | } |
|---|
| 1070 | 1075 | int nSavedDC = OS.SaveDC (hDC); |
|---|
| … | … | |
| 1082 | 1087 | } |
|---|
| 1083 | 1088 | data.uiState = OS.SendMessage (handle, OS.WM_QUERYUISTATE, 0, 0); |
|---|
| 1084 | | if (hFont !is -1) data.hFont = hFont; |
|---|
| | 1089 | if (hFont !is cast(HFONT)-1) data.hFont = hFont; |
|---|
| 1085 | 1090 | GC gc = GC.win32_new (hDC, data); |
|---|
| 1086 | 1091 | Event event = new Event (); |
|---|
| … | … | |
| 1094 | 1099 | if (!explorerTheme) { |
|---|
| 1095 | 1100 | //if ((nmcd.uItemState & OS.CDIS_FOCUS) !is 0) { |
|---|
| 1096 | | if (OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0) is nmcd.dwItemSpec) { |
|---|
| | 1101 | if (OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0) is nmcd.nmcd.dwItemSpec) { |
|---|
| 1097 | 1102 | if (handle is OS.GetFocus ()) { |
|---|
| 1098 | 1103 | int uiState = OS.SendMessage (handle, OS.WM_QUERYUISTATE, 0, 0); |
|---|
| … | … | |
| 1111 | 1116 | gc.dispose (); |
|---|
| 1112 | 1117 | OS.RestoreDC (hDC, nSavedDC); |
|---|
| 1113 | | if (isDisposed () || item.isDisposed ()) return null; |
|---|
| | 1118 | if (isDisposed () || item.isDisposed ()) return LRESULT.NULL; |
|---|
| 1114 | 1119 | if (event.doit) { |
|---|
| 1115 | 1120 | ignoreDrawForeground = (event.detail & DWT.FOREGROUND) is 0; |
|---|
| … | … | |
| 1128 | 1133 | if (count is 0) { |
|---|
| 1129 | 1134 | if ((style & DWT.FULL_SELECTION) !is 0) { |
|---|
| 1130 | | fillBackground (hDC, clrTextBk, rect); |
|---|
| | 1135 | fillBackground (hDC, clrTextBk, &rect); |
|---|
| 1131 | 1136 | } else { |
|---|
| 1132 | 1137 | RECT textRect = item.getBounds (index, true, false, true, false, true, hDC); |
|---|
| 1133 | | fillBackground (hDC, clrTextBk, textRect); |
|---|
| | 1138 | fillBackground (hDC, clrTextBk, &textRect); |
|---|
| 1134 | 1139 | } |
|---|
| 1135 | 1140 | } else { |
|---|
| 1136 | | fillBackground (hDC, clrTextBk, cellRect); |
|---|
| | 1141 | fillBackground (hDC, clrTextBk, &cellRect); |
|---|
| 1137 | 1142 | } |
|---|
| 1138 | 1143 | } |
|---|
| … | … | |
| 1153 | 1158 | if ((style & DWT.FULL_SELECTION) !is 0) { |
|---|
| 1154 | 1159 | if ((style & DWT.FULL_SELECTION) !is 0 && count is 0) { |
|---|
| 1155 | | fillBackground (hDC, OS.GetBkColor (hDC), rect); |
|---|
| | 1160 | fillBackground (hDC, OS.GetBkColor (hDC), &rect); |
|---|
| 1156 | 1161 | } else { |
|---|
| 1157 | | & |
|---|