[gtk/wip/matthiasc/box3: 2/4] box: Add insertion apis



commit 17a3aad10bb0dfe398410c29544452f66811fcbc
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Jan 22 18:44:34 2019 -0500

    box: Add insertion apis
    
    Add prepend/append/insert_before/insert_after, which are
    all just simple wrappers around GtkWidget api.

 gtk/gtkbox.c | 30 ++++++++++++++++++++++++++++++
 gtk/gtkbox.h | 16 ++++++++++++++++
 2 files changed, 46 insertions(+)
---
diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c
index 4fc004b740..d952eb7e53 100644
--- a/gtk/gtkbox.c
+++ b/gtk/gtkbox.c
@@ -1164,3 +1164,33 @@ _gtk_box_get_children (GtkBox *box)
 
   return g_list_reverse (retval);
 }
+
+void
+gtk_box_prepend (GtkBox    *box,
+                 GtkWidget *child)
+{
+  gtk_widget_insert_after (child, GTK_WIDGET (box), NULL);
+}
+
+void
+gtk_box_append (GtkBox    *box,
+                GtkWidget *child)
+{
+  gtk_widget_insert_before (child, GTK_WIDGET (box), NULL);
+}
+
+void
+gtk_box_insert_before (GtkBox    *box,
+                       GtkWidget *child,
+                       GtkWidget *sibling)
+{
+  gtk_widget_insert_before (child, GTK_WIDGET (box), sibling);
+}
+
+void
+gtk_box_insert_after (GtkBox    *box,
+                      GtkWidget *child,
+                      GtkWidget *sibling)
+{
+  gtk_widget_insert_after (child, GTK_WIDGET (box), sibling);
+}
diff --git a/gtk/gtkbox.h b/gtk/gtkbox.h
index fd98927e2e..bcf7ebd109 100644
--- a/gtk/gtkbox.h
+++ b/gtk/gtkbox.h
@@ -96,6 +96,22 @@ void        gtk_box_reorder_child       (GtkBox         *box,
                                          GtkWidget      *child,
                                          gint            position);
 
+GDK_AVAILABLE_IN_ALL
+void        gtk_box_prepend             (GtkBox         *box,
+                                         GtkWidget      *child);
+GDK_AVAILABLE_IN_ALL
+void        gtk_box_append              (GtkBox         *box,
+                                         GtkWidget      *child);
+GDK_AVAILABLE_IN_ALL
+void        gtk_box_insert_before       (GtkBox         *box,
+                                         GtkWidget      *child,
+                                         GtkWidget      *sibling);
+GDK_AVAILABLE_IN_ALL
+void        gtk_box_insert_after        (GtkBox         *box,
+                                         GtkWidget      *child,
+                                         GtkWidget      *sibling);
+
+
 G_END_DECLS
 
 #endif /* __GTK_BOX_H__ */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]