diff options
author | Annika Karjakina <akarjakina@users.sourceforge.net> | 2012-04-30 12:38:41 +0530 |
---|---|---|
committer | Lakshmi Shanmugam <lshanmug@in.ibm.com> | 2012-04-30 12:38:41 +0530 |
commit | 7d3ba9344c953b6e6eb5b4547c5c6ab3984aacc7 (patch) | |
tree | d6b4d62294c8ad005fffda521d9590db97a34d76 /bundles/org.eclipse.swt/Eclipse SWT Custom Widgets | |
parent | dc8b70b8b17620c5e26d2b27a9531e3a6acaed33 (diff) | |
download | eclipse.platform.swt-7d3ba9344c953b6e6eb5b4547c5c6ab3984aacc7.tar.gz eclipse.platform.swt-7d3ba9344c953b6e6eb5b4547c5c6ab3984aacc7.tar.xz eclipse.platform.swt-7d3ba9344c953b6e6eb5b4547c5c6ab3984aacc7.zip |
Bug 377155-CCombo dropdown list can go off the top screen bound
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Custom Widgets')
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java index f835690345..d2e5a87d22 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java @@ -583,7 +583,17 @@ void dropDown (boolean drop) { int height = listRect.height + 2; int x = parentRect.x; int y = parentRect.y + comboSize.y; - if (y + height > displayRect.y + displayRect.height) y = parentRect.y - height; + if (y + height > displayRect.y + displayRect.height) { + int popUpwardsHeight = (parentRect.y - height < displayRect.y) ? parentRect.y - displayRect.y : height; + int popDownwardsHeight = displayRect.y + displayRect.height - y; + if (popUpwardsHeight > popDownwardsHeight) { + height = popUpwardsHeight; + y = parentRect.y - popUpwardsHeight; + } else { + height = popDownwardsHeight; + } + list.setSize (listRect.width, height - 2); + } if (x + width > displayRect.x + displayRect.width) x = displayRect.x + displayRect.width - listRect.width; popup.setBounds (x, y, width, height); popup.setVisible (true); |