[gtk+/wip/cosimoc/range-gadget: 18/26] boxgadget: add APIs to insert gadgets next to siblings



commit fdbd620344c27271106c803695b4f5e4d9cb90c2
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Wed Feb 24 12:00:46 2016 -0800

    boxgadget: add APIs to insert gadgets next to siblings

 gtk/gtkboxgadget.c        |   34 ++++++++++++++++++++++++++++++++++
 gtk/gtkboxgadgetprivate.h |   13 +++++++++++++
 2 files changed, 47 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkboxgadget.c b/gtk/gtkboxgadget.c
index 60c279f..e05d85e 100644
--- a/gtk/gtkboxgadget.c
+++ b/gtk/gtkboxgadget.c
@@ -679,6 +679,40 @@ expand_func_from_flags (gboolean hexpand,
 }
 
 void
+gtk_box_gadget_insert_gadget_before (GtkBoxGadget *gadget,
+                                     GtkCssGadget *sibling,
+                                     GtkCssGadget *cssgadget,
+                                     gboolean      hexpand,
+                                     gboolean      vexpand,
+                                     GtkAlign      align)
+{
+  /* Insert at the end if no sibling specified */
+  int pos = -1;
+
+  if (sibling)
+    gtk_box_gadget_find_object (gadget, G_OBJECT (sibling), &pos);
+
+  gtk_box_gadget_insert_gadget (gadget, pos, cssgadget, hexpand, vexpand, align);
+}
+
+void
+gtk_box_gadget_insert_gadget_after (GtkBoxGadget *gadget,
+                                    GtkCssGadget *sibling,
+                                    GtkCssGadget *cssgadget,
+                                    gboolean      hexpand,
+                                    gboolean      vexpand,
+                                    GtkAlign      align)
+{
+  /* Insert at the beginning if no sibling specified */
+  int pos = 0;
+
+  if (sibling && gtk_box_gadget_find_object (gadget, G_OBJECT (sibling), &pos))
+    pos++;
+
+  gtk_box_gadget_insert_gadget (gadget, pos, cssgadget, hexpand, vexpand, align);
+}
+
+void
 gtk_box_gadget_insert_gadget (GtkBoxGadget *gadget,
                               int           pos,
                               GtkCssGadget *cssgadget,
diff --git a/gtk/gtkboxgadgetprivate.h b/gtk/gtkboxgadgetprivate.h
index d01c39d..ce7c445 100644
--- a/gtk/gtkboxgadgetprivate.h
+++ b/gtk/gtkboxgadgetprivate.h
@@ -70,6 +70,19 @@ void                    gtk_box_gadget_insert_gadget            (GtkBoxGadget
                                                                  gboolean                hexpand,
                                                                  gboolean                vexpand,
                                                                  GtkAlign                align);
+void                    gtk_box_gadget_insert_gadget_before     (GtkBoxGadget           *gadget,
+                                                                 GtkCssGadget           *sibling,
+                                                                 GtkCssGadget           *cssgadget,
+                                                                 gboolean                hexpand,
+                                                                 gboolean                vexpand,
+                                                                 GtkAlign                align);
+void                    gtk_box_gadget_insert_gadget_after      (GtkBoxGadget           *gadget,
+                                                                 GtkCssGadget           *sibling,
+                                                                 GtkCssGadget           *cssgadget,
+                                                                 gboolean                hexpand,
+                                                                 gboolean                vexpand,
+                                                                 GtkAlign                align);
+
 void                    gtk_box_gadget_remove_gadget            (GtkBoxGadget           *gadget,
                                                                  GtkCssGadget           *cssgadget);
 void                    gtk_box_gadget_reverse_children         (GtkBoxGadget           *gadget);


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