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
27 * SECTION:hildon-bread-crumb
28 * @short_description: Interface for elements in a #HildonBreadCrumbTrail
30 * #HildonBreadCrumb is an interface for creating new types of items
31 * for the #HildonBreadCrumbTrail widget.
34 #include "hildon-bread-crumb.h"
36 static void hildon_bread_crumb_base_init (gpointer g_class);
39 hildon_bread_crumb_get_type (void)
41 static GType bread_crumb_type = 0;
43 if (G_UNLIKELY (bread_crumb_type == 0))
45 const GTypeInfo bread_crumb_info =
47 sizeof (HildonBreadCrumbIface), /* class_size */
48 hildon_bread_crumb_base_init, /* base_init */
49 NULL, /* base_finalize */
51 NULL, /* class_finalize */
52 NULL, /* class_data */
59 g_type_register_static (G_TYPE_INTERFACE, "HildonBreadCrumb",
60 &bread_crumb_info, 0);
62 g_type_interface_add_prerequisite (bread_crumb_type, GTK_TYPE_WIDGET);
65 return bread_crumb_type;
69 hildon_bread_crumb_base_init (gpointer g_class)
71 static gboolean initialized = FALSE;
73 if (initialized == FALSE)
75 g_signal_new ("crumb-activated",
76 HILDON_TYPE_BREAD_CRUMB,
78 G_STRUCT_OFFSET (HildonBreadCrumbIface, crumb_activated),
80 g_cclosure_marshal_VOID__VOID,
88 * hildon_bread_crumb_get_natural_size:
89 * @bread_crumb: A #HildonBreadCrumb
90 * @width: location to store the natural width request of the @bread_crumb
91 * @height: location to store the natural height request of the @bread_crumb
93 * Function to ask the @bread_crumb its preferred width and height requisition.
94 * Natural size is different to size_request in that it's not the minimum space
95 * the widget needs, but the ideal space it'd like to be allocated. For example,
96 * in the case of a label the natural size would be the width and height needed
97 * to show the full label without line breaks.
102 hildon_bread_crumb_get_natural_size (HildonBreadCrumb *bread_crumb,
106 g_return_if_fail (HILDON_IS_BREAD_CRUMB (bread_crumb));
108 (* HILDON_BREAD_CRUMB_GET_IFACE (bread_crumb)->get_natural_size) (bread_crumb, width, height);
112 * hildon_bread_crumb_activated:
113 * @bread_crumb: a #HildonBreadCrumb
115 * Emits the "crumb-activated" signal. The signal is meant to indicate that
116 * the user has interacted with the bread crumb.
120 hildon_bread_crumb_activated (HildonBreadCrumb *bread_crumb)
122 g_return_if_fail (HILDON_IS_BREAD_CRUMB (bread_crumb));
124 g_signal_emit_by_name (bread_crumb, "crumb-activated");