Mercurial > projects > dwt-win
comparison dwt/widgets/Tree.d @ 108:6f75fdfa1bcd
Change LRESULT to class, like done in the old DWT.
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 11 Feb 2008 02:44:32 +0100 |
parents | 43c42c637c9c |
children | f353be82b6be |
comparison
equal
deleted
inserted
replaced
106:e4a62cdcd2e0 | 108:6f75fdfa1bcd |
---|---|
369 override HWND borderHandle () { | 369 override HWND borderHandle () { |
370 return hwndParent !is null ? hwndParent : handle; | 370 return hwndParent !is null ? hwndParent : handle; |
371 } | 371 } |
372 | 372 |
373 LRESULT CDDS_ITEMPOSTPAINT (NMTVCUSTOMDRAW* nmcd, int wParam, int lParam) { | 373 LRESULT CDDS_ITEMPOSTPAINT (NMTVCUSTOMDRAW* nmcd, int wParam, int lParam) { |
374 if (ignoreCustomDraw) return LRESULT.NULL; | 374 if (ignoreCustomDraw) return null; |
375 if (nmcd.nmcd.rc.left is nmcd.nmcd.rc.right) return cast(LRESULT) (OS.CDRF_DODEFAULT); | 375 if (nmcd.nmcd.rc.left is nmcd.nmcd.rc.right) return new LRESULT (OS.CDRF_DODEFAULT); |
376 auto hDC = nmcd.nmcd.hdc; | 376 auto hDC = nmcd.nmcd.hdc; |
377 OS.RestoreDC (hDC, -1); | 377 OS.RestoreDC (hDC, -1); |
378 TreeItem item = getItem (nmcd); | 378 TreeItem item = getItem (nmcd); |
379 | 379 |
380 /* | 380 /* |
385 * fix is to check for null. | 385 * fix is to check for null. |
386 * | 386 * |
387 * NOTE: This only happens on XP with the version 6.00 of | 387 * NOTE: This only happens on XP with the version 6.00 of |
388 * COMCTL32.DLL, | 388 * COMCTL32.DLL, |
389 */ | 389 */ |
390 if (item is null) return LRESULT.NULL; | 390 if (item is null) return null; |
391 | 391 |
392 /* | 392 /* |
393 * Feature in Windows. Under certain circumstances, Windows | 393 * Feature in Windows. Under certain circumstances, Windows |
394 * sends CDDS_ITEMPOSTPAINT for an empty rectangle. This is | 394 * sends CDDS_ITEMPOSTPAINT for an empty rectangle. This is |
395 * not a problem providing that graphics do not occur outside | 395 * not a problem providing that graphics do not occur outside |
398 * | 398 * |
399 * NOTE: This seems to happen when both I_IMAGECALLBACK | 399 * NOTE: This seems to happen when both I_IMAGECALLBACK |
400 * and LPSTR_TEXTCALLBACK are used at the same time with | 400 * and LPSTR_TEXTCALLBACK are used at the same time with |
401 * TVM_SETITEM. | 401 * TVM_SETITEM. |
402 */ | 402 */ |
403 if (nmcd.nmcd.rc.left >= nmcd.nmcd.rc.right || nmcd.nmcd.rc.top >= nmcd.nmcd.rc.bottom) return LRESULT.NULL; | 403 if (nmcd.nmcd.rc.left >= nmcd.nmcd.rc.right || nmcd.nmcd.rc.top >= nmcd.nmcd.rc.bottom) return null; |
404 if (!OS.IsWindowVisible (handle)) return LRESULT.NULL; | 404 if (!OS.IsWindowVisible (handle)) return null; |
405 if ((style & DWT.FULL_SELECTION) !is 0 || findImageControl () !is null || ignoreDrawSelection || explorerTheme) { | 405 if ((style & DWT.FULL_SELECTION) !is 0 || findImageControl () !is null || ignoreDrawSelection || explorerTheme) { |
406 OS.SetBkMode (hDC, OS.TRANSPARENT); | 406 OS.SetBkMode (hDC, OS.TRANSPARENT); |
407 } | 407 } |
408 bool selected = isItemSelected (nmcd); | 408 bool selected = isItemSelected (nmcd); |
409 bool hot = explorerTheme && (nmcd.nmcd.uItemState & OS.CDIS_HOT) !is 0; | 409 bool hot = explorerTheme && (nmcd.nmcd.uItemState & OS.CDIS_HOT) !is 0; |
965 } | 965 } |
966 } | 966 } |
967 } | 967 } |
968 } | 968 } |
969 } | 969 } |
970 return cast(LRESULT) (OS.CDRF_DODEFAULT); | 970 return new LRESULT (OS.CDRF_DODEFAULT); |
971 } | 971 } |
972 | 972 |
973 LRESULT CDDS_ITEMPREPAINT (NMTVCUSTOMDRAW* nmcd, int wParam, int lParam) { | 973 LRESULT CDDS_ITEMPREPAINT (NMTVCUSTOMDRAW* nmcd, int wParam, int lParam) { |
974 /* | 974 /* |
975 * Even when custom draw is being ignored, the font needs | 975 * Even when custom draw is being ignored, the font needs |
985 * fix is to check for null. | 985 * fix is to check for null. |
986 * | 986 * |
987 * NOTE: This only happens on XP with the version 6.00 of | 987 * NOTE: This only happens on XP with the version 6.00 of |
988 * COMCTL32.DLL, | 988 * COMCTL32.DLL, |
989 */ | 989 */ |
990 if (item is null) return LRESULT.NULL; | 990 if (item is null) return null; |
991 auto hDC = nmcd.nmcd.hdc; | 991 auto hDC = nmcd.nmcd.hdc; |
992 int index = hwndHeader !is null ? OS.SendMessage (hwndHeader, OS.HDM_ORDERTOINDEX, 0, 0) : 0; | 992 int index = hwndHeader !is null ? OS.SendMessage (hwndHeader, OS.HDM_ORDERTOINDEX, 0, 0) : 0; |
993 HFONT hFont = item.cellFont !is null ? item.cellFont [index] : cast(HFONT)-1; | 993 HFONT hFont = item.cellFont !is null ? item.cellFont [index] : cast(HFONT)-1; |
994 if (hFont is cast(HFONT)-1) hFont = item.font; | 994 if (hFont is cast(HFONT)-1) hFont = item.font; |
995 if (hFont !is cast(HFONT)-1) OS.SelectObject (hDC, hFont); | 995 if (hFont !is cast(HFONT)-1) OS.SelectObject (hDC, hFont); |
996 if (ignoreCustomDraw || nmcd.nmcd.rc.left is nmcd.nmcd.rc.right) { | 996 if (ignoreCustomDraw || nmcd.nmcd.rc.left is nmcd.nmcd.rc.right) { |
997 return cast(LRESULT) (hFont is cast(HFONT)-1 ? OS.CDRF_DODEFAULT : OS.CDRF_NEWFONT); | 997 return new LRESULT (hFont is cast(HFONT)-1 ? OS.CDRF_DODEFAULT : OS.CDRF_NEWFONT); |
998 } | 998 } |
999 int count = 0; | 999 int count = 0; |
1000 RECT* clipRect = null; | 1000 RECT* clipRect = null; |
1001 if (hwndHeader !is null) { | 1001 if (hwndHeader !is null) { |
1002 count = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0); | 1002 count = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0); |
1059 event.height = itemRect.bottom - itemRect.top; | 1059 event.height = itemRect.bottom - itemRect.top; |
1060 sendEvent (DWT.MeasureItem, event); | 1060 sendEvent (DWT.MeasureItem, event); |
1061 event.gc = null; | 1061 event.gc = null; |
1062 gc.dispose (); | 1062 gc.dispose (); |
1063 OS.RestoreDC (hDC, nSavedDC); | 1063 OS.RestoreDC (hDC, nSavedDC); |
1064 if (isDisposed () || item.isDisposed ()) return LRESULT.NULL; | 1064 if (isDisposed () || item.isDisposed ()) return null; |
1065 if (hwndHeader !is null) { | 1065 if (hwndHeader !is null) { |
1066 if (count is 0) { | 1066 if (count is 0) { |
1067 if (event.x + event.width > scrollWidth) { | 1067 if (event.x + event.width > scrollWidth) { |
1068 setScrollWidth (scrollWidth = event.x + event.width); | 1068 setScrollWidth (scrollWidth = event.x + event.width); |
1069 } | 1069 } |
1127 sendEvent (DWT.EraseItem, event); | 1127 sendEvent (DWT.EraseItem, event); |
1128 event.gc = null; | 1128 event.gc = null; |
1129 int newTextClr = data.foreground; | 1129 int newTextClr = data.foreground; |
1130 gc.dispose (); | 1130 gc.dispose (); |
1131 OS.RestoreDC (hDC, nSavedDC); | 1131 OS.RestoreDC (hDC, nSavedDC); |
1132 if (isDisposed () || item.isDisposed ()) return LRESULT.NULL; | 1132 if (isDisposed () || item.isDisposed ()) return null; |
1133 if (event.doit) { | 1133 if (event.doit) { |
1134 ignoreDrawForeground = (event.detail & DWT.FOREGROUND) is 0; | 1134 ignoreDrawForeground = (event.detail & DWT.FOREGROUND) is 0; |
1135 ignoreDrawBackground = (event.detail & DWT.BACKGROUND) is 0; | 1135 ignoreDrawBackground = (event.detail & DWT.BACKGROUND) is 0; |
1136 ignoreDrawSelection = (event.detail & DWT.SELECTED) is 0; | 1136 ignoreDrawSelection = (event.detail & DWT.SELECTED) is 0; |
1137 ignoreDrawFocus = (event.detail & DWT.FOCUSED) is 0; | 1137 ignoreDrawFocus = (event.detail & DWT.FOCUSED) is 0; |
1219 if (linesVisible) itemRect.bottom++; | 1219 if (linesVisible) itemRect.bottom++; |
1220 if (clipRect !is null) { | 1220 if (clipRect !is null) { |
1221 OS.IntersectClipRect (hDC, clipRect.left, clipRect.top, clipRect.right, clipRect.bottom); | 1221 OS.IntersectClipRect (hDC, clipRect.left, clipRect.top, clipRect.right, clipRect.bottom); |
1222 } | 1222 } |
1223 OS.ExcludeClipRect (hDC, itemRect.left, itemRect.top, itemRect.right, itemRect.bottom); | 1223 OS.ExcludeClipRect (hDC, itemRect.left, itemRect.top, itemRect.right, itemRect.bottom); |
1224 return cast(LRESULT) (OS.CDRF_DODEFAULT | OS.CDRF_NOTIFYPOSTPAINT); | 1224 return new LRESULT (OS.CDRF_DODEFAULT | OS.CDRF_NOTIFYPOSTPAINT); |
1225 } | 1225 } |
1226 /* | 1226 /* |
1227 * Feature in Windows. When the tree has the style | 1227 * Feature in Windows. When the tree has the style |
1228 * TVS_FULLROWSELECT, the background color for the | 1228 * TVS_FULLROWSELECT, the background color for the |
1229 * entire row is filled when an item is painted, | 1229 * entire row is filled when an item is painted, |
1243 nmcd.nmcd.uItemState &= ~OS.CDIS_FOCUS; | 1243 nmcd.nmcd.uItemState &= ~OS.CDIS_FOCUS; |
1244 OS.MoveMemory (cast(void*)lParam, nmcd, NMTVCUSTOMDRAW.sizeof); | 1244 OS.MoveMemory (cast(void*)lParam, nmcd, NMTVCUSTOMDRAW.sizeof); |
1245 } | 1245 } |
1246 } | 1246 } |
1247 } | 1247 } |
1248 LRESULT result = LRESULT.NULL; | 1248 LRESULT result = null; |
1249 if (clrText is -1 && clrTextBk is -1 && hFont is cast(HFONT)-1) { | 1249 if (clrText is -1 && clrTextBk is -1 && hFont is cast(HFONT)-1) { |
1250 result = cast(LRESULT) (OS.CDRF_DODEFAULT | OS.CDRF_NOTIFYPOSTPAINT); | 1250 result = new LRESULT (OS.CDRF_DODEFAULT | OS.CDRF_NOTIFYPOSTPAINT); |
1251 } else { | 1251 } else { |
1252 result = cast(LRESULT) (OS.CDRF_NEWFONT | OS.CDRF_NOTIFYPOSTPAINT); | 1252 result = new LRESULT (OS.CDRF_NEWFONT | OS.CDRF_NOTIFYPOSTPAINT); |
1253 if (hFont !is cast(HFONT)-1) OS.SelectObject (hDC, hFont); | 1253 if (hFont !is cast(HFONT)-1) OS.SelectObject (hDC, hFont); |
1254 if (OS.IsWindowEnabled (handle) && OS.IsWindowVisible (handle)) { | 1254 if (OS.IsWindowEnabled (handle) && OS.IsWindowVisible (handle)) { |
1255 /* | 1255 /* |
1256 * Feature in Windows. Windows does not fill the entire cell | 1256 * Feature in Windows. Windows does not fill the entire cell |
1257 * with the background color when TVS_FULLROWSELECT is not set. | 1257 * with the background color when TVS_FULLROWSELECT is not set. |
1372 } | 1372 } |
1373 return result; | 1373 return result; |
1374 } | 1374 } |
1375 | 1375 |
1376 LRESULT CDDS_POSTPAINT (NMTVCUSTOMDRAW* nmcd, int wParam, int lParam) { | 1376 LRESULT CDDS_POSTPAINT (NMTVCUSTOMDRAW* nmcd, int wParam, int lParam) { |
1377 if (ignoreCustomDraw) return LRESULT.NULL; | 1377 if (ignoreCustomDraw) return null; |
1378 if (OS.IsWindowVisible (handle)) { | 1378 if (OS.IsWindowVisible (handle)) { |
1379 if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) { | 1379 if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) { |
1380 if (sortColumn !is null && sortDirection !is DWT.NONE) { | 1380 if (sortColumn !is null && sortDirection !is DWT.NONE) { |
1381 if (findImageControl () is null) { | 1381 if (findImageControl () is null) { |
1382 int index = indexOf (sortColumn); | 1382 int index = indexOf (sortColumn); |
1479 OS.SetRect (&rect, rect.left, top, rect.right, top + height); | 1479 OS.SetRect (&rect, rect.left, top, rect.right, top + height); |
1480 OS.DrawEdge (hDC, &rect, OS.BDR_SUNKENINNER, OS.BF_BOTTOM); | 1480 OS.DrawEdge (hDC, &rect, OS.BDR_SUNKENINNER, OS.BF_BOTTOM); |
1481 } | 1481 } |
1482 } | 1482 } |
1483 } | 1483 } |
1484 return cast(LRESULT) (OS.CDRF_DODEFAULT); | 1484 return new LRESULT (OS.CDRF_DODEFAULT); |
1485 } | 1485 } |
1486 | 1486 |
1487 LRESULT CDDS_PREPAINT (NMTVCUSTOMDRAW* nmcd, int wParam, int lParam) { | 1487 LRESULT CDDS_PREPAINT (NMTVCUSTOMDRAW* nmcd, int wParam, int lParam) { |
1488 if (explorerTheme) { | 1488 if (explorerTheme) { |
1489 if ((OS.IsWindowEnabled (handle) && hooks (DWT.EraseItem)) || findImageControl () !is null) { | 1489 if ((OS.IsWindowEnabled (handle) && hooks (DWT.EraseItem)) || findImageControl () !is null) { |
1490 RECT rect; | 1490 RECT rect; |
1491 OS.SetRect (&rect, nmcd.nmcd.rc.left, nmcd.nmcd.rc.top, nmcd.nmcd.rc.right, nmcd.nmcd.rc.bottom); | 1491 OS.SetRect (&rect, nmcd.nmcd.rc.left, nmcd.nmcd.rc.top, nmcd.nmcd.rc.right, nmcd.nmcd.rc.bottom); |
1492 drawBackground (nmcd.nmcd.hdc, &rect); | 1492 drawBackground (nmcd.nmcd.hdc, &rect); |
1493 } | 1493 } |
1494 } | 1494 } |
1495 return cast(LRESULT) (OS.CDRF_NOTIFYITEMDRAW | OS.CDRF_NOTIFYPOSTPAINT); | 1495 return new LRESULT (OS.CDRF_NOTIFYITEMDRAW | OS.CDRF_NOTIFYPOSTPAINT); |
1496 } | 1496 } |
1497 | 1497 |
1498 override LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam) { | 1498 override int callWindowProc (HWND hwnd, int msg, int wParam, int lParam) { |
1499 if (handle is null) return LRESULT.NULL; | 1499 if (handle is null) return 0; |
1500 if (hwndParent !is null && hwnd is hwndParent) { | 1500 if (hwndParent !is null && hwnd is hwndParent) { |
1501 return cast(LRESULT) OS.DefWindowProc (hwnd, msg, wParam, lParam); | 1501 return OS.DefWindowProc (hwnd, msg, wParam, lParam); |
1502 } | 1502 } |
1503 if (hwndHeader !is null && hwnd is hwndHeader) { | 1503 if (hwndHeader !is null && hwnd is hwndHeader) { |
1504 return cast(LRESULT) OS.CallWindowProc (HeaderProc, hwnd, msg, wParam, lParam); | 1504 return OS.CallWindowProc (HeaderProc, hwnd, msg, wParam, lParam); |
1505 } | 1505 } |
1506 switch (msg) { | 1506 switch (msg) { |
1507 case OS.WM_SETFOCUS: { | 1507 case OS.WM_SETFOCUS: { |
1508 /* | 1508 /* |
1509 * Feature in Windows. When a tree control processes WM_SETFOCUS, | 1509 * Feature in Windows. When a tree control processes WM_SETFOCUS, |
1653 case OS.WM_PAINT: | 1653 case OS.WM_PAINT: |
1654 painted = true; | 1654 painted = true; |
1655 break; | 1655 break; |
1656 default: | 1656 default: |
1657 } | 1657 } |
1658 return cast(LRESULT) code; | 1658 return code; |
1659 } | 1659 } |
1660 | 1660 |
1661 override void checkBuffered () { | 1661 override void checkBuffered () { |
1662 super.checkBuffered (); | 1662 super.checkBuffered (); |
1663 if ((style & DWT.VIRTUAL) !is 0) { | 1663 if ((style & DWT.VIRTUAL) !is 0) { |
5378 updateScrollBar (); | 5378 updateScrollBar (); |
5379 return code; | 5379 return code; |
5380 } | 5380 } |
5381 case OS.WM_NCPAINT: { | 5381 case OS.WM_NCPAINT: { |
5382 LRESULT result = wmNCPaint (hwnd, wParam, lParam); | 5382 LRESULT result = wmNCPaint (hwnd, wParam, lParam); |
5383 if (result !is LRESULT.NULL) return result; | 5383 if (result !is null) return result.value; |
5384 break; | 5384 break; |
5385 } | 5385 } |
5386 case OS.WM_PRINT: { | 5386 case OS.WM_PRINT: { |
5387 LRESULT result = wmPrint (hwnd, wParam, lParam); | 5387 LRESULT result = wmPrint (hwnd, wParam, lParam); |
5388 if (result !is LRESULT.NULL) return result; | 5388 if (result !is null) return result.value; |
5389 break; | 5389 break; |
5390 } | 5390 } |
5391 case OS.WM_COMMAND: | 5391 case OS.WM_COMMAND: |
5392 case OS.WM_NOTIFY: | 5392 case OS.WM_NOTIFY: |
5393 case OS.WM_SYSCOLORCHANGE: { | 5393 case OS.WM_SYSCOLORCHANGE: { |
5427 } | 5427 } |
5428 OS.SetScrollInfo (handle, OS.SB_VERT, &info, true); | 5428 OS.SetScrollInfo (handle, OS.SB_VERT, &info, true); |
5429 int code = OS.SendMessage (handle, OS.WM_VSCROLL, wParam, lParam); | 5429 int code = OS.SendMessage (handle, OS.WM_VSCROLL, wParam, lParam); |
5430 OS.GetScrollInfo (handle, OS.SB_VERT, &info); | 5430 OS.GetScrollInfo (handle, OS.SB_VERT, &info); |
5431 OS.SetScrollInfo (hwndParent, OS.SB_VERT, &info, true); | 5431 OS.SetScrollInfo (hwndParent, OS.SB_VERT, &info, true); |
5432 return cast(LRESULT)code; | 5432 return code; |
5433 } | 5433 } |
5434 default: | 5434 default: |
5435 } | 5435 } |
5436 return callWindowProc (hwnd, msg, wParam, lParam); | 5436 return callWindowProc (hwnd, msg, wParam, lParam); |
5437 } | 5437 } |
5438 return super.windowProc (hwnd, msg, wParam, lParam); | 5438 return super.windowProc (hwnd, msg, wParam, lParam); |
5439 } | 5439 } |
5440 | 5440 |
5441 override LRESULT WM_CHAR (int wParam, int lParam) { | 5441 override LRESULT WM_CHAR (int wParam, int lParam) { |
5442 LRESULT result = super.WM_CHAR (wParam, lParam); | 5442 LRESULT result = super.WM_CHAR (wParam, lParam); |
5443 if (result !is LRESULT.NULL) return result; | 5443 if (result !is null) return result; |
5444 /* | 5444 /* |
5445 * Feature in Windows. The tree control beeps | 5445 * Feature in Windows. The tree control beeps |
5446 * in WM_CHAR when the search for the item that | 5446 * in WM_CHAR when the search for the item that |
5447 * matches the key stroke fails. This is the | 5447 * matches the key stroke fails. This is the |
5448 * standard tree behavior but is unexpected when | 5448 * standard tree behavior but is unexpected when |
5545 return super.WM_GETOBJECT (wParam, lParam); | 5545 return super.WM_GETOBJECT (wParam, lParam); |
5546 } | 5546 } |
5547 | 5547 |
5548 override LRESULT WM_KEYDOWN (int wParam, int lParam) { | 5548 override LRESULT WM_KEYDOWN (int wParam, int lParam) { |
5549 LRESULT result = super.WM_KEYDOWN (wParam, lParam); | 5549 LRESULT result = super.WM_KEYDOWN (wParam, lParam); |
5550 if (result !is LRESULT.NULL) return result; | 5550 if (result !is null) return result; |
5551 switch (wParam) { | 5551 switch (wParam) { |
5552 case OS.VK_SPACE: | 5552 case OS.VK_SPACE: |
5553 /* | 5553 /* |
5554 * Ensure that the window proc does not process VK_SPACE | 5554 * Ensure that the window proc does not process VK_SPACE |
5555 * so that it can be handled in WM_CHAR. This allows the | 5555 * so that it can be handled in WM_CHAR. This allows the |
5622 tvItem.hItem = hNewItem; | 5622 tvItem.hItem = hNewItem; |
5623 OS.SendMessage (handle, OS.TVM_GETITEM, 0, &tvItem); | 5623 OS.SendMessage (handle, OS.TVM_GETITEM, 0, &tvItem); |
5624 Event event = new Event (); | 5624 Event event = new Event (); |
5625 event.item = _getItem (hNewItem, tvItem.lParam); | 5625 event.item = _getItem (hNewItem, tvItem.lParam); |
5626 postEvent (DWT.Selection, event); | 5626 postEvent (DWT.Selection, event); |
5627 return cast(LRESULT) (code); | 5627 return new LRESULT (code); |
5628 } | 5628 } |
5629 } | 5629 } |
5630 if (OS.GetKeyState (OS.VK_CONTROL) < 0) { | 5630 if (OS.GetKeyState (OS.VK_CONTROL) < 0) { |
5631 HANDLE hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0); | 5631 HANDLE hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0); |
5632 if (hItem !is null) { | 5632 if (hItem !is null) { |
5716 } | 5716 } |
5717 } | 5717 } |
5718 } | 5718 } |
5719 int code = callWindowProc (handle, OS.WM_KEYDOWN, wParam, lParam); | 5719 int code = callWindowProc (handle, OS.WM_KEYDOWN, wParam, lParam); |
5720 hAnchor = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0); | 5720 hAnchor = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0); |
5721 return cast(LRESULT) (code); | 5721 return new LRESULT (code); |
5722 } | 5722 } |
5723 default: | 5723 default: |
5724 } | 5724 } |
5725 return result; | 5725 return result; |
5726 } | 5726 } |
5876 if (deselected) { | 5876 if (deselected) { |
5877 Event event = new Event (); | 5877 Event event = new Event (); |
5878 event.item = _getItem (lpht.hItem); | 5878 event.item = _getItem (lpht.hItem); |
5879 postEvent (DWT.Selection, event); | 5879 postEvent (DWT.Selection, event); |
5880 } | 5880 } |
5881 return cast(LRESULT) (code); | 5881 return new LRESULT (code); |
5882 } | 5882 } |
5883 | 5883 |
5884 /* Look for check/uncheck */ | 5884 /* Look for check/uncheck */ |
5885 if ((style & DWT.CHECK) !is 0) { | 5885 if ((style & DWT.CHECK) !is 0) { |
5886 if ((lpht.flags & OS.TVHT_ONITEMSTATEICON) !is 0) { | 5886 if ((lpht.flags & OS.TVHT_ONITEMSTATEICON) !is 0) { |
5937 } | 5937 } |
5938 int code = callWindowProc (handle, OS.WM_LBUTTONDOWN, wParam, lParam); | 5938 int code = callWindowProc (handle, OS.WM_LBUTTONDOWN, wParam, lParam); |
5939 if (!display.captureChanged && !isDisposed ()) { | 5939 if (!display.captureChanged && !isDisposed ()) { |
5940 if (OS.GetCapture () !is handle) OS.SetCapture (handle); | 5940 if (OS.GetCapture () !is handle) OS.SetCapture (handle); |
5941 } | 5941 } |
5942 return cast(LRESULT) (code); | 5942 return new LRESULT (code); |
5943 } | 5943 } |
5944 } | 5944 } |
5945 | 5945 |
5946 /* Get the selected state of the item under the mouse */ | 5946 /* Get the selected state of the item under the mouse */ |
5947 TVITEM tvItem; | 5947 TVITEM tvItem; |
6170 if ((bits & OS.TVS_DISABLEDRAGDROP) is 0) { | 6170 if ((bits & OS.TVS_DISABLEDRAGDROP) is 0) { |
6171 sendMouseEvent (DWT.MouseUp, 1, handle, OS.WM_LBUTTONUP, wParam, lParam); | 6171 sendMouseEvent (DWT.MouseUp, 1, handle, OS.WM_LBUTTONUP, wParam, lParam); |
6172 } | 6172 } |
6173 } | 6173 } |
6174 dragStarted = false; | 6174 dragStarted = false; |
6175 return cast(LRESULT) (code); | 6175 return new LRESULT (code); |
6176 } | 6176 } |
6177 | 6177 |
6178 override LRESULT WM_MOUSEMOVE (int wParam, int lParam) { | 6178 override LRESULT WM_MOUSEMOVE (int wParam, int lParam) { |
6179 Display display = this.display; | 6179 Display display = this.display; |
6180 LRESULT result = super.WM_MOUSEMOVE (wParam, lParam); | 6180 LRESULT result = super.WM_MOUSEMOVE (wParam, lParam); |
6181 if (result !is LRESULT.NULL) return result; | 6181 if (result !is null) return result; |
6182 if (itemToolTipHandle !is null && hwndHeader !is null) { | 6182 if (itemToolTipHandle !is null && hwndHeader !is null) { |
6183 /* | 6183 /* |
6184 * Bug in Windows. On some machines that do not have XBUTTONs, | 6184 * Bug in Windows. On some machines that do not have XBUTTONs, |
6185 * the MK_XBUTTON1 and OS.MK_XBUTTON2 bits are sometimes set, | 6185 * the MK_XBUTTON1 and OS.MK_XBUTTON2 bits are sometimes set, |
6186 * causing mouse capture to become stuck. The fix is to test | 6186 * causing mouse capture to become stuck. The fix is to test |
6240 } | 6240 } |
6241 return result; | 6241 return result; |
6242 } | 6242 } |
6243 | 6243 |
6244 override LRESULT WM_MOVE (int wParam, int lParam) { | 6244 override LRESULT WM_MOVE (int wParam, int lParam) { |
6245 if (ignoreResize) return LRESULT.NULL; | 6245 if (ignoreResize) return null; |
6246 return super.WM_MOVE (wParam, lParam); | 6246 return super.WM_MOVE (wParam, lParam); |
6247 } | 6247 } |
6248 | 6248 |
6249 override LRESULT WM_RBUTTONDOWN (int wParam, int lParam) { | 6249 override LRESULT WM_RBUTTONDOWN (int wParam, int lParam) { |
6250 /* | 6250 /* |
6388 return super.WM_PAINT (wParam, lParam); | 6388 return super.WM_PAINT (wParam, lParam); |
6389 } | 6389 } |
6390 | 6390 |
6391 override LRESULT WM_PRINTCLIENT (int wParam, int lParam) { | 6391 override LRESULT WM_PRINTCLIENT (int wParam, int lParam) { |
6392 LRESULT result = super.WM_PRINTCLIENT (wParam, lParam); | 6392 LRESULT result = super.WM_PRINTCLIENT (wParam, lParam); |
6393 if (result !is LRESULT.NULL) return result; | 6393 if (result !is null) return result; |
6394 /* | 6394 /* |
6395 * Feature in Windows. For some reason, when WM_PRINT is used | 6395 * Feature in Windows. For some reason, when WM_PRINT is used |
6396 * to capture an image of a hierarchy that contains a tree with | 6396 * to capture an image of a hierarchy that contains a tree with |
6397 * columns, the clipping that is used to stop the first column | 6397 * columns, the clipping that is used to stop the first column |
6398 * from drawing on top of subsequent columns stops the first | 6398 * from drawing on top of subsequent columns stops the first |
6402 * is happening in WM_PRINTCLIENT, the redrawing is not visible. | 6402 * is happening in WM_PRINTCLIENT, the redrawing is not visible. |
6403 */ | 6403 */ |
6404 printClient = true; | 6404 printClient = true; |
6405 int code = callWindowProc (handle, OS.WM_PRINTCLIENT, wParam, lParam); | 6405 int code = callWindowProc (handle, OS.WM_PRINTCLIENT, wParam, lParam); |
6406 printClient = false; | 6406 printClient = false; |
6407 return cast(LRESULT) (code); | 6407 return new LRESULT (code); |
6408 } | 6408 } |
6409 | 6409 |
6410 override LRESULT WM_SETFOCUS (int wParam, int lParam) { | 6410 override LRESULT WM_SETFOCUS (int wParam, int lParam) { |
6411 /* | 6411 /* |
6412 * Bug in Windows. When a tree item that has an image | 6412 * Bug in Windows. When a tree item that has an image |
6437 return super.WM_SETFOCUS (wParam, lParam); | 6437 return super.WM_SETFOCUS (wParam, lParam); |
6438 } | 6438 } |
6439 | 6439 |
6440 override LRESULT WM_SETFONT (int wParam, int lParam) { | 6440 override LRESULT WM_SETFONT (int wParam, int lParam) { |
6441 LRESULT result = super.WM_SETFONT (wParam, lParam); | 6441 LRESULT result = super.WM_SETFONT (wParam, lParam); |
6442 if (result !is LRESULT.NULL) return result; | 6442 if (result !is null) return result; |
6443 if (hwndHeader !is null) { | 6443 if (hwndHeader !is null) { |
6444 /* | 6444 /* |
6445 * Bug in Windows. When a header has a sort indicator | 6445 * Bug in Windows. When a header has a sort indicator |
6446 * triangle, Windows resizes the indicator based on the | 6446 * triangle, Windows resizes the indicator based on the |
6447 * size of the n-1th font. The fix is to always make | 6447 * size of the n-1th font. The fix is to always make |
6460 return result; | 6460 return result; |
6461 } | 6461 } |
6462 | 6462 |
6463 override LRESULT WM_SETREDRAW (int wParam, int lParam) { | 6463 override LRESULT WM_SETREDRAW (int wParam, int lParam) { |
6464 LRESULT result = super.WM_SETREDRAW (wParam, lParam); | 6464 LRESULT result = super.WM_SETREDRAW (wParam, lParam); |
6465 if (result !is LRESULT.NULL) return result; | 6465 if (result !is null) return result; |
6466 /* | 6466 /* |
6467 * Bug in Windows. Under certain circumstances, when | 6467 * Bug in Windows. Under certain circumstances, when |
6468 * WM_SETREDRAW is used to turn off drawing and then | 6468 * WM_SETREDRAW is used to turn off drawing and then |
6469 * TVM_GETITEMRECT is sent to get the bounds of an item | 6469 * TVM_GETITEMRECT is sent to get the bounds of an item |
6470 * that is not inside the client area, Windows segment | 6470 * that is not inside the client area, Windows segment |
6474 * NOTE: This problem is intermittent and happens on | 6474 * NOTE: This problem is intermittent and happens on |
6475 * Windows Vista running under the theme manager. | 6475 * Windows Vista running under the theme manager. |
6476 */ | 6476 */ |
6477 if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) { | 6477 if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) { |
6478 int code = OS.DefWindowProc (handle, OS.WM_SETREDRAW, wParam, lParam); | 6478 int code = OS.DefWindowProc (handle, OS.WM_SETREDRAW, wParam, lParam); |
6479 return code is 0 ? LRESULT.ZERO : cast(LRESULT) (code); | 6479 return code is 0 ? LRESULT.ZERO : new LRESULT (code); |
6480 } | 6480 } |
6481 return result; | 6481 return result; |
6482 } | 6482 } |
6483 | 6483 |
6484 override LRESULT WM_SIZE (int wParam, int lParam) { | 6484 override LRESULT WM_SIZE (int wParam, int lParam) { |
6504 if ((style & DWT.FULL_SELECTION) !is 0) { | 6504 if ((style & DWT.FULL_SELECTION) !is 0) { |
6505 OS.InvalidateRect (handle, null, false); | 6505 OS.InvalidateRect (handle, null, false); |
6506 } | 6506 } |
6507 } | 6507 } |
6508 } | 6508 } |
6509 if (ignoreResize) return LRESULT.NULL; | 6509 if (ignoreResize) return null; |
6510 return super.WM_SIZE (wParam, lParam); | 6510 return super.WM_SIZE (wParam, lParam); |
6511 } | 6511 } |
6512 | 6512 |
6513 override LRESULT WM_SYSCOLORCHANGE (int wParam, int lParam) { | 6513 override LRESULT WM_SYSCOLORCHANGE (int wParam, int lParam) { |
6514 LRESULT result = super.WM_SYSCOLORCHANGE (wParam, lParam); | 6514 LRESULT result = super.WM_SYSCOLORCHANGE (wParam, lParam); |
6515 if (result !is LRESULT.NULL) return result; | 6515 if (result !is null) return result; |
6516 /* | 6516 /* |
6517 * Bug in Windows. When the tree is using the explorer | 6517 * Bug in Windows. When the tree is using the explorer |
6518 * theme, it does not use COLOR_WINDOW_TEXT for the | 6518 * theme, it does not use COLOR_WINDOW_TEXT for the |
6519 * default foreground color. The fix is to explicitly | 6519 * default foreground color. The fix is to explicitly |
6520 * set the foreground. | 6520 * set the foreground. |
6529 override LRESULT wmColorChild (int wParam, int lParam) { | 6529 override LRESULT wmColorChild (int wParam, int lParam) { |
6530 if (findImageControl () !is null) { | 6530 if (findImageControl () !is null) { |
6531 if (OS.COMCTL32_MAJOR < 6) { | 6531 if (OS.COMCTL32_MAJOR < 6) { |
6532 return super.wmColorChild (wParam, lParam); | 6532 return super.wmColorChild (wParam, lParam); |
6533 } | 6533 } |
6534 return cast(LRESULT) (OS.GetStockObject (OS.NULL_BRUSH)); | 6534 return new LRESULT ( cast(int) OS.GetStockObject (OS.NULL_BRUSH)); |
6535 } | 6535 } |
6536 /* | 6536 /* |
6537 * Feature in Windows. Tree controls send WM_CTLCOLOREDIT | 6537 * Feature in Windows. Tree controls send WM_CTLCOLOREDIT |
6538 * to allow application code to change the default colors. | 6538 * to allow application code to change the default colors. |
6539 * This is undocumented and conflicts with TVM_SETTEXTCOLOR | 6539 * This is undocumented and conflicts with TVM_SETTEXTCOLOR |
6540 * and TVM_SETBKCOLOR, the documented way to do this. The | 6540 * and TVM_SETBKCOLOR, the documented way to do this. The |
6541 * fix is to ignore WM_CTLCOLOREDIT messages from trees. | 6541 * fix is to ignore WM_CTLCOLOREDIT messages from trees. |
6542 */ | 6542 */ |
6543 return LRESULT.NULL; | 6543 return null; |
6544 } | 6544 } |
6545 | 6545 |
6546 override LRESULT wmNotify (NMHDR* hdr, int wParam, int lParam) { | 6546 override LRESULT wmNotify (NMHDR* hdr, int wParam, int lParam) { |
6547 if (hdr.hwndFrom is itemToolTipHandle && hwndHeader !is null) { | 6547 if (hdr.hwndFrom is itemToolTipHandle && hwndHeader !is null) { |
6548 if (!OS.IsWinCE) { | 6548 if (!OS.IsWinCE) { |
6570 OS.SendMessage (handle, OS.TVM_HITTEST, 0, &lpht); | 6570 OS.SendMessage (handle, OS.TVM_HITTEST, 0, &lpht); |
6571 if (lpht.hItem !is null) { | 6571 if (lpht.hItem !is null) { |
6572 auto hDC = OS.GetDC (handle); | 6572 auto hDC = OS.GetDC (handle); |
6573 HFONT oldFont, newFont = cast(HFONT) OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); | 6573 HFONT oldFont, newFont = cast(HFONT) OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); |
6574 if (newFont !is null) oldFont = OS.SelectObject (hDC, newFont); | 6574 if (newFont !is null) oldFont = OS.SelectObject (hDC, newFont); |
6575 LRESULT result = LRESULT.NULL; | 6575 LRESULT result = null; |
6576 RECT rect; | 6576 RECT rect; |
6577 OS.GetClientRect (hwndParent, &rect); | 6577 OS.GetClientRect (hwndParent, &rect); |
6578 OS.MapWindowPoints (hwndParent, handle, cast(POINT*) &rect, 2); | 6578 OS.MapWindowPoints (hwndParent, handle, cast(POINT*) &rect, 2); |
6579 TreeItem item = _getItem (lpht.hItem); | 6579 TreeItem item = _getItem (lpht.hItem); |
6580 int index = 0, count = Math.max (1, OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0)); | 6580 int index = 0, count = Math.max (1, OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0)); |
6600 } | 6600 } |
6601 index++; | 6601 index++; |
6602 } | 6602 } |
6603 if (newFont !is null) OS.SelectObject (hDC, oldFont); | 6603 if (newFont !is null) OS.SelectObject (hDC, oldFont); |
6604 OS.ReleaseDC (handle, hDC); | 6604 OS.ReleaseDC (handle, hDC); |
6605 if (result !is LRESULT.NULL) return result; | 6605 if (result !is null) return result; |
6606 } | 6606 } |
6607 } | 6607 } |
6608 default: | 6608 default: |
6609 } | 6609 } |
6610 } | 6610 } |