box gadget: Implement cross-axis alignment

So far, the box gadget is always allocating all children the
full size in the cross axis. This behavior corresponds to the
align-items: stretch behavior in
https://www.w3.org/TR/css-flexbox-1/#align-items-property
This commit implements the other modes described there.

While widgets have halign/valign properties that we can use for
this, the API for inserting gadgets has to change to take an
extra align parameter. All callers have been updated to pass
GTK_ALIGN_FILL, since that corresponds to the previous behavior.

https://bugzilla.gnome.org/show_bug.cgi?id=760668
This commit is contained in:
Matthias Clasen
2016-01-15 06:47:31 -05:00
parent 662c7b87e2
commit 87171469b7
3 changed files with 131 additions and 15 deletions

View File

@ -21,6 +21,7 @@
#define __GTK_BOX_GADGET_PRIVATE_H__
#include "gtk/gtkcssgadgetprivate.h"
#include "gtk/gtkenums.h"
G_BEGIN_DECLS
@ -65,10 +66,12 @@ void gtk_box_gadget_insert_gadget (GtkBoxGadget
int pos,
GtkCssGadget *cssgadget,
gboolean hexpand,
gboolean vexpand);
gboolean vexpand,
GtkAlign align);
void gtk_box_gadget_remove_gadget (GtkBoxGadget *gadget,
GtkCssGadget *cssgadget);
G_END_DECLS
#endif /* __GTK_BOX_GADGET_PRIVATE_H__ */