diff options
author | Steve Northover <steve> | 2006-04-07 18:48:23 +0000 |
---|---|---|
committer | Steve Northover <steve> | 2006-04-07 18:48:23 +0000 |
commit | 35855a27f396111f75c3999b0ca44a13332a5e81 (patch) | |
tree | 03691f5f137c8fd65df0f2c2acb1204fda9a27fa /bundles | |
parent | 40f1c5f7d31e08753ce42641a6aa8235fd0a0a50 (diff) | |
download | eclipse.platform.swt-35855a27f396111f75c3999b0ca44a13332a5e81.tar.gz eclipse.platform.swt-35855a27f396111f75c3999b0ca44a13332a5e81.tar.xz eclipse.platform.swt-35855a27f396111f75c3999b0ca44a13332a5e81.zip |
Bug in Windows: TVN_ITEMEXPANDED does not run when all items are deleted in TVN_EXPANDING
Diffstat (limited to 'bundles')
-rwxr-xr-x | bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java | 50 |
1 files changed, 30 insertions, 20 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java index 31efef076d..a1d6be00c0 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java @@ -5890,28 +5890,9 @@ LRESULT wmNotifyChild (int wParam, int lParam) { } break; } - case OS.TVN_ITEMEXPANDEDA: - case OS.TVN_ITEMEXPANDEDW: { - if ((style & SWT.VIRTUAL) != 0) style |= SWT.DOUBLE_BUFFERED; - if (findImageControl () != null && drawCount == 0) { - OS.DefWindowProc (handle, OS.WM_SETREDRAW, 1, 0); - OS.InvalidateRect (handle, null, true); - } - /* - * Bug in Windows. When TVM_SETINSERTMARK is used to set - * an insert mark for a tree and an item is expanded or - * collapsed near the insert mark, the tree does not redraw - * the insert mark properly. The fix is to hide and show - * the insert mark whenever an item is expanded or collapsed. - */ - if (hInsert != 0) { - OS.SendMessage (handle, OS.TVM_SETINSERTMARK, insertAfter ? 1 : 0, hInsert); - } - updateScrollBar (); - break; - } case OS.TVN_ITEMEXPANDINGA: case OS.TVN_ITEMEXPANDINGW: { + boolean runExpanded = false; if ((style & SWT.VIRTUAL) != 0) style &= ~SWT.DOUBLE_BUFFERED; if (findImageControl () != null && drawCount == 0) { OS.DefWindowProc (handle, OS.WM_SETREDRAW, 0, 0); @@ -5964,7 +5945,36 @@ LRESULT wmNotifyChild (int wParam, int lParam) { if (isDisposed ()) return LRESULT.ZERO; break; } + /* + * Feature in Windows. When all of the items are deleted during + * TVN_ITEMEXPANDING, Windows does not send TVN_ITEMEXPANDED, + * even though the tree was expanded. The fix is to detect this + * case and runn the TVN_ITEMEXPANDED code. + */ + int hFirstItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CHILD, tvItem.hItem); + runExpanded = hFirstItem == 0; } + if (!runExpanded) break; + //FALL THROUGH + } + case OS.TVN_ITEMEXPANDEDA: + case OS.TVN_ITEMEXPANDEDW: { + if ((style & SWT.VIRTUAL) != 0) style |= SWT.DOUBLE_BUFFERED; + if (findImageControl () != null && drawCount == 0) { + OS.DefWindowProc (handle, OS.WM_SETREDRAW, 1, 0); + OS.InvalidateRect (handle, null, true); + } + /* + * Bug in Windows. When TVM_SETINSERTMARK is used to set + * an insert mark for a tree and an item is expanded or + * collapsed near the insert mark, the tree does not redraw + * the insert mark properly. The fix is to hide and show + * the insert mark whenever an item is expanded or collapsed. + */ + if (hInsert != 0) { + OS.SendMessage (handle, OS.TVM_SETINSERTMARK, insertAfter ? 1 : 0, hInsert); + } + updateScrollBar (); break; } case OS.TVN_BEGINDRAGA: |