New function to get the cell renderers of a cell layout.

2006-12-29  Matthias Clasen  <mclasen@redhat.com>

        * gtk/gtk.symbols:
        * gtk/gtkcelllayout.[hc] (gtk_cell_layout_get_cells):
        New function to get the cell renderers of a cell layout.

        * gtk/gtktreeviewcolumn.c:
        * gtk/gtkcellview.c:
        * gtk/gtkiconview.c: Implement get_cells.
This commit is contained in:
Matthias Clasen 2006-12-29 07:53:01 +00:00 committed by Matthias Clasen
parent b3ef93d8ee
commit 6fa25d074e
10 changed files with 85 additions and 1 deletions

View File

@ -1,3 +1,13 @@
2006-12-29 Matthias Clasen <mclasen@redhat.com>
* gtk/gtk.symbols:
* gtk/gtkcelllayout.[hc] (gtk_cell_layout_get_cells):
New function to get the cell renderers of a cell layout.
* gtk/gtktreeviewcolumn.c:
* gtk/gtkcellview.c:
* gtk/gtkiconview.c: Implement get_cells.
2006-12-28 Matthias Clasen <mclasen@redhat.com> 2006-12-28 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkiconview.c: Use word wrapping by default, and * gtk/gtkiconview.c: Use word wrapping by default, and

View File

@ -1,3 +1,9 @@
2006-12-29 Matthias Clasen <mclasen@redhat.com>
* gtk/gtk-sections.txt: Add gtk_cell_layout_get_cells.
* gtk/gtk-docs.sgml: Add a "Since 2.12" index.
2006-12-22 Matthias Clasen <mclasen@redhat.com> 2006-12-22 Matthias Clasen <mclasen@redhat.com>
* gdk/gdk-sections.txt: Add new functions. * gdk/gdk-sections.txt: Add new functions.

View File

@ -671,5 +671,8 @@ that is, GUI components such as <link linkend="GtkButton">GtkButton</link> or
<index role="2.10"> <index role="2.10">
<title>Index of new symbols in 2.10</title> <title>Index of new symbols in 2.10</title>
</index> </index>
<index role="2.12">
<title>Index of new symbols in 2.12</title>
</index>
</book> </book>

View File

@ -4574,6 +4574,7 @@ GtkCellLayoutIface
GtkCellLayoutDataFunc GtkCellLayoutDataFunc
gtk_cell_layout_pack_start gtk_cell_layout_pack_start
gtk_cell_layout_pack_end gtk_cell_layout_pack_end
gtk_cell_layout_get_cells
gtk_cell_layout_reorder gtk_cell_layout_reorder
gtk_cell_layout_clear gtk_cell_layout_clear
gtk_cell_layout_set_attributes gtk_cell_layout_set_attributes

View File

@ -498,6 +498,7 @@ gtk_cell_layout_clear_attributes
gtk_cell_layout_get_type G_GNUC_CONST gtk_cell_layout_get_type G_GNUC_CONST
gtk_cell_layout_pack_end gtk_cell_layout_pack_end
gtk_cell_layout_pack_start gtk_cell_layout_pack_start
gtk_cell_layout_get_cells
gtk_cell_layout_reorder gtk_cell_layout_reorder
gtk_cell_layout_set_attributes G_GNUC_NULL_TERMINATED gtk_cell_layout_set_attributes G_GNUC_NULL_TERMINATED
gtk_cell_layout_set_cell_data_func gtk_cell_layout_set_cell_data_func

View File

@ -283,5 +283,31 @@ gtk_cell_layout_reorder (GtkCellLayout *cell_layout,
position); position);
} }
/**
* gtk_cell_layout_get_cells:
* @cell_layout: a #GtkCellLayout
*
* Returns the cell renderers which have been added to @cell_layout.
*
* Return value: a list of cell renderers. The list, but not the
* renderers has been newly allocated and should be freed with
* g_list_free() when no longer needed.
*
* Since: 2.12
*/
GList *
gtk_cell_layout_get_cells (GtkCellLayout *cell_layout)
{
GtkCellLayoutIface *iface;
g_return_val_if_fail (GTK_IS_CELL_LAYOUT (cell_layout), NULL);
iface = GTK_CELL_LAYOUT_GET_IFACE (cell_layout);
if (iface->get_cells)
return iface->get_cells (cell_layout);
return NULL;
}
#define __GTK_CELL_LAYOUT_C__ #define __GTK_CELL_LAYOUT_C__
#include "gtkaliasdef.c" #include "gtkaliasdef.c"

