Add gtk_cell_view_new_with_texture

Just more api to replace pixbufs with textures.
This commit is contained in:
Matthias Clasen 2017-11-29 19:28:53 -05:00
parent 7b032a9862
commit 507ef68faa
3 changed files with 35 additions and 0 deletions

View File

@ -3983,6 +3983,7 @@ gtk_cell_view_new_with_context
gtk_cell_view_new_with_text gtk_cell_view_new_with_text
gtk_cell_view_new_with_markup gtk_cell_view_new_with_markup
gtk_cell_view_new_with_pixbuf gtk_cell_view_new_with_pixbuf
gtk_cell_view_new_with_texture
gtk_cell_view_set_model gtk_cell_view_set_model
gtk_cell_view_get_model gtk_cell_view_get_model
gtk_cell_view_set_displayed_row gtk_cell_view_set_displayed_row

View File

@ -943,6 +943,38 @@ gtk_cell_view_new_with_pixbuf (GdkPixbuf *pixbuf)
return GTK_WIDGET (cellview); return GTK_WIDGET (cellview);
} }
/**
* gtk_cell_view_new_with_texture:
* @texture: the image to display in the cell view
*
* Creates a new #GtkCellView widget, adds a #GtkCellRendererPixbuf
* to it, and makes it show @texture.
*
* Returns: A newly created #GtkCellView widget.
*
* Since: 3.94
*/
GtkWidget *
gtk_cell_view_new_with_texture (GdkTexture *texture)
{
GtkCellView *cellview;
GtkCellRenderer *renderer;
GValue value = G_VALUE_INIT;
cellview = GTK_CELL_VIEW (gtk_cell_view_new ());
renderer = gtk_cell_renderer_pixbuf_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cellview),
renderer, TRUE);
g_value_init (&value, GDK_TYPE_TEXTURE);
g_value_set_object (&value, texture);
gtk_cell_view_set_value (cellview, renderer, "texture", &value);
g_value_unset (&value);
return GTK_WIDGET (cellview);
}
/** /**
* gtk_cell_view_set_value: * gtk_cell_view_set_value:
* @cell_view: a #GtkCellView widget * @cell_view: a #GtkCellView widget

View File

@ -79,6 +79,8 @@ GDK_AVAILABLE_IN_ALL
GtkWidget *gtk_cell_view_new_with_markup (const gchar *markup); GtkWidget *gtk_cell_view_new_with_markup (const gchar *markup);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
GtkWidget *gtk_cell_view_new_with_pixbuf (GdkPixbuf *pixbuf); GtkWidget *gtk_cell_view_new_with_pixbuf (GdkPixbuf *pixbuf);
GDK_AVAILABLE_IN_3_94
GtkWidget *gtk_cell_view_new_with_texture (GdkTexture *texture);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
void gtk_cell_view_set_model (GtkCellView *cell_view, void gtk_cell_view_set_model (GtkCellView *cell_view,
GtkTreeModel *model); GtkTreeModel *model);