diff options
4 files changed, 22 insertions, 24 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java index fe21c144e1..cbdaa363dd 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java @@ -375,7 +375,7 @@ void createColumn (TableColumn column, int index) { OS.gtk_tree_view_column_set_sizing (columnHandle, OS.GTK_TREE_VIEW_COLUMN_AUTOSIZE); } else { OS.gtk_tree_view_column_set_sizing (columnHandle, OS.GTK_TREE_VIEW_COLUMN_FIXED); - OS.gtk_tree_view_column_set_fixed_width (columnHandle, 10); + if (columnCount != 0) OS.gtk_tree_view_column_set_visible (columnHandle, false); } OS.gtk_tree_view_column_set_resizable (columnHandle, true); OS.gtk_tree_view_column_set_clickable (columnHandle, true); @@ -430,7 +430,7 @@ void createItem (TableColumn column, int index) { if (columnCount == 0) { column.handle = OS.gtk_tree_view_get_column (handle, 0); OS.gtk_tree_view_column_set_sizing (column.handle, OS.GTK_TREE_VIEW_COLUMN_FIXED); - OS.gtk_tree_view_column_set_fixed_width (column.handle, 10); + OS.gtk_tree_view_column_set_visible (column.handle, false); column.modelIndex = FIRST_COLUMN; createRenderers (column.handle, column.modelIndex, true, column.style); column.customDraw = firstCustomDraw; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java index 801f324d0d..47d525121d 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java @@ -35,7 +35,7 @@ public class TableColumn extends Item { int /*long*/ labelHandle, imageHandle, buttonHandle; Table 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; } @@ -533,6 +531,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 { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java index 89f730a5f8..4d6ad22703 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java @@ -300,7 +300,7 @@ void createColumn (TreeColumn column, int index) { OS.gtk_tree_view_column_set_sizing (columnHandle, OS.GTK_TREE_VIEW_COLUMN_AUTOSIZE); } else { OS.gtk_tree_view_column_set_sizing (columnHandle, OS.GTK_TREE_VIEW_COLUMN_FIXED); - OS.gtk_tree_view_column_set_fixed_width (columnHandle, 10); + if (columnCount != 0) OS.gtk_tree_view_column_set_visible (columnHandle, false); } OS.gtk_tree_view_column_set_resizable (columnHandle, true); OS.gtk_tree_view_column_set_clickable (columnHandle, true); @@ -360,7 +360,7 @@ void createItem (TreeColumn column, int index) { if (columnCount == 0) { column.handle = OS.gtk_tree_view_get_column (handle, 0); OS.gtk_tree_view_column_set_sizing (column.handle, OS.GTK_TREE_VIEW_COLUMN_FIXED); - OS.gtk_tree_view_column_set_fixed_width (column.handle, 10); + OS.gtk_tree_view_column_set_visible (column.handle, false); column.modelIndex = FIRST_COLUMN; createRenderers (column.handle, column.modelIndex, true, column.style); column.customDraw = firstCustomDraw; 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 { |