summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2001-01-19 22:39:19 +0000
committerHavoc Pennington <hp@src.gnome.org>2001-01-19 22:39:19 +0000
commite248e4e79eb81478d62a42df12e9c11a837dd068 (patch)
tree1c1001af13a5e32ee9dd9637c8d70ea080af3eab /tests
parent3da8e3c7dd846e48d745c9a1b4cafd399fd49517 (diff)
downloadgtk+-e248e4e79eb81478d62a42df12e9c11a837dd068.tar.gz
sync to tree changes
2001-01-19 Havoc Pennington <hp@redhat.com> * demos/gtk-demo/main.c (button_press_event_cb): sync to tree changes * gtk/gtkrbtree.c (_gtk_rbtree_node_find_offset): fix this function * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_widget): implement * gtk/gtktreeview.c (gtk_tree_view_move_to): rename scroll_to_cell, matches TextView scroll functions better (gtk_tree_view_tree_to_widget_coords): new function (gtk_tree_view_widget_to_tree_coords): new function (gtk_tree_view_get_visible_rect): new function (gtk_tree_view_get_path_at_pos): accept negative coordinates (gtk_tree_view_draw_node_focus_rect): new function moved from draw_focus, also, use width of bin_window as width of the focus rect (gtk_tree_view_expand_row): fix bug where it didn't recognize already-expanded rows (gtk_tree_view_get_cell_rect): new function (gtk_tree_view_get_path_at_pos): return the click position relative to the passed-in cell (gtk_tree_view_set_expander_column): new function * configure.in: remove gtk-config-2.0 chmod * gtk/gtktextview.c (gtk_text_view_drag_motion): small cleanups, and properly handle drags with targets we don't understand (gtk_text_view_drag_end): don't stop scrolling, the source isn't scrolling anyway (gtk_text_view_drag_drop): stop scrolling here though, and set the mark invisible * gtk/gtkdnd.c (gtk_drag_dest_find_target): export as a public function (gtk_drag_dest_get_target_list): new function (gtk_drag_dest_set_target_list): new function * gtk/gtktreeview.c: Add a bunch of drag-and-drop implementation * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): add fields related to drag-and-drop
Diffstat (limited to 'tests')
-rw-r--r--tests/testtreeview.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/tests/testtreeview.c b/tests/testtreeview.c
index 70c71376bb..6181114d04 100644
--- a/tests/testtreeview.c
+++ b/tests/testtreeview.c
@@ -248,7 +248,9 @@ set_columns_type (GtkTreeView *tree_view, ColumnsType type)
{
GtkTreeViewColumn *col;
GtkCellRenderer *rend;
-
+ GdkPixbuf *pixbuf;
+ GtkWidget *image;
+
current_column_type = type;
col = gtk_tree_view_get_column (tree_view, 0);
@@ -307,6 +309,16 @@ set_columns_type (GtkTreeView *tree_view, ColumnsType type)
setup_column (col);
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), col);
+
+ pixbuf = gdk_pixbuf_new_from_xpm_data (book_closed_xpm);
+
+ image = gtk_image_new_from_pixbuf (pixbuf);
+
+ gtk_widget_show (image);
+
+ gtk_tree_view_column_set_widget (col, image);
+
+ g_object_unref (G_OBJECT (pixbuf));
g_object_unref (G_OBJECT (rend));
g_object_unref (G_OBJECT (col));
@@ -333,6 +345,8 @@ set_columns_type (GtkTreeView *tree_view, ColumnsType type)
g_object_unref (G_OBJECT (rend));
g_object_unref (G_OBJECT (col));
+
+ gtk_tree_view_set_expander_column (tree_view, 1);
/* FALL THRU */
@@ -527,6 +541,17 @@ columns_selected (GtkOptionMenu *om, gpointer data)
}
}
+
+enum
+{
+ TARGET_GTK_TREE_VIEW_ROW
+};
+
+static GtkTargetEntry row_targets[] = {
+ { "GTK_TREE_VIEW_ROW", GTK_TARGET_SAME_APP,
+ TARGET_GTK_TREE_VIEW_ROW }
+};
+
int
main (int argc,
char **argv)
@@ -574,6 +599,19 @@ main (int argc,
gtk_container_add (GTK_CONTAINER (window), table);
tv = gtk_tree_view_new_with_model (models[0]);
+
+ gtk_tree_view_set_rows_drag_source (GTK_TREE_VIEW (tv),
+ GDK_BUTTON1_MASK,
+ row_targets,
+ G_N_ELEMENTS (row_targets),
+ GDK_ACTION_MOVE | GDK_ACTION_COPY,
+ NULL, NULL);
+
+ gtk_tree_view_set_rows_drag_dest (GTK_TREE_VIEW (tv),
+ row_targets,
+ G_N_ELEMENTS (row_targets),
+ GDK_ACTION_MOVE | GDK_ACTION_COPY,
+ NULL, NULL);
/* Model menu */