[gtk+/gtk-3-22] flowbox: Export gtk_flow_box_get_child_at_pos as public API
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-22] flowbox: Export gtk_flow_box_get_child_at_pos as public API
- Date: Mon, 19 Dec 2016 23:36:06 +0000 (UTC)
commit 9679ef6b00cb087fecf772bb69ab9a2ad7429835
Author: Debarshi Ray <debarshir gnome org>
Date: Sat Dec 17 00:30:39 2016 +0100
flowbox: Export gtk_flow_box_get_child_at_pos as public API
Bump the gtk+ version so that others can depend on this new API.
https://bugzilla.gnome.org/show_bug.cgi?id=776187
configure.ac | 2 +-
docs/reference/gtk/gtk3-sections.txt | 1 +
gtk/gtkflowbox.c | 64 ++++++++++++++++++++-------------
gtk/gtkflowbox.h | 5 +++
4 files changed, 46 insertions(+), 26 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 8cd51bf..cead641 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10,7 +10,7 @@
m4_define([gtk_major_version], [3])
m4_define([gtk_minor_version], [22])
-m4_define([gtk_micro_version], [5])
+m4_define([gtk_micro_version], [6])
m4_define([gtk_interface_age], [5])
m4_define([gtk_binary_age],
[m4_eval(100 * gtk_minor_version + gtk_micro_version)])
diff --git a/docs/reference/gtk/gtk3-sections.txt b/docs/reference/gtk/gtk3-sections.txt
index 0c69e73..5183762 100644
--- a/docs/reference/gtk/gtk3-sections.txt
+++ b/docs/reference/gtk/gtk3-sections.txt
@@ -8098,6 +8098,7 @@ GtkFlowBox
gtk_flow_box_new
gtk_flow_box_insert
gtk_flow_box_get_child_at_index
+gtk_flow_box_get_child_at_pos
gtk_flow_box_set_hadjustment
gtk_flow_box_set_vadjustment
diff --git a/gtk/gtkflowbox.c b/gtk/gtkflowbox.c
index 67a849f..a2fa21e 100644
--- a/gtk/gtkflowbox.c
+++ b/gtk/gtkflowbox.c
@@ -893,31 +893,6 @@ get_visible_children (GtkFlowBox *box)
return i;
}
-static GtkFlowBoxChild *
-gtk_flow_box_get_child_at_pos (GtkFlowBox *box,
- gint x,
- gint y)
-{
- GtkWidget *child;
- GSequenceIter *iter;
- GtkAllocation allocation;
-
- for (iter = g_sequence_get_begin_iter (BOX_PRIV (box)->children);
- !g_sequence_iter_is_end (iter);
- iter = g_sequence_iter_next (iter))
- {
- child = g_sequence_get (iter);
- if (!child_is_visible (child))
- continue;
- gtk_widget_get_allocation (child, &allocation);
- if (x >= allocation.x && x < (allocation.x + allocation.width) &&
- y >= allocation.y && y < (allocation.y + allocation.height))
- return GTK_FLOW_BOX_CHILD (child);
- }
-
- return NULL;
-}
-
static void
gtk_flow_box_update_active (GtkFlowBox *box,
GtkFlowBoxChild *child)
@@ -4328,6 +4303,45 @@ gtk_flow_box_get_child_at_index (GtkFlowBox *box,
}
/**
+ * gtk_flow_box_get_child_at_pos:
+ * @box: a #GtkFlowBox
+ * @x: the x coordinate of the child
+ * @y: the y coordinate of the child
+ *
+ * Gets the child in the (@x, @y) position.
+ *
+ * Returns: (transfer none) (nullable): the child widget, which will
+ * always be a #GtkFlowBoxChild or %NULL in case no child widget
+ * exists for the given x and y coordinates.
+ *
+ * Since: 3.22.6
+ */
+GtkFlowBoxChild *
+gtk_flow_box_get_child_at_pos (GtkFlowBox *box,
+ gint x,
+ gint y)
+{
+ GtkWidget *child;
+ GSequenceIter *iter;
+ GtkAllocation allocation;
+
+ for (iter = g_sequence_get_begin_iter (BOX_PRIV (box)->children);
+ !g_sequence_iter_is_end (iter);
+ iter = g_sequence_iter_next (iter))
+ {
+ child = g_sequence_get (iter);
+ if (!child_is_visible (child))
+ continue;
+ gtk_widget_get_allocation (child, &allocation);
+ if (x >= allocation.x && x < (allocation.x + allocation.width) &&
+ y >= allocation.y && y < (allocation.y + allocation.height))
+ return GTK_FLOW_BOX_CHILD (child);
+ }
+
+ return NULL;
+}
+
+/**
* gtk_flow_box_set_hadjustment:
* @box: a #GtkFlowBox
* @adjustment: an adjustment which should be adjusted
diff --git a/gtk/gtkflowbox.h b/gtk/gtkflowbox.h
index ff2a6be..fa059c3 100644
--- a/gtk/gtkflowbox.h
+++ b/gtk/gtkflowbox.h
@@ -181,6 +181,11 @@ GDK_AVAILABLE_IN_3_12
GtkFlowBoxChild *gtk_flow_box_get_child_at_index (GtkFlowBox *box,
gint idx);
+GDK_AVAILABLE_IN_3_22
+GtkFlowBoxChild *gtk_flow_box_get_child_at_pos (GtkFlowBox *box,
+ gint x,
+ gint y);
+
typedef void (* GtkFlowBoxForeachFunc) (GtkFlowBox *box,
GtkFlowBoxChild *child,
gpointer user_data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]