gtk3/docs/reference/gtk/html/ch30s03.html
2021-04-15 09:52:10 +01:00

69 lines
4.7 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GtkBox versus GtkGrid: spacing: GTK+ 3 Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
<link rel="home" href="index.html" title="GTK+ 3 Reference Manual">
<link rel="up" href="gtk-migrating-GtkGrid.html" title="Migrating from other containers to GtkGrid">
<link rel="prev" href="ch30s02.html" title="GtkBox versus GtkGrid: sizing">
<link rel="next" href="gtk-migrating-checklist.html" title="Migration Details Checklist">
<meta name="generator" content="GTK-Doc V1.33.1 (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"></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="gtk-migrating-GtkGrid.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="ch30s02.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="gtk-migrating-checklist.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="id-1.6.7.6"></a>GtkBox versus GtkGrid: spacing</h2></div></div></div>
<p>
With GtkBox, you have to specify the <a class="link" href="GtkBox.html#GtkBox--spacing" title="The “spacing” property"><span class="type">“spacing”</span></a> when
you construct it. This property specifies the space that
separates the children from each other. Additionally, you
can specify extra space to put around each child individually,
using the <a class="link" href="GtkBox.html" title="GtkBox"><span class="type">GtkBox</span></a> padding child property.
</p>
<p>
GtkGrid is very similar when it comes to spacing between the
children, except that it has two separate properties,
<a class="link" href="GtkGrid.html#GtkGrid--row-spacing" title="The “row-spacing” property"><span class="type">“row-spacing”</span></a> and <a class="link" href="GtkGrid.html#GtkGrid--column-spacing" title="The “column-spacing” property"><span class="type">“column-spacing”</span></a>, for the
space to leave between rows and columns. Note that row-spacing
is the space <span class="emphasis"><em>between</em></span> rows, not inside
a row. So, if you doing a horizontal layout, you need to set
<a class="link" href="GtkGrid.html#GtkGrid--column-spacing" title="The “column-spacing” property"><span class="type">“column-spacing”</span></a>.
</p>
<p>
GtkGrid doesn't have any custom child properties to specify
per-child padding; instead you can use the <a class="link" href="GtkWidget.html#GtkWidget--margin" title="The “margin” property"><span class="type">“margin”</span></a>
property. You can also set different padding on each side with
the <a class="link" href="GtkWidget.html#GtkWidget--margin-left" title="The “margin-left” property"><span class="type">“margin-left”</span></a>, <a class="link" href="GtkWidget.html#GtkWidget--margin-right" title="The “margin-right” property"><span class="type">“margin-right”</span></a>,
<a class="link" href="GtkWidget.html#GtkWidget--margin-top" title="The “margin-top” property"><span class="type">“margin-top”</span></a> and <a class="link" href="GtkWidget.html#GtkWidget--margin-bottom" title="The “margin-bottom” property"><span class="type">“margin-bottom”</span></a> properties.
</p>
<div class="example">
<a name="id-1.6.7.6.5"></a><p class="title"><b>Example 55. Spacing in boxes</b></p>
<div class="example-contents">
<pre class="programlisting">
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (box), child, FALSE, FALSE, 12);
</pre>
<p>This can be done with <a class="link" href="GtkGrid.html" title="GtkGrid"><span class="type">GtkGrid</span></a> as follows:</p>
<pre class="programlisting">
grid = gtk_grid_new ();
gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
g_object_set (child, "margin", 12, NULL);
gtk_grid_attach (GTK_GRID (box), child, 0, 0, 1, 1);
</pre>
</div>
</div>
<br class="example-break">
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.33.1</div>
</body>
</html>