aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti2013-03-21 13:56:07 (EDT)
committerCarolyn MacLeod2013-04-09 10:56:49 (EDT)
commit7cd97ac7c399c85950f54aa2dba2e90c19dfb4fc (patch)
treed9c7d63870e6f3ba1cd91be96c7fdc97b05be2e3
parent2e524dc8338b33826e618d4102364265211694a8 (diff)
downloadeclipse.platform.swt-7cd97ac7c399c85950f54aa2dba2e90c19dfb4fc.zip
eclipse.platform.swt-7cd97ac7c399c85950f54aa2dba2e90c19dfb4fc.tar.gz
eclipse.platform.swt-7cd97ac7c399c85950f54aa2dba2e90c19dfb4fc.tar.bz2
Bug 396316 - [GTK3] Table is not given enough height on preferences File Associations page
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java31
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java8
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java8
3 files changed, 44 insertions, 3 deletions
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 1d3ce0c..f0546d5 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
@@ -491,7 +491,13 @@ public int getItemHeight () {
if (itemCount == 0) {
int [] w = new int [1], h = new int [1];
OS.gtk_tree_view_column_cell_get_size (column, null, null, null, w, h);
- return h [0];
+ int height = h [0];
+ if (OS.GTK3) {
+ long /*int*/ textRenderer = getTextRenderer (column);
+ OS.gtk_cell_renderer_get_preferred_height_for_width (textRenderer, handle, 0, h, null);
+ height += h [0];
+ }
+ return height;
} else {
long /*int*/ iter = OS.g_malloc (OS.GtkTreeIter_sizeof ());
OS.gtk_tree_model_get_iter_first (modelHandle, iter);
@@ -662,6 +668,29 @@ public int [] getSelectionIndices () {
return new int [0];
}
+long /*int*/ getTextRenderer (long /*int*/ column) {
+ long /*int*/ list = 0;
+ if (OS.GTK_VERSION >= OS.VERSION(2, 12, 0)) {
+ list = OS.gtk_cell_layout_get_cells(column);
+ } else {
+ list = OS.gtk_tree_view_column_get_cell_renderers (column);
+ }
+ if (list == 0) return 0;
+ int count = OS.g_list_length (list);
+ long /*int*/ textRenderer = 0;
+ int i = 0;
+ while (i < count) {
+ long /*int*/ renderer = OS.g_list_nth_data (list, i);
+ if (OS.GTK_IS_CELL_RENDERER_TEXT (renderer)) {
+ textRenderer = renderer;
+ break;
+ }
+ i++;
+ }
+ OS.g_list_free (list);
+ return textRenderer;
+}
+
/**
* Returns the zero-relative index of the item which is currently
* at the top of the receiver. This index can change when items are
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 73539b7..304bb00 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
@@ -1509,8 +1509,14 @@ public int getItemHeight () {
int [] w = new int [1], h = new int [1];
ignoreSize = true;
OS.gtk_tree_view_column_cell_get_size (column, null, null, null, w, h);
+ int height = h [0];
+ if (OS.GTK3) {
+ long /*int*/ textRenderer = getTextRenderer (column);
+ OS.gtk_cell_renderer_get_preferred_height_for_width (textRenderer, handle, 0, h, null);
+ height += h [0];
+ }
ignoreSize = false;
- return h [0];
+ return height;
} else {
int height = 0;
long /*int*/ iter = OS.g_malloc (OS.GtkTreeIter_sizeof ());
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 f207856..38276c8 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
@@ -1545,8 +1545,14 @@ public int getItemHeight () {
int [] w = new int [1], h = new int [1];
ignoreSize = true;
OS.gtk_tree_view_column_cell_get_size (column, null, null, null, w, h);
+ int height = h [0];
+ if (OS.GTK3) {
+ long /*int*/ textRenderer = getTextRenderer (column);
+ OS.gtk_cell_renderer_get_preferred_height_for_width (textRenderer, handle, 0, h, null);
+ height += h [0];
+ }
ignoreSize = false;
- return h [0];
+ return height;
} else {
int height = 0;
long /*int*/ iter = OS.g_malloc (OS.GtkTreeIter_sizeof ());