summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarolyn MacLeod <Carolyn_MacLeod@ca.ibm.com>2012-04-30 12:53:42 -0400
committerCarolyn MacLeod <Carolyn_MacLeod@ca.ibm.com>2012-04-30 12:57:48 -0400
commit71b464964b4568fbd72962189eeae03e7d8e938c (patch)
tree8a8742a189327932afc330d9917b36f572b9fb50
parent1502107eb741a62e372c2ee45cccdacbd95479f4 (diff)
downloadeclipse.platform.swt-71b464964b4568fbd72962189eeae03e7d8e938c.tar.gz
eclipse.platform.swt-71b464964b4568fbd72962189eeae03e7d8e938c.tar.xz
eclipse.platform.swt-71b464964b4568fbd72962189eeae03e7d8e938c.zip
Bug 375723 - Handle MENU_KEYBOARD in more widgets
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java22
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java2
3 files changed, 23 insertions, 3 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java
index 73fe757e29..d98a6b4fe0 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java
@@ -1514,9 +1514,29 @@ void updateMenuLocation (Event event) {
int focusIndex = getFocusIndex();
if (focusIndex != -1) {
RECT rect = new RECT ();
- OS.SendMessage (handle, OS.LB_GETITEMRECT, focusIndex, rect);
+ int /*long*/ newFont, oldFont = 0;
+ int /*long*/ hDC = OS.GetDC (handle);
+ newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
+ if (newFont != 0) oldFont = OS.SelectObject (hDC, newFont);
+ int flags = OS.DT_CALCRECT | OS.DT_SINGLELINE | OS.DT_NOPREFIX;
+ int cp = getCodePage ();
+ TCHAR buffer = new TCHAR (cp, 64 + 1);
+ int length = (int)/*64*/OS.SendMessage (handle, OS.LB_GETTEXTLEN, focusIndex, 0);
+ if (length != OS.LB_ERR) {
+ if (length + 1 > buffer.length ()) {
+ buffer = new TCHAR (cp, length + 1);
+ }
+ int result = (int)/*64*/OS.SendMessage (handle, OS.LB_GETTEXT, focusIndex, buffer);
+ if (result != OS.LB_ERR) {
+ OS.DrawText (hDC, buffer, length, rect, flags);
+ }
+ }
+ if (newFont != 0) OS.SelectObject (hDC, oldFont);
+ OS.ReleaseDC (handle, hDC);
x = Math.max (x, rect.right / 2);
x = Math.min (x, clientArea.x + clientArea.width);
+
+ OS.SendMessage (handle, OS.LB_GETITEMRECT, focusIndex, rect);
y = Math.max (y, rect.bottom);
y = Math.min (y, clientArea.y + clientArea.height);
}
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 55795a857b..cea8c13837 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
@@ -5617,7 +5617,7 @@ void updateMenuLocation (Event event) {
TableItem focusItem = getItem (focusIndex);
Rectangle bounds = focusItem.getBounds (0);
if (focusItem.text != null && focusItem.text.length () != 0) {
- bounds = focusItem.getTextBounds (0);
+ bounds = focusItem.getBounds ();
}
x = Math.max (x, bounds.x + bounds.width / 2);
x = Math.min (x, clientArea.x + clientArea.width);
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 117acc5dc4..997830d564 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
@@ -5542,7 +5542,7 @@ void updateMenuLocation (Event event) {
if (focusItem != null) {
Rectangle bounds = focusItem.getBounds (0);
if (focusItem.text != null && focusItem.text.length () != 0) {
- bounds = focusItem.getTextBounds (0);
+ bounds = focusItem.getBounds ();
}
x = Math.max (x, bounds.x + bounds.width / 2);
x = Math.min (x, clientArea.x + clientArea.width);