summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Northover <steve>2002-08-13 19:22:07 +0000
committerSteve Northover <steve>2002-08-13 19:22:07 +0000
commit3e7c6f6ae9376ea807708eed75480dd79a4f6456 (patch)
tree347168448fad2c77a55f2ce5f465307cb2a2b005
parentd1e6fe76b692284f187561e5d5709cfedf3ed181 (diff)
downloadeclipse.platform.swt-3e7c6f6ae9376ea807708eed75480dd79a4f6456.tar.gz
eclipse.platform.swt-3e7c6f6ae9376ea807708eed75480dd79a4f6456.tar.xz
eclipse.platform.swt-3e7c6f6ae9376ea807708eed75480dd79a4f6456.zip
21829
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java11
2 files changed, 15 insertions, 8 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 99b69e4edc..d97e1a80fb 100755
--- 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
@@ -337,10 +337,10 @@ void dropDown (boolean drop) {
int index = list.getSelectionIndex ();
if (index != -1) list.setTopIndex (index);
Rectangle listRect = list.getBounds ();
- int borderWidth = getBorderWidth();
- Point point = toDisplay (new Point (0 - borderWidth, 0 - borderWidth));
+ Point point = getParent().toDisplay (getLocation ());
Point comboSize = getSize();
- popup.setBounds (point.x, point.y + comboSize.y, comboSize.x, listRect.height + 2);
+ int width = Math.max (comboSize.x, listRect.width + 2);
+ popup.setBounds (point.x, point.y + comboSize.y, width, listRect.height + 2);
popup.setVisible (true);
list.setFocus();
}
@@ -622,9 +622,9 @@ void internalLayout () {
arrow.setBounds (width - arrowSize.x, 0, arrowSize.x, arrowSize.y);
Point size = getSize();
- int listHeight = list.getItemHeight () * ITEMS_SHOWING;
- Rectangle trim = list.computeTrim (0, 0, size.x - 2, listHeight);
- list.setBounds (1, 1, size.x - 2, trim.height);
+ int itemHeight = list.getItemHeight () * ITEMS_SHOWING;
+ Point listSize = list.computeSize (SWT.DEFAULT, itemHeight);
+ list.setBounds (1, 1, Math.max (size.x - 2, listSize.x), listSize.y);
}
void listEvent (Event event) {
switch (event.type) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java
index 1209dd10ce..f398a00df5 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java
@@ -228,8 +228,15 @@ void hookEvents () {
public Point computeSize (int wHint, int hHint, boolean changed) {
checkWidget ();
- if (wHint == SWT.DEFAULT) wHint = 200;
- return super.computeSize (wHint, hHint, changed);
+ Point size = super.computeSize (wHint, hHint, changed);
+ if (wHint != SWT.DEFAULT) {
+ size.x = wHint;
+ } else {
+ GtkStyle st = new GtkStyle ();
+ OS.memmove (st, OS.gtk_widget_get_style (handle));
+ size.x = OS.gtk_clist_optimal_column_width (handle, 0) + vScrollBarWidth() + st.xthickness * 2;
+ }
+ return size;
}
/**