summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov <akurtako@redhat.com>2012-11-07 10:40:14 +0200
committerAlexander Kurtakov <akurtako@redhat.com>2012-11-07 10:40:14 +0200
commitd9f25bc7d1ecd6068aa4c063198febec711ff57a (patch)
treef65d8bae69439242bf6f6fc4794571a2792bdb07
parent033543d2c530f3ef9e2efb7e2d0271a91bde3d81 (diff)
downloadeclipse.platform.swt-d9f25bc7d1ecd6068aa4c063198febec711ff57a.tar.gz
eclipse.platform.swt-d9f25bc7d1ecd6068aa4c063198febec711ff57a.tar.xz
eclipse.platform.swt-d9f25bc7d1ecd6068aa4c063198febec711ff57a.zip
Use gtk_tree_view_column_get_button on GTK 3.
It's way easier and more obvious to use the utility method instead of traversing the tree of widgets.
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c20
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java13
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java16
6 files changed, 46 insertions, 6 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
index 6ed017dfd8..f5d63095fe 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
@@ -16672,6 +16672,26 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1tree_1view_1column_1clear)
}
#endif
+#ifndef NO__1gtk_1tree_1view_1column_1get_1button
+JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1tree_1view_1column_1get_1button)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, _1gtk_1tree_1view_1column_1get_1button_FUNC);
+/*
+ rc = (jintLong)gtk_tree_view_column_get_button((GtkTreeViewColumn *)arg0);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gtk_tree_view_column_get_button)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)(GtkTreeViewColumn *))fp)((GtkTreeViewColumn *)arg0);
+ }
+ }
+ OS_NATIVE_EXIT(env, that, _1gtk_1tree_1view_1column_1get_1button_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1gtk_1tree_1view_1column_1get_1cell_1renderers
JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1tree_1view_1column_1get_1cell_1renderers)
(JNIEnv *env, jclass that, jintLong arg0)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h
index 512f53663f..fb948ddbab 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h
@@ -183,6 +183,7 @@
#define gtk_tooltips_force_window_LIB LIB_GTK
#define gtk_tree_selection_count_selected_rows_LIB LIB_GTK
#define gtk_tree_selection_get_selected_rows_LIB LIB_GTK
+#define gtk_tree_view_column_get_button_LIB LIB_GTK
#define gtk_tree_view_column_get_cell_renderers_LIB LIB_GTK
#define gtk_tree_view_column_cell_get_position_LIB LIB_GTK
#define gtk_tree_view_convert_bin_window_to_tree_coords_LIB LIB_GTK
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
index 654fe53138..cc6f7515d8 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
@@ -1228,6 +1228,7 @@ char * OS_nativeFunctionNames[] = {
"_1gtk_1tree_1view_1column_1cell_1get_1size",
"_1gtk_1tree_1view_1column_1cell_1set_1cell_1data",
"_1gtk_1tree_1view_1column_1clear",
+ "_1gtk_1tree_1view_1column_1get_1button",
"_1gtk_1tree_1view_1column_1get_1cell_1renderers",
"_1gtk_1tree_1view_1column_1get_1fixed_1width",
"_1gtk_1tree_1view_1column_1get_1reorderable",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
index 7dfe3ec380..43eec81338 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
@@ -1238,6 +1238,7 @@ typedef enum {
_1gtk_1tree_1view_1column_1cell_1get_1size_FUNC,
_1gtk_1tree_1view_1column_1cell_1set_1cell_1data_FUNC,
_1gtk_1tree_1view_1column_1clear_FUNC,
+ _1gtk_1tree_1view_1column_1get_1button_FUNC,
_1gtk_1tree_1view_1column_1get_1cell_1renderers_FUNC,
_1gtk_1tree_1view_1column_1get_1fixed_1width_FUNC,
_1gtk_1tree_1view_1column_1get_1reorderable_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
index d7e8cabeb8..8514ab6ca8 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
@@ -12408,6 +12408,19 @@ public static final void gtk_tree_view_column_clear(long /*int*/ tree_column) {
lock.unlock();
}
}
+/**
+ * @method flags=dynamic
+ * @param column cast=(GtkTreeViewColumn *)
+ */
+public static final native long /*int*/_gtk_tree_view_column_get_button(long /*int*/ column);
+public static final long /*int*/ gtk_tree_view_column_get_button(long /*int*/ column) {
+ lock.lock();
+ try {
+ return _gtk_tree_view_column_get_button(column);
+ } finally {
+ lock.unlock();
+ }
+}
/**
* @method flags=dynamic
* @param tree_column cast=(GtkTreeViewColumn *)
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 81b7123dc7..9c12e1f0e4 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
@@ -672,13 +672,17 @@ void createItem (TableColumn column, int index) {
column.labelHandle = labelHandle;
column.imageHandle = imageHandle;
OS.gtk_tree_view_column_set_widget (column.handle, boxHandle);
- long /*int*/ widget = OS.gtk_widget_get_parent (boxHandle);
- while (widget != handle) {
- if (OS.GTK_IS_BUTTON (widget)) {
- column.buttonHandle = widget;
- break;
+ if (OS.GTK3) {
+ column.buttonHandle = OS.gtk_tree_view_column_get_button(column.handle);
+ } else {
+ long /*int*/ widget = OS.gtk_widget_get_parent (boxHandle);
+ while (widget != handle) {
+ if (OS.GTK_IS_BUTTON (widget)) {
+ column.buttonHandle = widget;
+ break;
+ }
+ widget = OS.gtk_widget_get_parent (widget);
}
- widget = OS.gtk_widget_get_parent (widget);
}
if (columnCount == columns.length) {
TableColumn [] newColumns = new TableColumn [columns.length + 4];