/usr/share/gtk-doc/html/clutter/ClutterConstraint.html is in libclutter-1.0-doc 1.20.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Clutter Reference Manual: ClutterConstraint</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="index.html" title="Clutter Reference Manual">
<link rel="up" href="ch01.html" title="Abstract classes and interfaces">
<link rel="prev" href="ClutterAction.html" title="ClutterAction">
<link rel="next" href="ClutterEffect.html" title="ClutterEffect">
<meta name="generator" content="GTK-Doc V1.21 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span>
<a href="#ClutterConstraint.description" class="shortcut">Description</a></span><span id="nav_hierarchy"> <span class="dim">|</span>
<a href="#ClutterConstraint.object-hierarchy" class="shortcut">Object Hierarchy</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="ClutterAction.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="ClutterEffect.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="ClutterConstraint"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="ClutterConstraint.top_of_page"></a>ClutterConstraint</span></h2>
<p>ClutterConstraint — Abstract class for constraints on position or size</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="ClutterConstraint.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="name">
<col class="description">
</colgroup>
<tbody>
<tr>
<td class="datatype_keyword"> </td>
<td class="function_name"><a class="link" href="ClutterConstraint.html#ClutterConstraint-struct" title="ClutterConstraint">ClutterConstraint</a></td>
</tr>
<tr>
<td class="datatype_keyword">struct</td>
<td class="function_name"><a class="link" href="ClutterConstraint.html#ClutterConstraintClass" title="struct ClutterConstraintClass">ClutterConstraintClass</a></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="ClutterConstraint.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="screen"> GObject
<span class="lineart">╰──</span> GInitiallyUnowned
<span class="lineart">╰──</span> <a class="link" href="ClutterActorMeta.html" title="ClutterActorMeta">ClutterActorMeta</a>
<span class="lineart">╰──</span> ClutterConstraint
<span class="lineart">├──</span> <a class="link" href="ClutterAlignConstraint.html" title="ClutterAlignConstraint">ClutterAlignConstraint</a>
<span class="lineart">├──</span> <a class="link" href="ClutterBindConstraint.html" title="ClutterBindConstraint">ClutterBindConstraint</a>
<span class="lineart">├──</span> <a class="link" href="ClutterPathConstraint.html" title="ClutterPathConstraint">ClutterPathConstraint</a>
<span class="lineart">╰──</span> <a class="link" href="ClutterSnapConstraint.html" title="ClutterSnapConstraint">ClutterSnapConstraint</a>
</pre>
</div>
<div class="refsect1">
<a name="ClutterConstraint.description"></a><h2>Description</h2>
<p><a class="link" href="ClutterConstraint.html" title="ClutterConstraint"><span class="type">ClutterConstraint</span></a> is a base abstract class for modifiers of a <a class="link" href="ClutterActor.html" title="ClutterActor"><span class="type">ClutterActor</span></a>
position or size.</p>
<p>A <a class="link" href="ClutterConstraint.html" title="ClutterConstraint"><span class="type">ClutterConstraint</span></a> sub-class should contain the logic for modifying
the position or size of the <a class="link" href="ClutterActor.html" title="ClutterActor"><span class="type">ClutterActor</span></a> to which it is applied, by
updating the actor's allocation. Each <a class="link" href="ClutterConstraint.html" title="ClutterConstraint"><span class="type">ClutterConstraint</span></a> can change the
allocation of the actor to which they are applied by overriding the
<a class="link" href="ClutterConstraint.html#ClutterConstraintClass.update-allocation"><code class="function">ClutterConstraintClass.update_allocation()</code></a> virtual function.</p>
<p><a class="link" href="ClutterConstraint.html" title="ClutterConstraint"><span class="type">ClutterConstraint</span></a> is available since Clutter 1.4</p>
<div class="refsect3">
<a name="id-1.5.2.10.5.5"></a><h4>Using Constraints</h4>
<p>Constraints can be used with fixed layout managers, like
<a class="link" href="ClutterFixedLayout.html" title="ClutterFixedLayout"><span class="type">ClutterFixedLayout</span></a>, or with actors implicitly using a fixed layout
manager, like <a class="link" href="ClutterGroup.html" title="ClutterGroup"><span class="type">ClutterGroup</span></a> and <a class="link" href="ClutterStage.html" title="ClutterStage"><span class="type">ClutterStage</span></a>.</p>
<p>Constraints provide a way to build user interfaces by using
relations between <a href="ClutterActor.html"><span class="type">ClutterActors</span></a>, without explicit fixed
positioning and sizing, similarly to how fluid layout managers like
<a class="link" href="ClutterBoxLayout.html" title="ClutterBoxLayout"><span class="type">ClutterBoxLayout</span></a> and <a class="link" href="ClutterTableLayout.html" title="ClutterTableLayout"><span class="type">ClutterTableLayout</span></a> lay out their children.</p>
<p>Constraints are attached to a <a class="link" href="ClutterActor.html" title="ClutterActor"><span class="type">ClutterActor</span></a>, and are available
for inspection using <a class="link" href="ClutterActor.html#clutter-actor-get-constraints" title="clutter_actor_get_constraints ()"><code class="function">clutter_actor_get_constraints()</code></a>.</p>
<p>Clutter provides different implementation of the <a class="link" href="ClutterConstraint.html" title="ClutterConstraint"><span class="type">ClutterConstraint</span></a>
abstract class, for instance:</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem"><p><a class="link" href="ClutterAlignConstraint.html" title="ClutterAlignConstraint"><span class="type">ClutterAlignConstraint</span></a>, a constraint that can be used to align
an actor to another one on either the horizontal or the vertical
axis, using a normalized value between 0 and 1.</p></li>
<li class="listitem"><p><a class="link" href="ClutterBindConstraint.html" title="ClutterBindConstraint"><span class="type">ClutterBindConstraint</span></a>, a constraint binds the X, Y, width or height
of an actor to the corresponding position or size of a source actor,
with or without an offset.</p></li>
<li class="listitem"><p><a class="link" href="ClutterSnapConstraint.html" title="ClutterSnapConstraint"><span class="type">ClutterSnapConstraint</span></a>, a constraint that "snaps" together the edges
of two <a href="ClutterActor.html"><span class="type">ClutterActors</span></a>; if an actor uses two constraints on both its
horizontal or vertical edges then it can also expand to fit the empty
space.</p></li>
</ul></div>
<p>The <a class="ulink" href="https://git.gnome.org/browse/clutter/tree/examples/constraints.c?h=clutter-1.18" target="_top">constraints example</a>
uses various types of <a href="ClutterConstraint.html"><span class="type">ClutterConstraints</span></a> to lay out three actors on a
resizable stage. Only the central actor has an explicit size, and no
actor has an explicit position.</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem"><p>The <a class="link" href="ClutterActor.html" title="ClutterActor"><span class="type">ClutterActor</span></a> with <a class="link" href="ClutterActor.html#ClutterActor--name" title="The “name” property"><span class="type">“name”</span></a> <code class="literal">layerA</code> is explicitly
sized to 100 pixels by 25 pixels, and it's added to the <a class="link" href="ClutterStage.html" title="ClutterStage"><span class="type">ClutterStage</span></a></p></li>
<li class="listitem"><p>two <a href="ClutterAlignConstraint.html"><span class="type">ClutterAlignConstraints</span></a> are used to anchor <code class="literal">layerA</code> to the
center of the stage, by using 0.5 as the alignment <a class="link" href="ClutterAlignConstraint.html#ClutterAlignConstraint--factor" title="The “factor” property"><span class="type">“factor”</span></a> on
both the X and Y axis</p></li>
<li class="listitem"><p>the <a class="link" href="ClutterActor.html" title="ClutterActor"><span class="type">ClutterActor</span></a> with <a class="link" href="ClutterActor.html#ClutterActor--name" title="The “name” property"><span class="type">“name”</span></a> <code class="literal">layerB</code> is added to the
<a class="link" href="ClutterStage.html" title="ClutterStage"><span class="type">ClutterStage</span></a> with no explicit size</p></li>
<li class="listitem"><p>the <a class="link" href="ClutterActor.html#ClutterActor--x" title="The “x” property"><span class="type">“x”</span></a> and <a class="link" href="ClutterActor.html#ClutterActor--width" title="The “width” property"><span class="type">“width”</span></a> of <code class="literal">layerB</code> are bound
to the same properties of <code class="literal">layerA</code> using two <a class="link" href="ClutterBindConstraint.html" title="ClutterBindConstraint"><span class="type">ClutterBindConstraint</span></a>
objects, thus keeping <code class="literal">layerB</code> aligned to <code class="literal">layerA</code></p></li>
<li class="listitem"><p>the top edge of <code class="literal">layerB</code> is snapped together with the bottom edge
of <code class="literal">layerA</code>; the bottom edge of <code class="literal">layerB</code> is also snapped together with
the bottom edge of the <a class="link" href="ClutterStage.html" title="ClutterStage"><span class="type">ClutterStage</span></a>; an offset is given to the two
<span class="type">ClutterSnapConstraintss</span> to allow for some padding; since <code class="literal">layerB</code> is
snapped between two different <a href="ClutterActor.html"><span class="type">ClutterActors</span></a>, its height is stretched
to match the gap</p></li>
<li class="listitem"><p>the <a class="link" href="ClutterActor.html" title="ClutterActor"><span class="type">ClutterActor</span></a> with <a class="link" href="ClutterActor.html#ClutterActor--name" title="The “name” property"><span class="type">“name”</span></a> <code class="literal">layerC</code> mirrors <code class="literal">layerB</code>,
snapping the top edge of the <a class="link" href="ClutterStage.html" title="ClutterStage"><span class="type">ClutterStage</span></a> to the top edge of <code class="literal">layerC</code>
and the top edge of <code class="literal">layerA</code> to the bottom edge of <code class="literal">layerC</code></p></li>
</ul></div>
<p>You can try resizing interactively the <a class="link" href="ClutterStage.html" title="ClutterStage"><span class="type">ClutterStage</span></a> and verify
that the three <a href="ClutterActor.html"><span class="type">ClutterActors</span></a> maintain the same position and
size relative to each other, and to the <a class="link" href="ClutterStage.html" title="ClutterStage"><span class="type">ClutterStage</span></a>.</p>
<p>It is important to note that Clutter does not avoid loops or
competing constraints; if two or more <a href="ClutterConstraint.html"><span class="type">ClutterConstraints</span></a>
are operating on the same positional or dimensional attributes of an
actor, or if the constraints on two different actors depend on each
other, then the behavior is undefined.</p>
</div>
<div class="refsect3">
<a name="id-1.5.2.10.5.6"></a><h4>Implementing a ClutterConstraint</h4>
<p>Creating a sub-class of <a class="link" href="ClutterConstraint.html" title="ClutterConstraint"><span class="type">ClutterConstraint</span></a> requires the
implementation of the <a class="link" href="ClutterConstraint.html#ClutterConstraintClass.update-allocation"><code class="function">ClutterConstraintClass.update_allocation()</code></a>
virtual function.</p>
<p>The <code class="literal"><code class="function">update_allocation()</code></code> virtual function is called during the
allocation sequence of a <a class="link" href="ClutterActor.html" title="ClutterActor"><span class="type">ClutterActor</span></a>, and allows any <a class="link" href="ClutterConstraint.html" title="ClutterConstraint"><span class="type">ClutterConstraint</span></a>
attached to that actor to modify the allocation before it is passed to
the actor's <a class="link" href="ClutterActor.html#ClutterActorClass.allocate"><code class="function">ClutterActorClass.allocate()</code></a> implementation.</p>
<p>The <a class="link" href="clutter-Base-geometric-types.html#ClutterActorBox" title="struct ClutterActorBox"><span class="type">ClutterActorBox</span></a> passed to the <code class="literal"><code class="function">update_allocation()</code></code> implementation
contains the original allocation of the <a class="link" href="ClutterActor.html" title="ClutterActor"><span class="type">ClutterActor</span></a>, plus the eventual
modifications applied by the other <a href="ClutterConstraint.html"><span class="type">ClutterConstraints</span></a>, in the same order
the constraints have been applied to the actor.</p>
<p>It is not necessary for a <a class="link" href="ClutterConstraint.html" title="ClutterConstraint"><span class="type">ClutterConstraint</span></a> sub-class to chain
up to the parent's implementation.</p>
<p>If a <a class="link" href="ClutterConstraint.html" title="ClutterConstraint"><span class="type">ClutterConstraint</span></a> is parametrized - i.e. if it contains
properties that affect the way the constraint is implemented - it should
call <a class="link" href="ClutterActor.html#clutter-actor-queue-relayout" title="clutter_actor_queue_relayout ()"><code class="function">clutter_actor_queue_relayout()</code></a> on the actor to which it is attached
to whenever any parameter is changed. The actor to which it is attached
can be recovered at any point using <a class="link" href="ClutterActorMeta.html#clutter-actor-meta-get-actor" title="clutter_actor_meta_get_actor ()"><code class="function">clutter_actor_meta_get_actor()</code></a>.</p>
</div>
</div>
<div class="refsect1">
<a name="ClutterConstraint.functions_details"></a><h2>Functions</h2>
</div>
<div class="refsect1">
<a name="ClutterConstraint.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="ClutterConstraint-struct"></a><h3>ClutterConstraint</h3>
<pre class="programlisting">typedef struct _ClutterConstraint ClutterConstraint;</pre>
<p>The <a class="link" href="ClutterConstraint.html" title="ClutterConstraint"><span class="type">ClutterConstraint</span></a> structure contains only
private data and should be accessed using the provided API</p>
<p class="since">Since 1.4</p>
</div>
<hr>
<div class="refsect2">
<a name="ClutterConstraintClass"></a><h3>struct ClutterConstraintClass</h3>
<pre class="programlisting">struct ClutterConstraintClass {
void (* update_allocation) (ClutterConstraint *constraint,
ClutterActor *actor,
ClutterActorBox *allocation);
};
</pre>
<p>The <a class="link" href="ClutterConstraint.html#ClutterConstraintClass" title="struct ClutterConstraintClass"><span class="type">ClutterConstraintClass</span></a> structure contains
only private data</p>
<div class="refsect3">
<a name="id-1.5.2.10.7.3.5"></a><h4>Members</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="300px" class="struct_members_name">
<col class="struct_members_description">
<col width="200px" class="struct_members_annotations">
</colgroup>
<tbody><tr>
<td class="struct_member_name"><p><em class="structfield"><code><a name="ClutterConstraintClass.update-allocation"></a>update_allocation</code></em> ()</p></td>
<td class="struct_member_description"><p>virtual function used to update the allocation
of the <a class="link" href="ClutterActor.html" title="ClutterActor"><span class="type">ClutterActor</span></a> using the <a class="link" href="ClutterConstraint.html" title="ClutterConstraint"><span class="type">ClutterConstraint</span></a></p></td>
<td class="struct_member_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<p class="since">Since 1.4</p>
</div>
</div>
<div class="refsect1">
<a name="ClutterConstraint.see-also"></a><h2>See Also</h2>
<p><a class="link" href="ClutterAction.html" title="ClutterAction"><span class="type">ClutterAction</span></a></p>
</div>
</div>
<div class="footer">
<hr>
Generated by GTK-Doc V1.21</div>
</body>
</html>
|