From f8a40e214a534f7c54fc41c3615df78a67cd3c63 Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Mon, 3 Aug 1998 19:50:23 +0000 Subject: [PATCH] New public function to find a row by its data pointer using a custom 1998-08-03 Federico Mena Quintero * gtk/gtkctree.c (gtk_ctree_find_by_row_data_custom): New public function to find a row by its data pointer using a custom comparison function. --- ChangeLog | 6 ++++++ ChangeLog.pre-2-0 | 6 ++++++ ChangeLog.pre-2-10 | 6 ++++++ ChangeLog.pre-2-2 | 6 ++++++ ChangeLog.pre-2-4 | 6 ++++++ ChangeLog.pre-2-6 | 6 ++++++ ChangeLog.pre-2-8 | 6 ++++++ gtk/gtkctree.c | 21 +++++++++++++++++++++ gtk/gtkctree.h | 4 ++++ 9 files changed, 67 insertions(+) diff --git a/ChangeLog b/ChangeLog index e629a787ae..172ab42775 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +1998-08-03 Federico Mena Quintero + + * gtk/gtkctree.c (gtk_ctree_find_by_row_data_custom): New public + function to find a row by its data pointer using a custom + comparison function. + Sun Aug 02 22:58:00 1998 George Lebl * gtk/gtkclist.c: draw the buttons during a "draw" as well, diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index e629a787ae..172ab42775 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,9 @@ +1998-08-03 Federico Mena Quintero + + * gtk/gtkctree.c (gtk_ctree_find_by_row_data_custom): New public + function to find a row by its data pointer using a custom + comparison function. + Sun Aug 02 22:58:00 1998 George Lebl * gtk/gtkclist.c: draw the buttons during a "draw" as well, diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index e629a787ae..172ab42775 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,9 @@ +1998-08-03 Federico Mena Quintero + + * gtk/gtkctree.c (gtk_ctree_find_by_row_data_custom): New public + function to find a row by its data pointer using a custom + comparison function. + Sun Aug 02 22:58:00 1998 George Lebl * gtk/gtkclist.c: draw the buttons during a "draw" as well, diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index e629a787ae..172ab42775 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,9 @@ +1998-08-03 Federico Mena Quintero + + * gtk/gtkctree.c (gtk_ctree_find_by_row_data_custom): New public + function to find a row by its data pointer using a custom + comparison function. + Sun Aug 02 22:58:00 1998 George Lebl * gtk/gtkclist.c: draw the buttons during a "draw" as well, diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index e629a787ae..172ab42775 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,9 @@ +1998-08-03 Federico Mena Quintero + + * gtk/gtkctree.c (gtk_ctree_find_by_row_data_custom): New public + function to find a row by its data pointer using a custom + comparison function. + Sun Aug 02 22:58:00 1998 George Lebl * gtk/gtkclist.c: draw the buttons during a "draw" as well, diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index e629a787ae..172ab42775 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,9 @@ +1998-08-03 Federico Mena Quintero + + * gtk/gtkctree.c (gtk_ctree_find_by_row_data_custom): New public + function to find a row by its data pointer using a custom + comparison function. + Sun Aug 02 22:58:00 1998 George Lebl * gtk/gtkclist.c: draw the buttons during a "draw" as well, diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index e629a787ae..172ab42775 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,9 @@ +1998-08-03 Federico Mena Quintero + + * gtk/gtkctree.c (gtk_ctree_find_by_row_data_custom): New public + function to find a row by its data pointer using a custom + comparison function. + Sun Aug 02 22:58:00 1998 George Lebl * gtk/gtkclist.c: draw the buttons during a "draw" as well, diff --git a/gtk/gtkctree.c b/gtk/gtkctree.c index 9cee1fd402..b36fb5e7cd 100644 --- a/gtk/gtkctree.c +++ b/gtk/gtkctree.c @@ -4077,6 +4077,27 @@ gtk_ctree_find_by_row_data (GtkCTree *ctree, return NULL; } +GtkCTreeNode * +gtk_ctree_find_by_row_data_custom (GtkCTree *ctree, + GtkCTreeNode *node, + gpointer data, + GCompareFunc func) +{ + GtkCTreeNode *work; + + while (node) + { + if (!func (GTK_CTREE_ROW (node)->row.data, data)) + return node; + if (GTK_CTREE_ROW (node)->children && + (work = gtk_ctree_find_by_row_data_custom + (ctree, GTK_CTREE_ROW (node)->children, data, func))) + return work; + node = GTK_CTREE_ROW (node)->sibling; + } + return NULL; +} + gboolean gtk_ctree_is_hot_spot (GtkCTree *ctree, gint x, diff --git a/gtk/gtkctree.h b/gtk/gtkctree.h index b48e2aad36..01e8d78dd1 100644 --- a/gtk/gtkctree.h +++ b/gtk/gtkctree.h @@ -222,6 +222,10 @@ gboolean gtk_ctree_is_ancestor (GtkCTree *ctree, GtkCTreeNode * gtk_ctree_find_by_row_data (GtkCTree *ctree, GtkCTreeNode *node, gpointer data); +GtkCTreeNode * gtk_ctree_find_by_row_data_custom (GtkCTree *ctree, + GtkCTreeNode *node, + gpointer data, + GCompareFunc func); gboolean gtk_ctree_is_hot_spot (GtkCTree *ctree, gint x, gint y);