summaryrefslogtreecommitdiff
path: root/gtk/gtkgrid.c
diff options
context:
space:
mode:
authorUngedummt <ungedummt@gmx.de>2021-01-30 22:05:40 +0100
committerUngedummt <ungedummt@gmx.de>2021-01-31 10:19:14 +0100
commit4d11158d97a38f8a451d75d1e615bc722eb69cfd (patch)
treed20c4e72991cec042fe112c92dd2144e22fffb60 /gtk/gtkgrid.c
parent293b81cad29ad7f18743b8788de1ad84a38e5c9d (diff)
downloadgtk+-4d11158d97a38f8a451d75d1e615bc722eb69cfd.tar.gz
GtkGrid: Add xml example for GtkBuildable to docs
Added an example and a short discription for the properties
Diffstat (limited to 'gtk/gtkgrid.c')
-rw-r--r--gtk/gtkgrid.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/gtk/gtkgrid.c b/gtk/gtkgrid.c
index f5909b7f2f..00ffd6643e 100644
--- a/gtk/gtkgrid.c
+++ b/gtk/gtkgrid.c
@@ -48,6 +48,65 @@
* from the grid, use gtk_grid_remove(). The behaviour of GtkGrid when
* several children occupy the same grid cell is undefined.
*
+ * # GtkGrid as GtkBuildable
+ *
+ * Every child in a GtkGrid has access to a custom #GtkBuildable element, called ´<layout>´.
+ * It can by used to specify a position in the grid and optionally spans.
+ * All properties that can be used in the ´<layout>´ element are implemented by #GtkGridLayoutChild.
+ *
+ * It is implemented by #GtkWidget using #GtkLayoutManager.
+ *
+ * To showcase it, here is a simple example:
+ *
+ * |[
+ * <object class="GtkGrid" id="my_grid">
+ * <child>
+ * <object class="GtkButton" id="button1">
+ * <property name="label">Button 1</property>
+ * <layout>
+ * <property name="column">0</property>
+ * <property name="row">0</property>
+ * </layout>
+ * </object>
+ * </child>
+ * <child>
+ * <object class="GtkButton" id="button2">
+ * <property name="label">Button 2</property>
+ * <layout>
+ * <property name="column">1</property>
+ * <property name="row">0</property>
+ * </layout>
+ * </object>
+ * </child>
+ * <child>
+ * <object class="GtkButton" id="button3">
+ * <property name="label">Button 3</property>
+ * <layout>
+ * <property name="column">2</property>
+ * <property name="row">0</property>
+ * <property name="row-span">2</property>
+ * </layout>
+ * </object>
+ * </child>
+ * <child>
+ * <object class="GtkButton" id="button4">
+ * <property name="label">Button 4</property>
+ * <layout>
+ * <property name="column">0</property>
+ * <property name="row">1</property>
+ * <property name="column-span">2</property>
+ * </layout>
+ * </object>
+ * </child>
+ * </object>
+ * ]|
+ *
+ * It organizes the first two buttons side-by-side in one cell each.
+ * The third button is in the last column but spans across two rows.
+ * This is defined by the ´row-span´ property.
+ * The last button is located in the second row and spans across two columns,
+ * which is defined by the ´column-span´ property.
+ *
* # CSS nodes
*
* GtkGrid uses a single CSS node with name `grid`.