diff options
author | Debarshi Ray <debarshir@gnome.org> | 2016-12-17 00:30:39 +0100 |
---|---|---|
committer | Debarshi Ray <debarshir@gnome.org> | 2016-12-20 00:35:17 +0100 |
commit | 7ea199c831b20df78d42ffc1ffb11f0ffa17eb54 (patch) | |
tree | e0c2875633de2424f50673a9f1312342ee93dc35 /gtk/gtkflowbox.c | |
parent | faf22954402f49786ecee43b4b6bef7dbe887388 (diff) | |
download | gtk+-7ea199c831b20df78d42ffc1ffb11f0ffa17eb54.tar.gz |
flowbox: Export gtk_flow_box_get_child_at_pos as public API
https://bugzilla.gnome.org/show_bug.cgi?id=776187
Diffstat (limited to 'gtk/gtkflowbox.c')
-rw-r--r-- | gtk/gtkflowbox.c | 64 |
1 files changed, 39 insertions, 25 deletions
diff --git a/gtk/gtkflowbox.c b/gtk/gtkflowbox.c index eb448795a4..f1e7af1b35 100644 --- a/gtk/gtkflowbox.c +++ b/gtk/gtkflowbox.c @@ -856,31 +856,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) @@ -4279,6 +4254,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 |