layoutmanager: Convert docs

This commit is contained in:
Matthias Clasen 2021-02-27 10:52:50 -05:00 committed by Emmanuele Bassi
parent 7dd436ab17
commit 3ab954882d
2 changed files with 67 additions and 68 deletions

View File

@ -6,17 +6,16 @@
#include "gtkprivate.h"
/**
* SECTION:gtklayoutchild
* @Title: GtkLayoutChild
* @Short_description: An object containing layout properties
* GtkLayoutChild:
*
* #GtkLayoutChild is the base class for objects that are meant to hold
* layout properties. If a #GtkLayoutManager has per-child properties,
* like their packing type, or the horizontal and vertical span, or the
* icon name, then the layout manager should use a #GtkLayoutChild
* implementation to store those properties.
* `GtkLayoutChild` is the base class for objects that are meant to hold
* layout properties.
*
* A #GtkLayoutChild instance is only ever valid while a widget is part
* If a `GtkLayoutManager` has per-child properties, like their packing type,
* or the horizontal and vertical span, or the icon name, then the layout
* manager should use a `GtkLayoutChild` implementation to store those properties.
*
* A `GtkLayoutChild` instance is only ever valid while a widget is part
* of a layout.
*/
@ -119,9 +118,9 @@ gtk_layout_child_class_init (GtkLayoutChildClass *klass)
gobject_class->constructed = gtk_layout_child_constructed;
/**
* GtkLayoutChild:layout-manager:
* GtkLayoutChild:layout-manager: (attributes org.gtk.Property.get=gtk_layout_child_get_layout_manager)
*
* The layout manager that created the #GtkLayoutChild instance.
* The layout manager that created the `GtkLayoutChild` instance.
*/
layout_child_properties[PROP_LAYOUT_MANAGER] =
g_param_spec_object ("layout-manager",
@ -130,10 +129,11 @@ gtk_layout_child_class_init (GtkLayoutChildClass *klass)
GTK_TYPE_LAYOUT_MANAGER,
GTK_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY);
/**
* GtkLayoutChild:child-widget:
* GtkLayoutChild:child-widget: (attributes org.gtk.Property.get=gtk_layout_child_get_child_widget)
*
* The widget that is associated to the #GtkLayoutChild instance.
* The widget that is associated to the `GtkLayoutChild` instance.
*/
layout_child_properties[PROP_CHILD_WIDGET] =
g_param_spec_object ("child-widget",
@ -152,13 +152,13 @@ gtk_layout_child_init (GtkLayoutChild *self)
}
/**
* gtk_layout_child_get_layout_manager:
* @layout_child: a #GtkLayoutChild
* gtk_layout_child_get_layout_manager: (attributes org.gtk.Method.get_property=layout-manager)
* @layout_child: a `GtkLayoutChild`
*
* Retrieves the #GtkLayoutManager instance that created the
* Retrieves the `GtkLayoutManager` instance that created the
* given @layout_child.
*
* Returns: (transfer none): a #GtkLayoutManager
* Returns: (transfer none): a `GtkLayoutManager`
*/
GtkLayoutManager *
gtk_layout_child_get_layout_manager (GtkLayoutChild *layout_child)
@ -171,10 +171,10 @@ gtk_layout_child_get_layout_manager (GtkLayoutChild *layout_child)
}
/**
* gtk_layout_child_get_child_widget:
* @layout_child: a #GtkLayoutChild
* gtk_layout_child_get_child_widget: (attributes org.gtk.Method.get_property=child-widget)
* @layout_child: a `GtkLayoutChild`
*
* Retrieves the #GtkWidget associated to the given @layout_child.
* Retrieves the `GtkWidget` associated to the given @layout_child.
*
* Returns: (transfer none): a #GtkWidget
*/

View File

