2 * This file is a part of hildon
4 * Copyright (C) 2007 Nokia Corporation, all rights reserved.
6 * Contact: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
7 * Author: Xan Lopez <xan.lopez@nokia.com>
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; version 2.1 of
12 * the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
26 #include "hildon-bread-crumb.h"
28 static void hildon_bread_crumb_base_init (gpointer g_class);
31 hildon_bread_crumb_get_type (void)
33 static GType bread_crumb_type = 0;
35 if (G_UNLIKELY (bread_crumb_type == 0))
37 const GTypeInfo bread_crumb_info =
39 sizeof (HildonBreadCrumbIface), /* class_size */
40 hildon_bread_crumb_base_init, /* base_init */
41 NULL, /* base_finalize */
43 NULL, /* class_finalize */
44 NULL, /* class_data */
51 g_type_register_static (G_TYPE_INTERFACE, "HildonBreadCrumb",
52 &bread_crumb_info, 0);
54 g_type_interface_add_prerequisite (bread_crumb_type, GTK_TYPE_WIDGET);
57 return bread_crumb_type;
61 hildon_bread_crumb_base_init (gpointer g_class)
63 static gboolean initialized = FALSE;
65 if (initialized == FALSE)
67 g_signal_new ("crumb-activated",
68 HILDON_TYPE_BREAD_CRUMB,
70 G_STRUCT_OFFSET (HildonBreadCrumbIface, crumb_activated),
72 g_cclosure_marshal_VOID__VOID,
80 * hildon_bread_crumb_get_natural_size:
81 * @bread_crumb: A #HildonBreadCrumb
82 * @width: location to store the natural width request of the @bread_crumb
83 * @height: location to store the natural height request of the @bread_crumb
85 * Function to ask the @bread_crumb its preferred width and height requisition.
86 * Natural size is different to size_request in that it's not the minimum space
87 * the widget needs, but the ideal space it'd like to be allocated. For example,
88 * in the case of a label the natural size would be the width and height needed
89 * to show the full label without line breaks.
94 hildon_bread_crumb_get_natural_size (HildonBreadCrumb *bread_crumb,
98 g_return_if_fail (HILDON_IS_BREAD_CRUMB (bread_crumb));
100 (* HILDON_BREAD_CRUMB_GET_IFACE (bread_crumb)->get_natural_size) (bread_crumb, width, height);
104 * hildon_bread_crumb_activated:
105 * @bread_crumb: a #HildonBreadCrumb
107 * Emits the "crumb-activated" signal. The signal is meant to indicate that
108 * the user has interacted with the bread crumb.
112 hildon_bread_crumb_activated (HildonBreadCrumb *bread_crumb)
114 g_return_if_fail (HILDON_IS_BREAD_CRUMB (bread_crumb));
116 g_signal_emit_by_name (bread_crumb, "crumb-activated");