gtk-demo: Tweak descriptions of constraints demos

Make these a little longer, and include more details.
This commit is contained in:
Matthias Clasen 2020-10-30 15:26:37 -04:00
parent 2dbaca2464
commit 19052d4360
4 changed files with 31 additions and 5 deletions

View File

@ -2,8 +2,15 @@
* #Keywords: GtkLayoutManager * #Keywords: GtkLayoutManager
* *
* GtkConstraintLayout provides a layout manager that uses relations * 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. * 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> #include <glib/gi18n.h>

View File

@ -1,7 +1,7 @@
/* Constraints/Interactive /* Constraints/Interactive
* #Keywords: GtkConstraintLayout * #Keywords: GtkConstraintLayout
* *
* Demonstrate how constraints can be updates during user interaction. * This example shows how constraints can be updated during user interaction.
* The vertical edge between the buttons can be dragged with the mouse. * The vertical edge between the buttons can be dragged with the mouse.
*/ */

View File

@ -2,6 +2,10 @@
* *
* GtkConstraintLayout allows defining constraints using a * GtkConstraintLayout allows defining constraints using a
* compact syntax called Visual Format Language, or VFL. * compact syntax called Visual Format Language, or VFL.
*
* A typical example of a VFL specification looks like this:
*
* H:|-[button1(==button2)]-12-[button2]-|
*/ */
#include <glib/gi18n.h> #include <glib/gi18n.h>

View File

@ -1,8 +1,8 @@
/* Constraints/Builder /* Constraints/Builder
* *
* GtkConstraintLayouts can be created in .ui files, and * GtkConstraintLayouts can be created in .ui files, and constraints can be
* constraints can be set up at that time as well, as this * set up at that time as well, as this example demonstrates. It uses the
* example demonstrates. * same setup as the Simple constraints demo.
*/ */
#include <glib/gi18n.h> #include <glib/gi18n.h>
@ -22,9 +22,24 @@ constraints_grid_init (ConstraintsGrid *grid)
{ {
} }
static void
constraints_grid_dispose (GObject *object)
{
GtkWidget *widget = GTK_WIDGET (object);
GtkWidget *child;
while ((child = gtk_widget_get_first_child (widget)))
gtk_widget_unparent (child);
G_OBJECT_CLASS (constraints_grid_parent_class)->dispose (object);
}
static void static void
constraints_grid_class_init (ConstraintsGridClass *klass) constraints_grid_class_init (ConstraintsGridClass *klass)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->dispose = constraints_grid_dispose;
} }
GtkWidget * GtkWidget *