]> Pileus Git - ~andy/gtk/blob - gtk/gtkorientable.c
Use G_DEFINE_INTERFACE macro in gtkorientable
[~andy/gtk] / gtk / gtkorientable.c
1 /* GTK - The GIMP Toolkit
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3  *
4  * gtkorientable.c
5  * Copyright (C) 2008 Imendio AB
6  * Contact: Michael Natterer <mitch@imendio.com>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the
20  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23
24 #include "config.h"
25
26 #include "gtkorientable.h"
27 #include "gtkprivate.h"
28 #include "gtkintl.h"
29 #include "gtkalias.h"
30
31
32 typedef GtkOrientableIface GtkOrientableInterface;
33 G_DEFINE_INTERFACE (GtkOrientable, gtk_orientable, G_OBJECT_TYPE)
34
35 static void
36 gtk_orientable_default_init (GtkOrientableInterface *iface)
37 {
38   /**
39    * GtkOrientable:orientation:
40    *
41    * The orientation of the orientable.
42    *
43    * Since: 2.16
44    **/
45   g_object_interface_install_property (iface,
46                                        g_param_spec_enum ("orientation",
47                                                           P_("Orientation"),
48                                                           P_("The orientation of the orientable"),
49                                                           GTK_TYPE_ORIENTATION,
50                                                           GTK_ORIENTATION_HORIZONTAL,
51                                                           GTK_PARAM_READWRITE));
52 }
53
54 /**
55  * gtk_orientable_set_orientation:
56  * @orientable: a #GtkOrientable
57  * @orientation: the orientable's new orientation.
58  *
59  * Sets the orientation of the @orientable.
60  *
61  * Since: 2.16
62  **/
63 void
64 gtk_orientable_set_orientation (GtkOrientable  *orientable,
65                                 GtkOrientation  orientation)
66 {
67   g_return_if_fail (GTK_IS_ORIENTABLE (orientable));
68
69   g_object_set (orientable,
70                 "orientation", orientation,
71                 NULL);
72 }
73
74 /**
75  * gtk_orientable_get_orientation:
76  * @orientable: a #GtkOrientable
77  *
78  * Retrieves the orientation of the @orientable.
79  *
80  * Return value: the orientation of the @orientable.
81  *
82  * Since: 2.16
83  **/
84 GtkOrientation
85 gtk_orientable_get_orientation (GtkOrientable *orientable)
86 {
87   GtkOrientation orientation;
88
89   g_return_val_if_fail (GTK_IS_ORIENTABLE (orientable),
90                         GTK_ORIENTATION_HORIZONTAL);
91
92   g_object_get (orientable,
93                 "orientation", &orientation,
94                 NULL);
95
96   return orientation;
97 }
98
99 #define __GTK_ORIENTABLE_C__
100 #include "gtkaliasdef.c"