]> Pileus Git - ~andy/gtk/blob - gtk/gtkextendedcell.c
Add new GtkExtendedCell interface
[~andy/gtk] / gtk / gtkextendedcell.c
1 /* gtkextendedcell.c
2  * Copyright (C) 2010 Openismus GmbH
3  *
4  * Author:
5  *      Tristan Van Berkom <tristan.van.berkom@gmail.com>
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public
18  * License along with this library; if not, write to the
19  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  */
22
23
24 #include <config.h>
25 #include "gtkcellrenderer.h"
26 #include "gtkextendedcell.h"
27 #include "gtkintl.h"
28 #include "gtkalias.h"
29
30 GType
31 gtk_extended_cell_get_type (void)
32 {
33   static GType extended_cell_type = 0;
34
35   if (G_UNLIKELY(!extended_cell_type))
36     {
37       extended_cell_type =
38         g_type_register_static_simple (G_TYPE_INTERFACE, I_("GtkExtendedCell"),
39                                        sizeof (GtkExtendedCellIface),
40                                        NULL, 0, NULL, 0);
41
42       g_type_interface_add_prerequisite (extended_cell_type, GTK_TYPE_CELL_RENDERER);
43     }
44   return extended_cell_type;
45 }
46
47 /**
48  * gtk_extended_cell_get_desired_size:
49  * @cell: a #GtkExtendedCell instance
50  * @widget: the #GtkWidget this cell will be rendering to
51  * @minimum_size: location for storing the minimum size, or %NULL
52  * @natural_size: location for storing the preferred size, or %NULL
53  *
54  * Retreives a renderer's desired size.
55  *
56  * Since: 3.0
57  */
58 void
59 gtk_extended_cell_get_desired_size (GtkExtendedCell   *cell,
60                                     GtkWidget         *widget,
61                                     GtkRequisition    *minimum_size,
62                                     GtkRequisition    *natural_size)
63 {
64   GtkExtendedCellIface *iface;
65
66   g_return_if_fail (GTK_IS_EXTENDED_CELL (cell));
67   g_return_if_fail (GTK_IS_WIDGET (widget));
68   g_return_if_fail (NULL != minimum_size || NULL != natural_size);
69
70   iface = GTK_EXTENDED_CELL_GET_IFACE (cell);
71   iface->get_desired_size (cell, widget, minimum_size, natural_size);
72 }
73
74 #define __GTK_EXTENDED_CELL_C__
75 #include "gtkaliasdef.c"