summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeColumn.java
diff options
context:
space:
mode:
authorVeronika Irvine <veronika>2005-01-26 16:20:08 +0000
committerVeronika Irvine <veronika>2005-01-26 16:20:08 +0000
commit7752af94649ff3781401576ef108513585b255fb (patch)
treedba31912830c141908172114d3f3dde3bbc6395b /bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeColumn.java
parentcfbc33c69fb691d03893f7594d7945c46856d14b (diff)
downloadeclipse.platform.swt-7752af94649ff3781401576ef108513585b255fb.tar.gz
eclipse.platform.swt-7752af94649ff3781401576ef108513585b255fb.tar.xz
eclipse.platform.swt-7752af94649ff3781401576ef108513585b255fb.zip
bugs 73812 and 51079 - the width of the column is not immediately set when gtk_tree_view_column_set_fixed_width is called. As a workaround, remember that we have just set the width and use the fixed width value until we receive an event indicating that the width has been set.
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeColumn.java')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeColumn.java19
1 files changed, 9 insertions, 10 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeColumn.java
index 970176c118..2544b2cfd8 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeColumn.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeColumn.java
@@ -35,7 +35,7 @@ public class TreeColumn extends Item {
int /*long*/ labelHandle, imageHandle, buttonHandle;
Tree parent;
int modelIndex, lastButton, lastTime, lastX, lastWidth;
- boolean customDraw;
+ boolean customDraw, useFixedWidth;
/**
* Constructs a new instance of this class given its parent
@@ -262,11 +262,8 @@ public int getWidth () {
if (!OS.gtk_tree_view_column_get_visible (handle)) {
return 0;
}
- int width = OS.gtk_tree_view_column_get_width (handle);
- if (width == 0) {
- width = OS.gtk_tree_view_column_get_fixed_width (handle);
- }
- return width;
+ if (useFixedWidth) return OS.gtk_tree_view_column_get_fixed_width (handle);
+ return OS.gtk_tree_view_column_get_width (handle);
}
int /*long*/ gtk_clicked (int /*long*/ widget) {
@@ -304,17 +301,18 @@ int /*long*/ gtk_mnemonic_activate (int /*long*/ widget, int /*long*/ arg1) {
}
int /*long*/ gtk_size_allocate (int /*long*/ widget, int /*long*/ allocation) {
+ useFixedWidth = false;
boolean mapped = OS.GTK_WIDGET_MAPPED (widget);
int x = OS.GTK_WIDGET_X (widget);
int width = OS.GTK_WIDGET_WIDTH (widget);
- if (width != lastWidth) {
- lastWidth = width;
- if (mapped) sendEvent (SWT.Resize);
- }
if (x != lastX) {
lastX = x;
if (mapped) sendEvent (SWT.Move);
}
+ if (width != lastWidth) {
+ lastWidth = width;
+ if (mapped) sendEvent (SWT.Resize);
+ }
return 0;
}
@@ -528,6 +526,7 @@ public void setText (String string) {
public void setWidth (int width) {
checkWidget();
if (width > 0) {
+ useFixedWidth = true;
OS.gtk_tree_view_column_set_fixed_width (handle, width);
OS.gtk_tree_view_column_set_visible (handle, true);
} else {