boxgadget: add APIs to insert gadgets next to siblings

This commit is contained in:
Cosimo Cecchi 2016-02-24 12:00:46 -08:00
parent 6401e2405e
commit 6370d6cb27
2 changed files with 47 additions and 0 deletions

View File

@ -690,6 +690,40 @@ expand_func_from_flags (gboolean hexpand,
: (vexpand ? only_vertical : (ComputeExpandFunc) gtk_false);
}
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,

View File

@ -72,6 +72,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);