diff options
Diffstat (limited to 'demos/gtk-demo/constraints.c')
-rw-r--r-- | demos/gtk-demo/constraints.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/demos/gtk-demo/constraints.c b/demos/gtk-demo/constraints.c index 2e31f22462..a295c91d44 100644 --- a/demos/gtk-demo/constraints.c +++ b/demos/gtk-demo/constraints.c @@ -1,9 +1,16 @@ -/* Constraints/Simple +/* Constraints/Simple Constraints * #Keywords: GtkLayoutManager * * GtkConstraintLayout provides a layout manager that uses relations - * between widgets (also known as "constraints") to compute the position + * between widgets (also known as “constraints”) to compute the position * and size of each child. + * + * In addition to child widgets, the constraints can involve spacer + * objects (also known as “guides”). This example has a guide between + * the two buttons in the top row. + * + * Try resizing the window to see how the constraints react to update + * the layout. */ #include <glib/gi18n.h> @@ -234,15 +241,12 @@ simple_grid_init (SimpleGrid *self) self->button1 = gtk_button_new_with_label ("Child 1"); gtk_widget_set_parent (self->button1, widget); - gtk_widget_set_name (self->button1, "button1"); self->button2 = gtk_button_new_with_label ("Child 2"); gtk_widget_set_parent (self->button2, widget); - gtk_widget_set_name (self->button2, "button2"); self->button3 = gtk_button_new_with_label ("Child 3"); gtk_widget_set_parent (self->button3, widget); - gtk_widget_set_name (self->button3, "button3"); GtkLayoutManager *manager = gtk_widget_get_layout_manager (GTK_WIDGET (self)); build_constraints (self, GTK_CONSTRAINT_LAYOUT (manager)); @@ -259,7 +263,8 @@ do_constraints (GtkWidget *do_widget) window = gtk_window_new (); gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget)); - gtk_window_set_title (GTK_WINDOW (window), "Constraints"); + gtk_window_set_title (GTK_WINDOW (window), "Simple Constraints"); + gtk_window_set_default_size (GTK_WINDOW (window), 260, -1); g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window); box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); |