View File

@ -68,6 +68,7 @@ struct _GtkCellLayoutIface
void (* reorder) (GtkCellLayout *cell_layout, void (* reorder) (GtkCellLayout *cell_layout,
GtkCellRenderer *cell, GtkCellRenderer *cell,
gint position); gint position);
GList* (* get_cells) (GtkCellLayout *cell_layout);
}; };
GType gtk_cell_layout_get_type (void) G_GNUC_CONST; GType gtk_cell_layout_get_type (void) G_GNUC_CONST;
@ -77,6 +78,7 @@ void gtk_cell_layout_pack_start (GtkCellLayout *cell_layout,
void gtk_cell_layout_pack_end (GtkCellLayout *cell_layout, void gtk_cell_layout_pack_end (GtkCellLayout *cell_layout,
GtkCellRenderer *cell, GtkCellRenderer *cell,
gboolean expand); gboolean expand);
GList *gtk_cell_layout_get_cells (GtkCellLayout *cell_layout);
void gtk_cell_layout_clear (GtkCellLayout *cell_layout); void gtk_cell_layout_clear (GtkCellLayout *cell_layout);
void gtk_cell_layout_set_attributes (GtkCellLayout *cell_layout, void gtk_cell_layout_set_attributes (GtkCellLayout *cell_layout,
GtkCellRenderer *cell, GtkCellRenderer *cell,

View File

@ -103,7 +103,7 @@ static void gtk_cell_view_cell_layout_set_cell_data_func (GtkCellLayout
static void gtk_cell_view_cell_layout_reorder (GtkCellLayout *layout, static void gtk_cell_view_cell_layout_reorder (GtkCellLayout *layout,
GtkCellRenderer *cell, GtkCellRenderer *cell,
gint position); gint position);
static GList * gtk_cell_view_cell_layout_get_cells (GtkCellLayout *layout);
#define GTK_CELL_VIEW_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_CELL_VIEW, GtkCellViewPrivate)) #define GTK_CELL_VIEW_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_CELL_VIEW, GtkCellViewPrivate))
@ -184,6 +184,7 @@ gtk_cell_view_cell_layout_init (GtkCellLayoutIface *iface)
iface->set_cell_data_func = gtk_cell_view_cell_layout_set_cell_data_func; iface->set_cell_data_func = gtk_cell_view_cell_layout_set_cell_data_func;
iface->clear_attributes = gtk_cell_view_cell_layout_clear_attributes; iface->clear_attributes = gtk_cell_view_cell_layout_clear_attributes;
iface->reorder = gtk_cell_view_cell_layout_reorder; iface->reorder = gtk_cell_view_cell_layout_reorder;
iface->get_cells = gtk_cell_view_cell_layout_get_cells;
} }
static void static void
@ -1060,5 +1061,12 @@ gtk_cell_view_get_cell_renderers (GtkCellView *cell_view)
return g_list_reverse (retval); return g_list_reverse (retval);
} }
static GList *
gtk_cell_view_cell_layout_get_cells (GtkCellLayout *layout)
{
return gtk_cell_view_get_cell_renderers (GTK_CELL_VIEW (layout));
}
#define __GTK_CELL_VIEW_C__ #define __GTK_CELL_VIEW_C__
#include "gtkaliasdef.c" #include "gtkaliasdef.c"

View File

