summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Keller <markus_keller@ch.ibm.com>2012-10-19 15:47:03 +0200
committerMarkus Keller <markus_keller@ch.ibm.com>2012-10-19 15:47:03 +0200
commitbf276595d1ee2ba775bdcbd0a9b4fd45f74da0c5 (patch)
treea8b604bc34a67bbf34198800b1141ce225d7aca1
parent2460307210ca1c84db4d87d040f55706616b5591 (diff)
downloadeclipse.platform.swt-bf276595d1ee2ba775bdcbd0a9b4fd45f74da0c5.tar.gz
eclipse.platform.swt-bf276595d1ee2ba775bdcbd0a9b4fd45f74da0c5.tar.xz
eclipse.platform.swt-bf276595d1ee2ba775bdcbd0a9b4fd45f74da0c5.zip
Bug 387204: Tree and Table tooltips cut second line on Windows
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java25
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java8
2 files changed, 30 insertions, 3 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
index 751731cf82..e54b61fb0d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
@@ -13,11 +13,11 @@ package org.eclipse.swt.widgets;
//import java.util.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.win32.*;
import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
import org.eclipse.swt.events.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.win32.*;
/**
* Instances of this class implement a selectable user interface
@@ -6794,6 +6794,25 @@ LRESULT wmNotifyChild (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) {
buffer = display.tableBuffer = new char [plvfi.cchTextMax];
}
string.getChars (0, length, buffer, 0);
+ if (tipRequested) {
+ /*
+ * Bug in Windows. The tooltip is only displayed up to
+ * the first line delimiter. The fix is to remove all
+ * line delimiter characters.
+ */
+ int shift = 0;
+ for (int i = 0; i < length; i++) {
+ switch (buffer [i]) {
+ case '\r':
+ case '\n':
+ shift++;
+ break;
+ default:
+ if (shift != 0) buffer [i - shift] = buffer [i];
+ }
+ }
+ length -= shift;
+ }
buffer [length++] = 0;
if (OS.IsUnicode) {
OS.MoveMemory (plvfi.pszText, buffer, length * 2);
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 da21aac00e..d7706a4b31 100644
--- 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
@@ -2213,6 +2213,14 @@ void createItemToolTips () {
null);
if (itemToolTipHandle == 0) error (SWT.ERROR_NO_HANDLES);
OS.SendMessage (itemToolTipHandle, OS.TTM_SETDELAYTIME, OS.TTDT_INITIAL, 0);
+ /*
+ * Feature in Windows. Despite the fact that the
+ * tool tip text contains \r\n, the tooltip will
+ * not honour the new line unless TTM_SETMAXTIPWIDTH
+ * is set. The fix is to set TTM_SETMAXTIPWIDTH to
+ * a large value.
+ */
+ OS.SendMessage (itemToolTipHandle, OS.TTM_SETMAXTIPWIDTH, 0, 0x7FFF);
TOOLINFO lpti = new TOOLINFO ();
lpti.cbSize = TOOLINFO.sizeof;
lpti.hwnd = handle;