Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti2006-09-07 19:28:00 +0000
committerSilenio Quarti2006-09-07 19:28:00 +0000
commitfa9ae5f305ec98a07a988f17c4baa0926044c5a4 (patch)
tree2b0791ce0515fd1e0f531ea3797522d0bbf96ca6
parent707a7d85b79caa7bc602716122fb2c419874d14a (diff)
downloadeclipse.platform.swt-fa9ae5f305ec98a07a988f17c4baa0926044c5a4.tar.gz
eclipse.platform.swt-fa9ae5f305ec98a07a988f17c4baa0926044c5a4.tar.xz
eclipse.platform.swt-fa9ae5f305ec98a07a988f17c4baa0926044c5a4.zip
back port to 3.2.1
151150 Multi Selection Tree only last 2 items are 'really' selected
-rw-r--r--bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.win32.OS.properties12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.h13
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_structs.c46
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_structs.h12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java3
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java39
9 files changed, 141 insertions, 4 deletions
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.win32.OS.properties b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.win32.OS.properties
index 0df6627e35..0ee0344109 100644
--- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.win32.OS.properties
+++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/org.eclipse.swt.internal.win32.OS.properties
@@ -583,6 +583,13 @@ NMTVDISPINFO_iSelectedImage=accessor=item.iSelectedImage
NMTVDISPINFO_cChildren=accessor=item.cChildren
NMTVDISPINFO_lParam=accessor=item.lParam
+org_eclipse_swt_internal_win32_NMTVITEMCHANGE=
+NMTVITEMCHANGE_uChanged=
+NMTVITEMCHANGE_hItem=cast=HTREEITEM
+NMTVITEMCHANGE_uStateNew=
+NMTVITEMCHANGE_uStateOld=
+NMTVITEMCHANGE_lParam=
+
org_eclipse_swt_internal_win32_NMUPDOWN=
NMUPDOWN_iPos=
NMUPDOWN_iDelta=
@@ -2732,6 +2739,11 @@ OS_MoveMemory__Lorg_eclipse_swt_internal_win32_NMTVDISPINFO_2II_0=cast=PVOID,fla
OS_MoveMemory__Lorg_eclipse_swt_internal_win32_NMTVDISPINFO_2II_1=cast=CONST VOID *
OS_MoveMemory__Lorg_eclipse_swt_internal_win32_NMTVDISPINFO_2II_2=
+OS_MoveMemory__Lorg_eclipse_swt_internal_win32_NMTVITEMCHANGE_2II=
+OS_MoveMemory__Lorg_eclipse_swt_internal_win32_NMTVITEMCHANGE_2II_0=cast=(PVOID),flags=no_in
+OS_MoveMemory__Lorg_eclipse_swt_internal_win32_NMTVITEMCHANGE_2II_1=cast=(CONST VOID *)
+OS_MoveMemory__Lorg_eclipse_swt_internal_win32_NMTVITEMCHANGE_2II_2=
+
OS_MoveMemory__Lorg_eclipse_swt_internal_win32_NMUPDOWN_2II=
OS_MoveMemory__Lorg_eclipse_swt_internal_win32_NMUPDOWN_2II_0=cast=(PVOID),flags=no_in
OS_MoveMemory__Lorg_eclipse_swt_internal_win32_NMUPDOWN_2II_1=cast=(CONST VOID *)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c
index 72078a4535..0cf1f4060c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c
@@ -7180,6 +7180,20 @@ fail:
}
#endif
+#ifndef NO_MoveMemory__Lorg_eclipse_swt_internal_win32_NMTVITEMCHANGE_2II
+JNIEXPORT void JNICALL OS_NATIVE(MoveMemory__Lorg_eclipse_swt_internal_win32_NMTVITEMCHANGE_2II)
+ (JNIEnv *env, jclass that, jobject arg0, jint arg1, jint arg2)
+{
+ NMTVITEMCHANGE _arg0, *lparg0=NULL;
+ OS_NATIVE_ENTER(env, that, MoveMemory__Lorg_eclipse_swt_internal_win32_NMTVITEMCHANGE_2II_FUNC);
+ if (arg0) if ((lparg0 = &_arg0) == NULL) goto fail;
+ MoveMemory((PVOID)lparg0, (CONST VOID *)arg1, arg2);
+fail:
+ if (arg0 && lparg0) setNMTVITEMCHANGEFields(env, arg0, lparg0);
+ OS_NATIVE_EXIT(env, that, MoveMemory__Lorg_eclipse_swt_internal_win32_NMTVITEMCHANGE_2II_FUNC);
+}
+#endif
+
#ifndef NO_MoveMemory__Lorg_eclipse_swt_internal_win32_NMUPDOWN_2II
JNIEXPORT void JNICALL OS_NATIVE(MoveMemory__Lorg_eclipse_swt_internal_win32_NMUPDOWN_2II)
(JNIEnv *env, jclass that, jobject arg0, jint arg1, jint arg2)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.h b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.h
index 8a3167b5a9..a65c3262de 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.h
@@ -72,6 +72,7 @@
#define NO_NMTTDISPINFO
#define NO_NMTTDISPINFOA
#define NO_NMTTDISPINFOW
+#define NO_NMTVITEMCHANGE
#define NO_NONCLIENTMETRICS
#define NO_NONCLIENTMETRICSA
#define NO_NONCLIENTMETRICSW
@@ -311,6 +312,7 @@
#define NO_MoveMemory__Lorg_eclipse_swt_internal_win32_NMTTDISPINFOW_2II
#define NO_MoveMemory__ILorg_eclipse_swt_internal_win32_NMTTDISPINFOA_2I
#define NO_MoveMemory__ILorg_eclipse_swt_internal_win32_NMTTDISPINFOW_2I
+#define NO_MoveMemory__ILorg_eclipse_swt_internal_win32_NMTVITEMCHANGE_2I
#define NO_MoveMemory__Lorg_eclipse_swt_internal_win32_LOGFONTA_2II
#define NO_MoveMemory__ILorg_eclipse_swt_internal_win32_LOGFONTA_2I
#define NO_MoveMemory__Lorg_eclipse_swt_internal_win32_SCRIPT_1ITEM_2II
@@ -490,6 +492,17 @@
#define TrackMouseEvent _TrackMouseEvent
+#if (_WIN32_IE <= 0x0600)
+typedef struct tagTVITEMCHANGE {
+ NMHDR hdr;
+ UINT uChanged;
+ HTREEITEM hItem;
+ UINT uStateNew;
+ UINT uStateOld;
+ LPARAM lParam;
+} NMTVITEMCHANGE;
+#endif /* _WIN32_IE <= 0x0600 */
+
#include "os_custom.h"
#endif /* INC_os_H */
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c
index 4974ed34cf..7ecbd9bef3 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c
@@ -14,8 +14,8 @@
#ifdef NATIVE_STATS
-int OS_nativeFunctionCount = 693;
-int OS_nativeFunctionCallCount[693];
+int OS_nativeFunctionCount = 694;
+int OS_nativeFunctionCallCount[694];
char * OS_nativeFunctionNames[] = {
"AbortDoc",
"ActivateActCtx",
@@ -454,6 +454,7 @@ char * OS_nativeFunctionNames[] = {
"MoveMemory__Lorg_eclipse_swt_internal_win32_NMTTDISPINFOW_2II",
"MoveMemory__Lorg_eclipse_swt_internal_win32_NMTVCUSTOMDRAW_2II",
"MoveMemory__Lorg_eclipse_swt_internal_win32_NMTVDISPINFO_2II",
+ "MoveMemory__Lorg_eclipse_swt_internal_win32_NMTVITEMCHANGE_2II",
"MoveMemory__Lorg_eclipse_swt_internal_win32_NMUPDOWN_2II",
"MoveMemory__Lorg_eclipse_swt_internal_win32_POINT_2II",
"MoveMemory__Lorg_eclipse_swt_internal_win32_SCRIPT_1ITEM_2II",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h
index b9a39fca32..15e00e86a9 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h
@@ -458,6 +458,7 @@ typedef enum {
MoveMemory__Lorg_eclipse_swt_internal_win32_NMTTDISPINFOW_2II_FUNC,
MoveMemory__Lorg_eclipse_swt_internal_win32_NMTVCUSTOMDRAW_2II_FUNC,
MoveMemory__Lorg_eclipse_swt_internal_win32_NMTVDISPINFO_2II_FUNC,
+ MoveMemory__Lorg_eclipse_swt_internal_win32_NMTVITEMCHANGE_2II_FUNC,
MoveMemory__Lorg_eclipse_swt_internal_win32_NMUPDOWN_2II_FUNC,
MoveMemory__Lorg_eclipse_swt_internal_win32_POINT_2II_FUNC,
MoveMemory__Lorg_eclipse_swt_internal_win32_SCRIPT_1ITEM_2II_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_structs.c b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_structs.c
index 2916fc3c60..f6f739ae38 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_structs.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_structs.c
@@ -3382,6 +3382,52 @@ void setNMTVDISPINFOFields(JNIEnv *env, jobject lpObject, NMTVDISPINFO *lpStruct
}
#endif
+#ifndef NO_NMTVITEMCHANGE
+typedef struct NMTVITEMCHANGE_FID_CACHE {
+ int cached;
+ jclass clazz;
+ jfieldID uChanged, hItem, uStateNew, uStateOld, lParam;
+} NMTVITEMCHANGE_FID_CACHE;
+
+NMTVITEMCHANGE_FID_CACHE NMTVITEMCHANGEFc;
+
+void cacheNMTVITEMCHANGEFields(JNIEnv *env, jobject lpObject)
+{
+ if (NMTVITEMCHANGEFc.cached) return;
+ cacheNMHDRFields(env, lpObject);
+ NMTVITEMCHANGEFc.clazz = (*env)->GetObjectClass(env, lpObject);
+ NMTVITEMCHANGEFc.uChanged = (*env)->GetFieldID(env, NMTVITEMCHANGEFc.clazz, "uChanged", "I");
+ NMTVITEMCHANGEFc.hItem = (*env)->GetFieldID(env, NMTVITEMCHANGEFc.clazz, "hItem", "I");
+ NMTVITEMCHANGEFc.uStateNew = (*env)->GetFieldID(env, NMTVITEMCHANGEFc.clazz, "uStateNew", "I");
+ NMTVITEMCHANGEFc.uStateOld = (*env)->GetFieldID(env, NMTVITEMCHANGEFc.clazz, "uStateOld", "I");
+ NMTVITEMCHANGEFc.lParam = (*env)->GetFieldID(env, NMTVITEMCHANGEFc.clazz, "lParam", "I");
+ NMTVITEMCHANGEFc.cached = 1;
+}
+
+NMTVITEMCHANGE *getNMTVITEMCHANGEFields(JNIEnv *env, jobject lpObject, NMTVITEMCHANGE *lpStruct)
+{
+ if (!NMTVITEMCHANGEFc.cached) cacheNMTVITEMCHANGEFields(env, lpObject);
+ getNMHDRFields(env, lpObject, (NMHDR *)lpStruct);
+ lpStruct->uChanged = (*env)->GetIntField(env, lpObject, NMTVITEMCHANGEFc.uChanged);
+ lpStruct->hItem = (HTREEITEM)(*env)->GetIntField(env, lpObject, NMTVITEMCHANGEFc.hItem);
+ lpStruct->uStateNew = (*env)->GetIntField(env, lpObject, NMTVITEMCHANGEFc.uStateNew);
+ lpStruct->uStateOld = (*env)->GetIntField(env, lpObject, NMTVITEMCHANGEFc.uStateOld);
+ lpStruct->lParam = (*env)->GetIntField(env, lpObject, NMTVITEMCHANGEFc.lParam);
+ return lpStruct;
+}
+
+void setNMTVITEMCHANGEFields(JNIEnv *env, jobject lpObject, NMTVITEMCHANGE *lpStruct)
+{
+ if (!NMTVITEMCHANGEFc.cached) cacheNMTVITEMCHANGEFields(env, lpObject);
+ setNMHDRFields(env, lpObject, (NMHDR *)lpStruct);
+ (*env)->SetIntField(env, lpObject, NMTVITEMCHANGEFc.uChanged, (jint)lpStruct->uChanged);
+ (*env)->SetIntField(env, lpObject, NMTVITEMCHANGEFc.hItem, (jint)lpStruct->hItem);
+ (*env)->SetIntField(env, lpObject, NMTVITEMCHANGEFc.uStateNew, (jint)lpStruct->uStateNew);
+ (*env)->SetIntField(env, lpObject, NMTVITEMCHANGEFc.uStateOld, (jint)lpStruct->uStateOld);
+ (*env)->SetIntField(env, lpObject, NMTVITEMCHANGEFc.lParam, (jint)lpStruct->lParam);
+}
+#endif
+
#ifndef NO_NMUPDOWN
typedef struct NMUPDOWN_FID_CACHE {
int cached;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_structs.h b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_structs.h
index 1621a77105..7e593a660a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_structs.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_structs.h
@@ -803,6 +803,18 @@ void setNMTVDISPINFOFields(JNIEnv *env, jobject lpObject, NMTVDISPINFO *lpStruct
#define NMTVDISPINFO_sizeof() 0
#endif
+#ifndef NO_NMTVITEMCHANGE
+void cacheNMTVITEMCHANGEFields(JNIEnv *env, jobject lpObject);
+NMTVITEMCHANGE *getNMTVITEMCHANGEFields(JNIEnv *env, jobject lpObject, NMTVITEMCHANGE *lpStruct);
+void setNMTVITEMCHANGEFields(JNIEnv *env, jobject lpObject, NMTVITEMCHANGE *lpStruct);
+#define NMTVITEMCHANGE_sizeof() sizeof(NMTVITEMCHANGE)
+#else
+#define cacheNMTVITEMCHANGEFields(a,b)
+#define getNMTVITEMCHANGEFields(a,b,c) NULL
+#define setNMTVITEMCHANGEFields(a,b,c)
+#define NMTVITEMCHANGE_sizeof() 0
+#endif
+
#ifndef NO_NMUPDOWN
void cacheNMUPDOWNFields(JNIEnv *env, jobject lpObject);
NMUPDOWN *getNMUPDOWNFields(JNIEnv *env, jobject lpObject, NMUPDOWN *lpStruct);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java
index 985aa7554d..d1c0a8c1c7 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java
@@ -1575,6 +1575,8 @@ public class OS extends Platform {
public static final int TVN_FIRST = 0xfffffe70;
public static final int TVN_GETDISPINFOA = TVN_FIRST - 3;
public static final int TVN_GETDISPINFOW = TVN_FIRST - 52;
+ public static final int TVN_ITEMCHANGINGW = TVN_FIRST - 17;
+ public static final int TVN_ITEMCHANGINGA = TVN_FIRST - 16;
public static final int TVN_ITEMEXPANDEDA = TVN_FIRST -6;
public static final int TVN_ITEMEXPANDEDW = TVN_FIRST - 55;
public static final int TVN_ITEMEXPANDINGW = 0xfffffe3a;
@@ -3129,6 +3131,7 @@ public static final native void MoveMemory (NMCUSTOMDRAW Destination, int Source
public static final native void MoveMemory (NMLVCUSTOMDRAW Destination, int Source, int Length);
public static final native void MoveMemory (NMTBHOTITEM Destination, int Source, int Length);
public static final native void MoveMemory (NMTVCUSTOMDRAW Destination, int Source, int Length);
+public static final native void MoveMemory (NMTVITEMCHANGE Destination, int Source, int Length);
public static final native void MoveMemory (NMUPDOWN Destination, int Source, int Length);
public static final native void MoveMemory (int Destination, NMLVCUSTOMDRAW Source, int Length);
public static final native void MoveMemory (int Destination, NMTVCUSTOMDRAW Source, int Length);
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 84bc6837cb..b42ed636c0 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
@@ -73,7 +73,7 @@ public class Tree extends Composite {
ImageList imageList, headerImageList;
TreeItem currentItem;
TreeColumn sortColumn;
- int hwndParent, hwndHeader, hAnchor, hInsert, lastID;
+ int hwndParent, hwndHeader, hAnchor, hInsert, lastID, hSelect;
int hFirstIndexOf, hLastIndexOf, lastIndexOf, itemCount, sortDirection;
boolean dragStarted, gestureCompleted, insertAfter, shrink, ignoreShrink;
boolean ignoreSelect, ignoreExpand, ignoreDeselect, ignoreResize;
@@ -1251,12 +1251,14 @@ int callWindowProc (int hwnd, int msg, int wParam, int lParam) {
tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_STATE;
tvItem.hItem = hItem;
OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
+ hSelect = hItem;
ignoreDeselect = ignoreSelect = lockSelection = true;
OS.SendMessage (handle, OS.TVM_SELECTITEM, OS.TVGN_CARET, hItem);
+ ignoreDeselect = ignoreSelect = lockSelection = false;
+ hSelect = 0;
if ((tvItem.state & OS.TVIS_SELECTED) == 0) {
OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
}
- ignoreDeselect = ignoreSelect = lockSelection = false;
}
}
break;
@@ -4086,9 +4088,11 @@ public void setSelection (TreeItem [] items) {
OS.SendMessage (handle, OS.WM_SETREDRAW, 1, 0);
OS.DefWindowProc (handle, OS.WM_SETREDRAW, 0, 0);
}
+ hSelect = hNewItem;
ignoreSelect = true;
OS.SendMessage (handle, OS.TVM_SELECTITEM, OS.TVGN_CARET, hNewItem);
ignoreSelect = false;
+ hSelect = 0;
if (OS.SendMessage (handle, OS.TVM_GETVISIBLECOUNT, 0, 0) == 0) {
OS.SendMessage (handle, OS.TVM_SELECTITEM, OS.TVGN_FIRSTVISIBLE, hNewItem);
}
@@ -5014,9 +5018,11 @@ LRESULT WM_KEYDOWN (int wParam, int lParam) {
*/
// OS.SendMessage (handle, OS.WM_SETREDRAW, 0, 0);
}
+ hSelect = hNewItem;
ignoreSelect = true;
OS.SendMessage (handle, OS.TVM_SELECTITEM, OS.TVGN_CARET, hNewItem);
ignoreSelect = false;
+ hSelect = 0;
if (oldSelected) {
tvItem.state = OS.TVIS_SELECTED;
tvItem.hItem = hItem;
@@ -5032,6 +5038,7 @@ LRESULT WM_KEYDOWN (int wParam, int lParam) {
rect1.left = hItem; rect2.left = hNewItem;
int fItemRect = (style & SWT.FULL_SELECTION) != 0 ? 0 : 1;
if (hooks (SWT.EraseItem) || hooks (SWT.PaintItem)) fItemRect = 0;
+ if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) fItemRect = 0;
OS.SendMessage (handle, OS.TVM_GETITEMRECT, fItemRect, rect1);
OS.SendMessage (handle, OS.TVM_GETITEMRECT, fItemRect, rect2);
/*
@@ -5302,6 +5309,7 @@ LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
}
return LRESULT.ZERO;
}
+ hSelect = lpht.hItem;
dragStarted = gestureCompleted = false;
ignoreDeselect = ignoreSelect = true;
int code = callWindowProc (handle, OS.WM_LBUTTONDOWN, wParam, lParam);
@@ -5323,6 +5331,7 @@ LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
}
}
ignoreDeselect = ignoreSelect = false;
+ hSelect = 0;
if (dragStarted) {
if (!display.captureChanged && !isDisposed ()) {
if (OS.GetCapture () != handle) OS.SetCapture (handle);
@@ -5376,6 +5385,7 @@ LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
rect1.left = hOldItem; rect2.left = hNewItem;
int fItemRect = (style & SWT.FULL_SELECTION) != 0 ? 0 : 1;
if (hooks (SWT.EraseItem) || hooks (SWT.PaintItem)) fItemRect = 0;
+ if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) fItemRect = 0;
OS.SendMessage (handle, OS.TVM_GETITEMRECT, fItemRect, rect1);
OS.SendMessage (handle, OS.TVM_GETITEMRECT, fItemRect, rect2);
/*
@@ -6197,6 +6207,29 @@ LRESULT wmNotifyChild (int wParam, int lParam) {
updateScrollBar ();
break;
}
+ /*
+ * Bug in Windows. On Vista, when TVM_SELECTITEM is called
+ * with TVGN_CARET in order to set the selection, for some
+ * reason, Windows deselects the previous two items that
+ * were selected. The fix is to stop the selection from
+ * changing on all but the item that is supposed to be
+ * selected.
+ */
+ case OS.TVN_ITEMCHANGINGA:
+ case OS.TVN_ITEMCHANGINGW:{
+ if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
+ if ((style & SWT.MULTI) != 0) {
+ if (hSelect != 0) {
+ NMTVITEMCHANGE pItemChange = new NMTVITEMCHANGE ();
+ OS.MoveMemory (pItemChange, lParam, NMTVITEMCHANGE.sizeof);
+ if (hSelect == pItemChange.hItem) break;
+ return LRESULT.ONE;
+ }
+ if (lockSelection) return LRESULT.ONE;
+ }
+ }
+ break;
+ }
case OS.TVN_SELCHANGINGA:
case OS.TVN_SELCHANGINGW: {
if ((style & SWT.MULTI) != 0) {
@@ -6314,9 +6347,11 @@ LRESULT wmNotifyChild (int wParam, int lParam) {
int offset = NMHDR.sizeof + 4 + TVITEM.sizeof;
OS.MoveMemory (tvItem, lParam + offset, TVITEM.sizeof);
if (tvItem.hItem != 0 && (tvItem.state & OS.TVIS_SELECTED) == 0) {
+ hSelect = tvItem.hItem;
ignoreSelect = ignoreDeselect = true;
OS.SendMessage (handle, OS.TVM_SELECTITEM, OS.TVGN_CARET, tvItem.hItem);
ignoreSelect = ignoreDeselect = false;
+ hSelect = 0;
}
dragStarted = true;
break;

Back to the top