@ -383,6 +383,8 @@ static void gtk_icon_view_cell_layout_set_cell_data_func (GtkCel
static void gtk_icon_view_cell_layout_reorder (GtkCellLayout *layout, static void gtk_icon_view_cell_layout_reorder (GtkCellLayout *layout,
GtkCellRenderer *cell, GtkCellRenderer *cell,
gint position); gint position);
static GList * gtk_icon_view_cell_layout_get_cells (GtkCellLayout *layout);
static void gtk_icon_view_item_activate_cell (GtkIconView *icon_view, static void gtk_icon_view_item_activate_cell (GtkIconView *icon_view,
GtkIconViewItem *item, GtkIconViewItem *item,
GtkIconViewCellInfo *cell_info, GtkIconViewCellInfo *cell_info,
@ -893,6 +895,7 @@ gtk_icon_view_cell_layout_init (GtkCellLayoutIface *iface)
iface->set_cell_data_func = gtk_icon_view_cell_layout_set_cell_data_func; iface->set_cell_data_func = gtk_icon_view_cell_layout_set_cell_data_func;
iface->clear_attributes = gtk_icon_view_cell_layout_clear_attributes; iface->clear_attributes = gtk_icon_view_cell_layout_clear_attributes;
iface->reorder = gtk_icon_view_cell_layout_reorder; iface->reorder = gtk_icon_view_cell_layout_reorder;
iface->get_cells = gtk_icon_view_cell_layout_get_cells;
} }
static void static void
@ -4375,6 +4378,22 @@ gtk_icon_view_cell_layout_reorder (GtkCellLayout *layout,
gtk_widget_queue_draw (GTK_WIDGET (icon_view)); gtk_widget_queue_draw (GTK_WIDGET (icon_view));
} }
static GList *
gtk_icon_view_cell_layout_get_cells (GtkCellLayout *layout)
{
GtkIconView *icon_view = (GtkIconView *)layout;
GList *retval = NULL, *l;
for (l = icon_view->priv->cell_list; l; l = l->next)
{
GtkIconViewCellInfo *info = (GtkIconViewCellInfo *)l->data;
retval = g_list_prepend (retval, info->cell);
}
return g_list_reverse (retval);
}
/* Public API */ /* Public API */

View File

@ -112,6 +112,7 @@ static void gtk_tree_view_column_cell_layout_clear_attributes (GtkCellLayout
static void gtk_tree_view_column_cell_layout_reorder (GtkCellLayout *cell_layout, static void gtk_tree_view_column_cell_layout_reorder (GtkCellLayout *cell_layout,
GtkCellRenderer *cell, GtkCellRenderer *cell,
gint position); gint position);
static GList *gtk_tree_view_column_cell_layout_get_cells (GtkCellLayout *cell_layout);
/* Button handling code */ /* Button handling code */
static void gtk_tree_view_column_create_button (GtkTreeViewColumn *tree_column); static void gtk_tree_view_column_create_button (GtkTreeViewColumn *tree_column);
@ -332,6 +333,7 @@ gtk_tree_view_column_cell_layout_init (GtkCellLayoutIface *iface)
iface->set_cell_data_func = gtk_tree_view_column_cell_layout_set_cell_data_func; iface->set_cell_data_func = gtk_tree_view_column_cell_layout_set_cell_data_func;
iface->clear_attributes = gtk_tree_view_column_cell_layout_clear_attributes; iface->clear_attributes = gtk_tree_view_column_cell_layout_clear_attributes;
iface->reorder = gtk_tree_view_column_cell_layout_reorder; iface->reorder = gtk_tree_view_column_cell_layout_reorder;
iface->get_cells = gtk_tree_view_column_cell_layout_get_cells;
} }
static void static void
@ -1552,6 +1554,12 @@ gtk_tree_view_column_get_cell_renderers (GtkTreeViewColumn *tree_column)
return retval; return retval;
} }
static GList *
gtk_tree_view_column_cell_layout_get_cells (GtkCellLayout *layout)
{
return gtk_tree_view_column_get_cell_renderers (GTK_TREE_VIEW_COLUMN (layout));
}
/** /**
* gtk_tree_view_column_add_attribute: * gtk_tree_view_column_add_attribute:
* @tree_column: A #GtkTreeViewColumn. * @tree_column: A #GtkTreeViewColumn.