@ -18,34 +18,32 @@
*/
/**
* SECTION:gtklayoutmanager
* @Title: GtkLayoutManager
* @Short_description: Base class for layout manager
* GtkLayoutManager:
*
* Layout managers are delegate classes that handle the preferred size
* and the allocation of a container widget.
* and the allocation of a widget.
*
* You typically subclass #GtkLayoutManager if you want to implement a
* You typically subclass `GtkLayoutManager` if you want to implement a
* layout policy for the children of a widget, or if you want to determine
* the size of a widget depending on its contents.
*
* Each #GtkWidget can only have a #GtkLayoutManager instance associated to it
* at any given time; it is possible, though, to replace the layout manager
* instance using gtk_widget_set_layout_manager().
* Each `GtkWidget` can only have a `GtkLayoutManager` instance associated
* to it at any given time; it is possible, though, to replace the layout
* manager instance using [method@Gtk.Widget.set_layout_manager].
*
* ## Layout properties
*
* A layout manager can expose properties for controlling the layout of
* each child, by creating an object type derived from #GtkLayoutChild
* and installing the properties on it as normal GObject properties.
* each child, by creating an object type derived from [class@Gtk.LayoutChild]
* and installing the properties on it as normal `GObject` properties.
*
* Each #GtkLayoutChild instance storing the layout properties for a
* specific child is created through the gtk_layout_manager_get_layout_child()
* method; a #GtkLayoutManager controls the creation of its #GtkLayoutChild
* Each `GtkLayoutChild` instance storing the layout properties for a
* specific child is created through the [method@Gtk.LayoutManager.get_layout_child]
* method; a `GtkLayoutManager` controls the creation of its `GtkLayoutChild`
* instances by overriding the GtkLayoutManagerClass.create_layout_child()
* virtual function. The typical implementation should look like:
*
* |[<!-- language="C" -->
* ```c
* static GtkLayoutChild *
* create_layout_child (GtkLayoutManager *manager,
* GtkWidget *container,
@ -56,19 +54,20 @@
* "child-widget", child,
* NULL);
* }
* ]|
* ```
*
* The #GtkLayoutChild:layout-manager and #GtkLayoutChild:child-widget properties
* on the newly created #GtkLayoutChild instance are mandatory. The
* #GtkLayoutManager will cache the newly created #GtkLayoutChild instance until
* the widget is removed from its parent, or the parent removes the layout
* manager.
* The [property@Gtk.LayoutChild:layout-manager] and
* [property@Gtk.LayoutChild:child-widget] properties
* on the newly created `GtkLayoutChild` instance are mandatory. The
* `GtkLayoutManager` will cache the newly created `GtkLayoutChild` instance
* until the widget is removed from its parent, or the parent removes the
* layout manager.
*
* Each #GtkLayoutManager instance creating a #GtkLayoutChild should use
* gtk_layout_manager_get_layout_child() every time it needs to query the
* layout properties; each #GtkLayoutChild instance should call
* gtk_layout_manager_layout_changed() every time a property is updated, in
* order to queue a new size measuring and allocation.
* Each `GtkLayoutManager` instance creating a `GtkLayoutChild` should use
* [method@Gtk.LayoutManager.get_layout_child] every time it needs to query
* the layout properties; each `GtkLayoutChild` instance should call
* [method@Gtk.LayoutManager.layout_changed] every time a property is
* updated, in order to queue a new size measuring and allocation.
*/
#include "config.h"
@ -293,8 +292,8 @@ gtk_layout_manager_set_root (GtkLayoutManager *layout_manager,
/**
* gtk_layout_manager_measure:
* @manager: a #GtkLayoutManager
* @widget: the #GtkWidget using @manager
* @manager: a `GtkLayoutManager`
* @widget: the `GtkWidget` using @manager
* @orientation: the orientation to measure
* @for_size: Size for the opposite of @orientation; for instance, if
* the @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height
@ -314,7 +313,7 @@ gtk_layout_manager_set_root (GtkLayoutManager *layout_manager,
* Measures the size of the @widget using @manager, for the
* given @orientation and size.
*
* See [GtkWidget's geometry management section][geometry-management] for
* See the [class@Gtk.Widget] documentation on layout management for
* more details.
*/
void
@ -380,13 +379,13 @@ allocate_native_children (GtkWidget *widget)
/**
* gtk_layout_manager_allocate:
* @manager: a #GtkLayoutManager
* @widget: the #GtkWidget using @manager
* @manager: a `GtkLayoutManager`
* @widget: the `GtkWidget` using @manager
* @width: the new width of the @widget
* @height: the new height of the @widget
* @baseline: the baseline position of the @widget, or -1
*
* This function assigns the given @width, @height, and @baseline to
* Assigns the given @width, @height, and @baseline to
* a @widget, and computes the position and sizes of the children of
* the @widget using the layout management policy of @manager.
*/
@ -412,11 +411,11 @@ gtk_layout_manager_allocate (GtkLayoutManager *manager,
/**
* gtk_layout_manager_get_request_mode:
* @manager: a #GtkLayoutManager
* @manager: a `GtkLayoutManager`
*
* Retrieves the request mode of @manager.
*
* Returns: a #GtkSizeRequestMode
* Returns: a `GtkSizeRequestMode`
*/
GtkSizeRequestMode
gtk_layout_manager_get_request_mode (GtkLayoutManager *manager)
@ -433,11 +432,11 @@ gtk_layout_manager_get_request_mode (GtkLayoutManager *manager)
/**
* gtk_layout_manager_get_widget:
* @manager: a #GtkLayoutManager
* @manager: a `GtkLayoutManager`
*
* Retrieves the #GtkWidget using the given #GtkLayoutManager.
* Retrieves the `GtkWidget` using the given `GtkLayoutManager`.
*
* Returns: (transfer none) (nullable): a #GtkWidget
* Returns: (transfer none) (nullable): a `GtkWidget`
*/
GtkWidget *
gtk_layout_manager_get_widget (GtkLayoutManager *manager)
@ -451,12 +450,12 @@ gtk_layout_manager_get_widget (GtkLayoutManager *manager)
/**
* gtk_layout_manager_layout_changed:
* @manager: a #GtkLayoutManager
* @manager: a `GtkLayoutManager`
*
* Queues a resize on the #GtkWidget using @manager, if any.
* Queues a resize on the `GtkWidget` using @manager, if any.
*
* This function should be called by subclasses of #GtkLayoutManager in
* response to changes to their layout management policies.
* This function should be called by subclasses of `GtkLayoutManager`
* in response to changes to their layout management policies.
*/
void
gtk_layout_manager_layout_changed (GtkLayoutManager *manager)
@ -493,19 +492,19 @@ gtk_layout_manager_remove_layout_child (GtkLayoutManager *manager,
/**
* gtk_layout_manager_get_layout_child:
* @manager: a #GtkLayoutManager
* @child: a #GtkWidget
* @manager: a `GtkLayoutManager`
* @child: a `GtkWidget`
*
* Retrieves a #GtkLayoutChild instance for the #GtkLayoutManager, creating
* one if necessary.
* Retrieves a `GtkLayoutChild` instance for the `GtkLayoutManager`,
* creating one if necessary.
*
* The @child widget must be a child of the widget using @manager.
*
* The #GtkLayoutChild instance is owned by the #GtkLayoutManager, and is
* guaranteed to exist as long as @child is a child of the #GtkWidget using
* the given #GtkLayoutManager.
* The `GtkLayoutChild` instance is owned by the `GtkLayoutManager`,
* and is guaranteed to exist as long as @child is a child of the
* `GtkWidget` using the given `GtkLayoutManager`.
*
* Returns: (transfer none): a #GtkLayoutChild
* Returns: (transfer none): a `GtkLayoutChild`
*/
GtkLayoutChild *
gtk_layout_manager_get_layout_child (GtkLayoutManager *manager,