📄 gtkbox.html
字号:
<a class="link" href="GtkBox.html#GtkBox--expand"><span class="type">"expand"</span></a>, <a class="link" href="GtkBox.html#GtkBox--fill"><span class="type">"fill"</span></a>, or <a class="link" href="GtkBox.html#GtkBox--padding"><span class="type">"padding"</span></a> child properties for the child to be added.</p><p>Because GtkBox is a <a class="link" href="GtkContainer.html" title="GtkContainer"><span class="type">GtkContainer</span></a>, you may also use<a class="link" href="GtkContainer.html#gtk-container-add"><code class="function">gtk_container_add()</code></a> to insert widgets into the box, and they will bepacked as if with <a class="link" href="GtkBox.html#gtk-box-pack-start-defaults"><code class="function">gtk_box_pack_start_defaults()</code></a>. Use<a class="link" href="GtkContainer.html#gtk-container-remove"><code class="function">gtk_container_remove()</code></a> to remove widgets from the GtkBox.</p><p>Use <a class="link" href="GtkBox.html#gtk-box-set-homogeneous"><code class="function">gtk_box_set_homogeneous()</code></a> to specify whether or not all childrenof the GtkBox are forced to get the same amount of space.</p><p>Use <a class="link" href="GtkBox.html#gtk-box-set-spacing"><code class="function">gtk_box_set_spacing()</code></a> to determine how much space will beminimally placed between all children in the GtkBox.</p><p>Use <a class="link" href="GtkBox.html#gtk-box-reorder-child"><code class="function">gtk_box_reorder_child()</code></a> to move a GtkBox child to a differentplace in the box.</p><p>Use <a class="link" href="GtkBox.html#gtk-box-set-child-packing"><code class="function">gtk_box_set_child_packing()</code></a> to reset the <a class="link" href="GtkBox.html#GtkBox--expand"><span class="type">"expand"</span></a>, <a class="link" href="GtkBox.html#GtkBox--fill"><span class="type">"fill"</span></a> and <a class="link" href="GtkBox.html#GtkBox--padding"><span class="type">"padding"</span></a> child properties.Use <a class="link" href="GtkBox.html#gtk-box-query-child-packing"><code class="function">gtk_box_query_child_packing()</code></a> to query these fields.</p></div><div class="refsect1" lang="en"><a name="id4239805"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id4239815"></a><h3><a name="GtkBox-struct"></a>GtkBox</h3><a class="indexterm" name="id4239828"></a><pre class="programlisting">typedef struct { GList *children; gint16 spacing; guint homogeneous : 1;} GtkBox;</pre><p>The <a class="link" href="GtkBox.html#GtkBox-struct"><span class="type">GtkBox</span></a> describes an instance of GtkBox and contains the following fields. (These fields should be considered read-only. They should never be set by an application.)</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/glib/glib-Doubly-Linked-Lists.html#GList">GList</a> *<em class="structfield"><code>children</code></em>;</span></p></td><td>a list of children belonging the GtkBox. The data is a list of structures of type <span class="type">GtkBoxChild</span>.</td></tr><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint16">gint16</a> <em class="structfield"><code>spacing</code></em>;</span></p></td><td>the number of pixels to put between children of the GtkBox, zero by default. Use <a class="link" href="GtkBox.html#gtk-box-set-spacing"><code class="function">gtk_box_set_spacing()</code></a> to set this field.</td></tr><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint">guint</a> <em class="structfield"><code>homogeneous</code></em> : 1;</span></p></td><td>a flag that if <ahref="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> forces all children to get equal space in the GtkBox; <ahref="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> by default. Use <a class="link" href="GtkBox.html#gtk-box-set-homogeneous"><code class="function">gtk_box_set_homogeneous()</code></a> to set this field.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id4239978"></a><h3><a name="GtkBoxChild"></a>GtkBoxChild</h3><a class="indexterm" name="id4239991"></a><pre class="programlisting">typedef struct { GtkWidget *widget; guint16 padding; guint expand : 1; guint fill : 1; guint pack : 1; guint is_secondary : 1;} GtkBoxChild;</pre><p>The <span class="type">GtkBoxChild</span> holds a child widget of GtkBox and describeshow the child is to be packed into the GtkBox. Use<a class="link" href="GtkBox.html#gtk-box-query-child-packing"><code class="function">gtk_box_query_child_packing()</code></a> and <a class="link" href="GtkBox.html#gtk-box-set-child-packing"><code class="function">gtk_box_set_child_packing()</code></a> to queryand reset the <em class="structfield"><code>padding</code></em>,<em class="structfield"><code>expand</code></em>, <em class="structfield"><code>fill</code></em>,and <em class="structfield"><code>pack</code></em> fields.</p><p><span class="type">GtkBoxChild</span> contains the following fields. (These fieldsshould be considered read-only. They should never be directly set by anapplication.)</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><a class="link" href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *<em class="structfield"><code>widget</code></em>;</span></p></td><td>the child widget, packed into the GtkBox.</td></tr><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint16">guint16</a> <em class="structfield"><code>padding</code></em>;</span></p></td><td>the number of extra pixels to put between this child and its neighbors, set when packed, zero by default.</td></tr><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint">guint</a> <em class="structfield"><code>expand</code></em> : 1;</span></p></td><td>flag indicates whether extra space should be given to this child. Any extra space given to the parent GtkBox is divided up among all children with this attribute set to <ahref="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>; set when packed, <ahref="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> by default.</td></tr><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint">guint</a> <em class="structfield"><code>fill</code></em> : 1;</span></p></td><td>flag indicates whether any extra space given to this child due to its <em class="parameter"><code>expand</code></em> attribute being set is actually allocated to the child, rather than being used as padding around the widget; set when packed, <ahref="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> by default.</td></tr><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint">guint</a> <em class="structfield"><code>pack</code></em> : 1;</span></p></td><td>one of <a class="link" href="gtk-Standard-Enumerations.html#GtkPackType"><span class="type">GtkPackType</span></a> indicating whether the child is packed with reference to the start (top/left) or end (bottom/right) of the GtkBox.</td></tr><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint">guint</a> <em class="structfield"><code>is_secondary</code></em> : 1;</span></p></td><td><ahref="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the child is secondary</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id4240261"></a><h3><a name="gtk-box-pack-start"></a>gtk_box_pack_start ()</h3><a class="indexterm" name="id4240274"></a><pre class="programlisting">void gtk_box_pack_start (<a class="link" href="GtkBox.html" title="GtkBox">GtkBox</a> *box, <a class="link" href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *child, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a> expand, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a> fill, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint">guint</a> padding);</pre><p>Adds <em class="parameter"><code>child</code></em> to <em class="parameter"><code>box</code></em>, packed with reference to the start of <em class="parameter"><code>box</code></em>.The <em class="parameter"><code>child</code></em> is packed after any other child packed with reference to the start of <em class="parameter"><code>box</code></em>.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>box</code></em> :</span></p></td><td> a <a class="link" href="GtkBox.html" title="GtkBox"><span class="type">GtkBox</span></a></td></tr><tr><td><p><span class="term"><em class="parameter"><code>child</code></em> :</span></p></td><td> the <a class="link" href="GtkWidget.html" title="GtkWidget"><span class="type">GtkWidget</span></a> to be added to <em class="parameter"><code>box</code></em></td></tr><tr><td><p><span class="term"><em class="parameter"><code>expand</code></em> :</span></p></td><td> <ahref="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the new child is to be given extra space allocated to<em class="parameter"><code>box</code></em>. The extra space will be divided evenly between all children of<em class="parameter"><code>box</code></em> that use this option</td></tr><tr><td><p><span class="term"><em class="parameter"><code>fill</code></em> :</span></p></td><td> <ahref="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if space given to <em class="parameter"><code>child</code></em> by the <em class="parameter"><code>expand</code></em> option is actually allocated to <em class="parameter"><code>child</code></em>, rather than just padding it. This parameter has no effect if <em class="parameter"><code>expand</code></em> is set to <ahref="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>. A child is always allocated the full height of a <a class="link" href="GtkHBox.html" title="GtkHBox"><span class="type">GtkHBox</span></a> and the full width of a <a class="link" href="GtkVBox.html" title="GtkVBox"><span class="type">GtkVBox</span></a>. This option affects the other dimension</td></tr><tr><td><p><span class="term"><em class="parameter"><code>padding</code></em> :</span></p></td><td> extra space in pixels to put between this child and its neighbors, over and above the global amount specified by <a class="link" href="GtkBox.html#GtkBox--spacing"><span class="type">"spacing"</span></a> property. If <em class="parameter"><code>child</code></em> is a widget at one of the reference ends of <em class="parameter"><code>box</code></em>, then <em class="parameter"><code>padding</code></em> pixels are also put between <em class="parameter"><code>child</code></em> and the reference edge of <em class="parameter"><code>box</code></em></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id4240589"></a><h3><a name="gtk-box-pack-end"></a>gtk_box_pack_end ()</h3><a class="indexterm" name="id4240602"></a><pre class="programlisting">void gtk_box_pack_end (<a class="link" href="GtkBox.html" title="GtkBox">GtkBox</a> *box, <a class="link" href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *child, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a> expand, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a> fill, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint">guint</a> padding);</pre><p>Adds <em class="parameter"><code>child</code></em> to <em class="parameter"><code>box</code></em>, packed with reference to the end of <em class="parameter"><code>box</code></em>. The <em class="parameter"><code>child</code></em> is packed after (away from end of) any other child packed with reference to the end of <em class="parameter"><code>box</code></em>.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -