]> Pileus Git - ~andy/gtk/blob - gtk/deprecated/gtkhbox.c
filechooserbutton: Test that the expected filename is shown
[~andy/gtk] / gtk / deprecated / gtkhbox.c
1 /* GTK - The GIMP Toolkit
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16  */
17
18 /*
19  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
20  * file for a list of people on the GTK+ Team.  See the ChangeLog
21  * files for a list of changes.  These files are distributed with
22  * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
23  */
24
25 #include "config.h"
26
27 #include "gtkboxprivate.h"
28 #include "gtkorientable.h"
29
30 #include "gtkhbox.h"
31
32
33 /**
34  * SECTION:gtkhbox
35  * @Short_description: A horizontal container box
36  * @Title: GtkHBox
37  * @See_also: #GtkVBox
38  *
39  * #GtkHBox is a container that organizes child widgets into a single row.
40  *
41  * Use the #GtkBox packing interface to determine the arrangement,
42  * spacing, width, and alignment of #GtkHBox children.
43  *
44  * All children are allocated the same height.
45  *
46  * GtkHBox has been deprecated. You can use #GtkBox instead, which is a
47  * very quick and easy change. If you have derived your own classes from
48  * GtkHBox, you can simply change the inheritance to derive directly
49  * from #GtkBox. No further changes are needed, since the default
50  * value of the #GtkOrientable:orientation property is
51  * %GTK_ORIENTATION_HORIZONTAL.
52  * If you want your code to be future-proof, the recommendation is to
53  * switch to #GtkGrid, since #GtkBox is going to be deprecated in favor
54  * of the more flexible grid widget eventually. For more information
55  * about migrating to #GtkGrid, see <xref linkend="gtk-migrating-GtkGrid"/>
56  */
57
58
59 G_DEFINE_TYPE (GtkHBox, gtk_hbox, GTK_TYPE_BOX)
60
61 static void
62 gtk_hbox_class_init (GtkHBoxClass *class)
63 {
64 }
65
66 static void
67 gtk_hbox_init (GtkHBox *hbox)
68 {
69   gtk_orientable_set_orientation (GTK_ORIENTABLE (hbox),
70                                   GTK_ORIENTATION_HORIZONTAL);
71
72   _gtk_box_set_old_defaults (GTK_BOX (hbox));
73 }
74
75 /**
76  * gtk_hbox_new:
77  * @homogeneous: %TRUE if all children are to be given equal space allotments.
78  * @spacing: the number of pixels to place by default between children.
79  *
80  * Creates a new #GtkHBox.
81  *
82  * Returns: a new #GtkHBox.
83  *
84  * Deprecated: 3.2: You can use gtk_box_new() with %GTK_ORIENTATION_HORIZONTAL instead,
85  *   which is a quick and easy change. But the recommendation is to switch to
86  *   #GtkGrid, since #GtkBox is going to go away eventually.
87  *   See <xref linkend="gtk-migrating-GtkGrid"/>.
88  */
89 GtkWidget *
90 gtk_hbox_new (gboolean homogeneous,
91               gint     spacing)
92 {
93   return g_object_new (GTK_TYPE_HBOX,
94                        "spacing",     spacing,
95                        "homogeneous", homogeneous ? TRUE : FALSE,
96                        NULL);
97 }