This commit adds stock icon functionality to GtkCellRendererPixbuf which
Mon Apr 22 19:24:29 2002 Kristian Rietveld <kris@gtk.org> This commit adds stock icon functionality to GtkCellRendererPixbuf which is totally cool. * gtk/gtkcellrendererpixbuf.h: add some fields * gtk/gtkcellrendererpixbuf.c: add finalize method, add some properties, add some stock icon rendering code. * demos/gtk-demo/stock_browser.c: modified to use the stock icon stuff in the cellrendererpixbuf instead of its own stock icon rendering code.
This commit is contained in:

committed by
Kristian Rietveld

parent
b78fa7ae04
commit
226b671bc1
14
ChangeLog
14
ChangeLog
@ -1,3 +1,17 @@
|
|||||||
|
Mon Apr 22 19:24:29 2002 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
|
This commit adds stock icon functionality to GtkCellRendererPixbuf
|
||||||
|
which is totally cool.
|
||||||
|
|
||||||
|
* gtk/gtkcellrendererpixbuf.h: add some fields
|
||||||
|
|
||||||
|
* gtk/gtkcellrendererpixbuf.c: add finalize method, add some
|
||||||
|
properties, add some stock icon rendering code.
|
||||||
|
|
||||||
|
* demos/gtk-demo/stock_browser.c: modified to use the stock
|
||||||
|
icon stuff in the cellrendererpixbuf instead of its own stock icon
|
||||||
|
rendering code.
|
||||||
|
|
||||||
2002-04-21 Alexander Larsson <alla@lysator.liu.se>
|
2002-04-21 Alexander Larsson <alla@lysator.liu.se>
|
||||||
|
|
||||||
* gdk/x11/gdkwindow-x11.c (gdk_window_reparent):
|
* gdk/x11/gdkwindow-x11.c (gdk_window_reparent):
|
||||||
|
@ -1,3 +1,17 @@
|
|||||||
|
Mon Apr 22 19:24:29 2002 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
|
This commit adds stock icon functionality to GtkCellRendererPixbuf
|
||||||
|
which is totally cool.
|
||||||
|
|
||||||
|
* gtk/gtkcellrendererpixbuf.h: add some fields
|
||||||
|
|
||||||
|
* gtk/gtkcellrendererpixbuf.c: add finalize method, add some
|
||||||
|
properties, add some stock icon rendering code.
|
||||||
|
|
||||||
|
* demos/gtk-demo/stock_browser.c: modified to use the stock
|
||||||
|
icon stuff in the cellrendererpixbuf instead of its own stock icon
|
||||||
|
rendering code.
|
||||||
|
|
||||||
2002-04-21 Alexander Larsson <alla@lysator.liu.se>
|
2002-04-21 Alexander Larsson <alla@lysator.liu.se>
|
||||||
|
|
||||||
* gdk/x11/gdkwindow-x11.c (gdk_window_reparent):
|
* gdk/x11/gdkwindow-x11.c (gdk_window_reparent):
|
||||||
|
@ -1,3 +1,17 @@
|
|||||||
|
Mon Apr 22 19:24:29 2002 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
|
This commit adds stock icon functionality to GtkCellRendererPixbuf
|
||||||
|
which is totally cool.
|
||||||
|
|
||||||
|
* gtk/gtkcellrendererpixbuf.h: add some fields
|
||||||
|
|
||||||
|
* gtk/gtkcellrendererpixbuf.c: add finalize method, add some
|
||||||
|
properties, add some stock icon rendering code.
|
||||||
|
|
||||||
|
* demos/gtk-demo/stock_browser.c: modified to use the stock
|
||||||
|
icon stuff in the cellrendererpixbuf instead of its own stock icon
|
||||||
|
rendering code.
|
||||||
|
|
||||||
2002-04-21 Alexander Larsson <alla@lysator.liu.se>
|
2002-04-21 Alexander Larsson <alla@lysator.liu.se>
|
||||||
|
|
||||||
* gdk/x11/gdkwindow-x11.c (gdk_window_reparent):
|
* gdk/x11/gdkwindow-x11.c (gdk_window_reparent):
|
||||||
|
@ -1,3 +1,17 @@
|
|||||||
|
Mon Apr 22 19:24:29 2002 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
|
This commit adds stock icon functionality to GtkCellRendererPixbuf
|
||||||
|
which is totally cool.
|
||||||
|
|
||||||
|
* gtk/gtkcellrendererpixbuf.h: add some fields
|
||||||
|
|
||||||
|
* gtk/gtkcellrendererpixbuf.c: add finalize method, add some
|
||||||
|
properties, add some stock icon rendering code.
|
||||||
|
|
||||||
|
* demos/gtk-demo/stock_browser.c: modified to use the stock
|
||||||
|
icon stuff in the cellrendererpixbuf instead of its own stock icon
|
||||||
|
rendering code.
|
||||||
|
|
||||||
2002-04-21 Alexander Larsson <alla@lysator.liu.se>
|
2002-04-21 Alexander Larsson <alla@lysator.liu.se>
|
||||||
|
|
||||||
* gdk/x11/gdkwindow-x11.c (gdk_window_reparent):
|
* gdk/x11/gdkwindow-x11.c (gdk_window_reparent):
|
||||||
|
@ -1,3 +1,17 @@
|
|||||||
|
Mon Apr 22 19:24:29 2002 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
|
This commit adds stock icon functionality to GtkCellRendererPixbuf
|
||||||
|
which is totally cool.
|
||||||
|
|
||||||
|
* gtk/gtkcellrendererpixbuf.h: add some fields
|
||||||
|
|
||||||
|
* gtk/gtkcellrendererpixbuf.c: add finalize method, add some
|
||||||
|
properties, add some stock icon rendering code.
|
||||||
|
|
||||||
|
* demos/gtk-demo/stock_browser.c: modified to use the stock
|
||||||
|
icon stuff in the cellrendererpixbuf instead of its own stock icon
|
||||||
|
rendering code.
|
||||||
|
|
||||||
2002-04-21 Alexander Larsson <alla@lysator.liu.se>
|
2002-04-21 Alexander Larsson <alla@lysator.liu.se>
|
||||||
|
|
||||||
* gdk/x11/gdkwindow-x11.c (gdk_window_reparent):
|
* gdk/x11/gdkwindow-x11.c (gdk_window_reparent):
|
||||||
|
@ -1,3 +1,17 @@
|
|||||||
|
Mon Apr 22 19:24:29 2002 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
|
This commit adds stock icon functionality to GtkCellRendererPixbuf
|
||||||
|
which is totally cool.
|
||||||
|
|
||||||
|
* gtk/gtkcellrendererpixbuf.h: add some fields
|
||||||
|
|
||||||
|
* gtk/gtkcellrendererpixbuf.c: add finalize method, add some
|
||||||
|
properties, add some stock icon rendering code.
|
||||||
|
|
||||||
|
* demos/gtk-demo/stock_browser.c: modified to use the stock
|
||||||
|
icon stuff in the cellrendererpixbuf instead of its own stock icon
|
||||||
|
rendering code.
|
||||||
|
|
||||||
2002-04-21 Alexander Larsson <alla@lysator.liu.se>
|
2002-04-21 Alexander Larsson <alla@lysator.liu.se>
|
||||||
|
|
||||||
* gdk/x11/gdkwindow-x11.c (gdk_window_reparent):
|
* gdk/x11/gdkwindow-x11.c (gdk_window_reparent):
|
||||||
|
@ -121,7 +121,7 @@ create_model (void)
|
|||||||
GSList *ids;
|
GSList *ids;
|
||||||
GSList *tmp_list;
|
GSList *tmp_list;
|
||||||
|
|
||||||
store = gtk_list_store_new (1, STOCK_ITEM_INFO_TYPE);
|
store = gtk_list_store_new (2, STOCK_ITEM_INFO_TYPE, G_TYPE_STRING);
|
||||||
|
|
||||||
ids = gtk_stock_list_ids ();
|
ids = gtk_stock_list_ids ();
|
||||||
ids = g_slist_sort (ids, (GCompareFunc) strcmp);
|
ids = g_slist_sort (ids, (GCompareFunc) strcmp);
|
||||||
@ -210,7 +210,7 @@ create_model (void)
|
|||||||
info.macro = id_to_macro (info.id);
|
info.macro = id_to_macro (info.id);
|
||||||
|
|
||||||
gtk_list_store_append (store, &iter);
|
gtk_list_store_append (store, &iter);
|
||||||
gtk_list_store_set (store, &iter, 0, &info, -1);
|
gtk_list_store_set (store, &iter, 0, &info, 1, info.id, -1);
|
||||||
|
|
||||||
g_free (info.macro);
|
g_free (info.macro);
|
||||||
g_free (info.accel_str);
|
g_free (info.accel_str);
|
||||||
@ -339,26 +339,6 @@ macro_set_func_text (GtkTreeViewColumn *tree_column,
|
|||||||
stock_item_info_free (info);
|
stock_item_info_free (info);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
macro_set_func_pixbuf (GtkTreeViewColumn *tree_column,
|
|
||||||
GtkCellRenderer *cell,
|
|
||||||
GtkTreeModel *model,
|
|
||||||
GtkTreeIter *iter,
|
|
||||||
gpointer data)
|
|
||||||
{
|
|
||||||
StockItemInfo *info;
|
|
||||||
|
|
||||||
gtk_tree_model_get (model, iter,
|
|
||||||
0, &info,
|
|
||||||
-1);
|
|
||||||
|
|
||||||
g_object_set (GTK_CELL_RENDERER (cell),
|
|
||||||
"pixbuf", info->small_icon,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
stock_item_info_free (info);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
id_set_func (GtkTreeViewColumn *tree_column,
|
id_set_func (GtkTreeViewColumn *tree_column,
|
||||||
GtkCellRenderer *cell,
|
GtkCellRenderer *cell,
|
||||||
@ -467,8 +447,8 @@ do_stock_browser (void)
|
|||||||
gtk_tree_view_column_pack_start (column,
|
gtk_tree_view_column_pack_start (column,
|
||||||
cell_renderer,
|
cell_renderer,
|
||||||
FALSE);
|
FALSE);
|
||||||
gtk_tree_view_column_set_cell_data_func (column, cell_renderer,
|
gtk_tree_view_column_set_attributes (column, cell_renderer,
|
||||||
macro_set_func_pixbuf, NULL, NULL);
|
"stock_id", 1, NULL);
|
||||||
cell_renderer = gtk_cell_renderer_text_new ();
|
cell_renderer = gtk_cell_renderer_text_new ();
|
||||||
gtk_tree_view_column_pack_start (column,
|
gtk_tree_view_column_pack_start (column,
|
||||||
cell_renderer,
|
cell_renderer,
|
||||||
@ -480,7 +460,6 @@ do_stock_browser (void)
|
|||||||
column);
|
column);
|
||||||
|
|
||||||
cell_renderer = gtk_cell_renderer_text_new ();
|
cell_renderer = gtk_cell_renderer_text_new ();
|
||||||
|
|
||||||
gtk_tree_view_insert_column_with_data_func (GTK_TREE_VIEW (treeview),
|
gtk_tree_view_insert_column_with_data_func (GTK_TREE_VIEW (treeview),
|
||||||
-1,
|
-1,
|
||||||
"Label",
|
"Label",
|
||||||
@ -489,6 +468,7 @@ do_stock_browser (void)
|
|||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
cell_renderer = gtk_cell_renderer_text_new ();
|
||||||
gtk_tree_view_insert_column_with_data_func (GTK_TREE_VIEW (treeview),
|
gtk_tree_view_insert_column_with_data_func (GTK_TREE_VIEW (treeview),
|
||||||
-1,
|
-1,
|
||||||
"Accel",
|
"Accel",
|
||||||
@ -497,6 +477,7 @@ do_stock_browser (void)
|
|||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
cell_renderer = gtk_cell_renderer_text_new ();
|
||||||
gtk_tree_view_insert_column_with_data_func (GTK_TREE_VIEW (treeview),
|
gtk_tree_view_insert_column_with_data_func (GTK_TREE_VIEW (treeview),
|
||||||
-1,
|
-1,
|
||||||
"ID",
|
"ID",
|
||||||
|
@ -31,6 +31,9 @@ static void gtk_cell_renderer_pixbuf_set_property (GObject *
|
|||||||
GParamSpec *pspec);
|
GParamSpec *pspec);
|
||||||
static void gtk_cell_renderer_pixbuf_init (GtkCellRendererPixbuf *celltext);
|
static void gtk_cell_renderer_pixbuf_init (GtkCellRendererPixbuf *celltext);
|
||||||
static void gtk_cell_renderer_pixbuf_class_init (GtkCellRendererPixbufClass *class);
|
static void gtk_cell_renderer_pixbuf_class_init (GtkCellRendererPixbufClass *class);
|
||||||
|
static void gtk_cell_renderer_pixbuf_finalize (GObject *object);
|
||||||
|
static void gtk_cell_renderer_pixbuf_create_stock_pixbuf (GtkCellRendererPixbuf *cellpixbuf,
|
||||||
|
GtkWidget *widget);
|
||||||
static void gtk_cell_renderer_pixbuf_get_size (GtkCellRenderer *cell,
|
static void gtk_cell_renderer_pixbuf_get_size (GtkCellRenderer *cell,
|
||||||
GtkWidget *widget,
|
GtkWidget *widget,
|
||||||
GdkRectangle *rectangle,
|
GdkRectangle *rectangle,
|
||||||
@ -51,9 +54,14 @@ enum {
|
|||||||
PROP_ZERO,
|
PROP_ZERO,
|
||||||
PROP_PIXBUF,
|
PROP_PIXBUF,
|
||||||
PROP_PIXBUF_EXPANDER_OPEN,
|
PROP_PIXBUF_EXPANDER_OPEN,
|
||||||
PROP_PIXBUF_EXPANDER_CLOSED
|
PROP_PIXBUF_EXPANDER_CLOSED,
|
||||||
|
PROP_STOCK_ID,
|
||||||
|
PROP_STOCK_SIZE,
|
||||||
|
PROP_STOCK_DETAIL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static gpointer parent_class;
|
||||||
|
|
||||||
|
|
||||||
GtkType
|
GtkType
|
||||||
gtk_cell_renderer_pixbuf_get_type (void)
|
gtk_cell_renderer_pixbuf_get_type (void)
|
||||||
@ -84,6 +92,7 @@ gtk_cell_renderer_pixbuf_get_type (void)
|
|||||||
static void
|
static void
|
||||||
gtk_cell_renderer_pixbuf_init (GtkCellRendererPixbuf *cellpixbuf)
|
gtk_cell_renderer_pixbuf_init (GtkCellRendererPixbuf *cellpixbuf)
|
||||||
{
|
{
|
||||||
|
cellpixbuf->stock_size = GTK_ICON_SIZE_MENU;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -92,6 +101,10 @@ gtk_cell_renderer_pixbuf_class_init (GtkCellRendererPixbufClass *class)
|
|||||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||||
GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (class);
|
GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (class);
|
||||||
|
|
||||||
|
parent_class = g_type_class_peek_parent (class);
|
||||||
|
|
||||||
|
object_class->finalize = gtk_cell_renderer_pixbuf_finalize;
|
||||||
|
|
||||||
object_class->get_property = gtk_cell_renderer_pixbuf_get_property;
|
object_class->get_property = gtk_cell_renderer_pixbuf_get_property;
|
||||||
object_class->set_property = gtk_cell_renderer_pixbuf_set_property;
|
object_class->set_property = gtk_cell_renderer_pixbuf_set_property;
|
||||||
|
|
||||||
@ -124,6 +137,49 @@ gtk_cell_renderer_pixbuf_class_init (GtkCellRendererPixbufClass *class)
|
|||||||
GDK_TYPE_PIXBUF,
|
GDK_TYPE_PIXBUF,
|
||||||
G_PARAM_READABLE |
|
G_PARAM_READABLE |
|
||||||
G_PARAM_WRITABLE));
|
G_PARAM_WRITABLE));
|
||||||
|
|
||||||
|
g_object_class_install_property (object_class,
|
||||||
|
PROP_STOCK_ID,
|
||||||
|
g_param_spec_string ("stock_id",
|
||||||
|
_("Stock ID"),
|
||||||
|
_("The stock ID of the stock icon to render"),
|
||||||
|
NULL,
|
||||||
|
G_PARAM_READWRITE));
|
||||||
|
|
||||||
|
g_object_class_install_property (object_class,
|
||||||
|
PROP_STOCK_SIZE,
|
||||||
|
g_param_spec_enum ("stock_size",
|
||||||
|
_("Size"),
|
||||||
|
_("The size of the rendered icon"),
|
||||||
|
GTK_TYPE_ICON_SIZE,
|
||||||
|
GTK_ICON_SIZE_MENU,
|
||||||
|
G_PARAM_READWRITE));
|
||||||
|
|
||||||
|
g_object_class_install_property (object_class,
|
||||||
|
PROP_STOCK_DETAIL,
|
||||||
|
g_param_spec_string ("stock_detail",
|
||||||
|
_("Detail"),
|
||||||
|
_("Render detail to pass to the theme engine"),
|
||||||
|
NULL,
|
||||||
|
G_PARAM_READWRITE));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_cell_renderer_pixbuf_finalize (GObject *object)
|
||||||
|
{
|
||||||
|
GtkCellRendererPixbuf *cellpixbuf = GTK_CELL_RENDERER_PIXBUF (object);
|
||||||
|
|
||||||
|
if (cellpixbuf->pixbuf && cellpixbuf->stock_id)
|
||||||
|
g_object_unref (cellpixbuf->pixbuf);
|
||||||
|
|
||||||
|
if (cellpixbuf->stock_id)
|
||||||
|
g_free (cellpixbuf->stock_id);
|
||||||
|
|
||||||
|
if (cellpixbuf->stock_detail)
|
||||||
|
g_free (cellpixbuf->stock_detail);
|
||||||
|
|
||||||
|
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -148,6 +204,15 @@ gtk_cell_renderer_pixbuf_get_property (GObject *object,
|
|||||||
g_value_set_object (value,
|
g_value_set_object (value,
|
||||||
cellpixbuf->pixbuf_expander_closed ? G_OBJECT (cellpixbuf->pixbuf_expander_closed) : NULL);
|
cellpixbuf->pixbuf_expander_closed ? G_OBJECT (cellpixbuf->pixbuf_expander_closed) : NULL);
|
||||||
break;
|
break;
|
||||||
|
case PROP_STOCK_ID:
|
||||||
|
g_value_set_string (value, cellpixbuf->stock_id);
|
||||||
|
break;
|
||||||
|
case PROP_STOCK_SIZE:
|
||||||
|
g_value_set_enum (value, cellpixbuf->stock_size);
|
||||||
|
break;
|
||||||
|
case PROP_STOCK_DETAIL:
|
||||||
|
g_value_set_string (value, cellpixbuf->stock_detail);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
||||||
break;
|
break;
|
||||||
@ -190,10 +255,32 @@ gtk_cell_renderer_pixbuf_set_property (GObject *object,
|
|||||||
g_object_unref (G_OBJECT (cellpixbuf->pixbuf_expander_closed));
|
g_object_unref (G_OBJECT (cellpixbuf->pixbuf_expander_closed));
|
||||||
cellpixbuf->pixbuf_expander_closed = pixbuf;
|
cellpixbuf->pixbuf_expander_closed = pixbuf;
|
||||||
break;
|
break;
|
||||||
|
case PROP_STOCK_ID:
|
||||||
|
if (cellpixbuf->stock_id)
|
||||||
|
g_free (cellpixbuf->stock_id);
|
||||||
|
cellpixbuf->stock_id = g_strdup (g_value_get_string (value));
|
||||||
|
g_object_notify (G_OBJECT (object), "stock_id");
|
||||||
|
break;
|
||||||
|
case PROP_STOCK_SIZE:
|
||||||
|
cellpixbuf->stock_size = g_value_get_enum (value);
|
||||||
|
g_object_notify (G_OBJECT (object), "stock_size");
|
||||||
|
break;
|
||||||
|
case PROP_STOCK_DETAIL:
|
||||||
|
if (cellpixbuf->stock_detail)
|
||||||
|
g_free (cellpixbuf->stock_detail);
|
||||||
|
cellpixbuf->stock_detail = g_strdup (g_value_get_string (value));
|
||||||
|
g_object_notify (G_OBJECT (object), "stock_detail");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cellpixbuf->pixbuf && cellpixbuf->stock_id)
|
||||||
|
{
|
||||||
|
g_object_unref (cellpixbuf->pixbuf);
|
||||||
|
cellpixbuf->pixbuf = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -215,6 +302,19 @@ gtk_cell_renderer_pixbuf_new (void)
|
|||||||
return GTK_CELL_RENDERER (gtk_type_new (gtk_cell_renderer_pixbuf_get_type ()));
|
return GTK_CELL_RENDERER (gtk_type_new (gtk_cell_renderer_pixbuf_get_type ()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_cell_renderer_pixbuf_create_stock_pixbuf (GtkCellRendererPixbuf *cellpixbuf,
|
||||||
|
GtkWidget *widget)
|
||||||
|
{
|
||||||
|
if (cellpixbuf->pixbuf)
|
||||||
|
g_object_unref (G_OBJECT (cellpixbuf->pixbuf));
|
||||||
|
|
||||||
|
cellpixbuf->pixbuf = gtk_widget_render_icon (widget,
|
||||||
|
cellpixbuf->stock_id,
|
||||||
|
cellpixbuf->stock_size,
|
||||||
|
cellpixbuf->stock_detail);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_cell_renderer_pixbuf_get_size (GtkCellRenderer *cell,
|
gtk_cell_renderer_pixbuf_get_size (GtkCellRenderer *cell,
|
||||||
GtkWidget *widget,
|
GtkWidget *widget,
|
||||||
@ -230,6 +330,9 @@ gtk_cell_renderer_pixbuf_get_size (GtkCellRenderer *cell,
|
|||||||
gint calc_width;
|
gint calc_width;
|
||||||
gint calc_height;
|
gint calc_height;
|
||||||
|
|
||||||
|
if (!cellpixbuf->pixbuf && cellpixbuf->stock_id)
|
||||||
|
gtk_cell_renderer_pixbuf_create_stock_pixbuf (cellpixbuf, widget);
|
||||||
|
|
||||||
if (cellpixbuf->pixbuf)
|
if (cellpixbuf->pixbuf)
|
||||||
{
|
{
|
||||||
pixbuf_width = gdk_pixbuf_get_width (cellpixbuf->pixbuf);
|
pixbuf_width = gdk_pixbuf_get_width (cellpixbuf->pixbuf);
|
||||||
@ -287,6 +390,7 @@ gtk_cell_renderer_pixbuf_render (GtkCellRenderer *cell,
|
|||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
GdkRectangle pix_rect;
|
GdkRectangle pix_rect;
|
||||||
GdkRectangle draw_rect;
|
GdkRectangle draw_rect;
|
||||||
|
gboolean stock_pixbuf = FALSE;
|
||||||
|
|
||||||
pixbuf = cellpixbuf->pixbuf;
|
pixbuf = cellpixbuf->pixbuf;
|
||||||
if (cell->is_expander)
|
if (cell->is_expander)
|
||||||
@ -299,14 +403,19 @@ gtk_cell_renderer_pixbuf_render (GtkCellRenderer *cell,
|
|||||||
pixbuf = cellpixbuf->pixbuf_expander_closed;
|
pixbuf = cellpixbuf->pixbuf_expander_closed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pixbuf)
|
if (!pixbuf && !cellpixbuf->stock_id)
|
||||||
return;
|
return;
|
||||||
|
else if (!pixbuf && cellpixbuf->stock_id)
|
||||||
|
stock_pixbuf = TRUE;
|
||||||
|
|
||||||
gtk_cell_renderer_pixbuf_get_size (cell, widget, cell_area,
|
gtk_cell_renderer_pixbuf_get_size (cell, widget, cell_area,
|
||||||
&pix_rect.x,
|
&pix_rect.x,
|
||||||
&pix_rect.y,
|
&pix_rect.y,
|
||||||
&pix_rect.width,
|
&pix_rect.width,
|
||||||
&pix_rect.height);
|
&pix_rect.height);
|
||||||
|
|
||||||
|
if (stock_pixbuf)
|
||||||
|
pixbuf = cellpixbuf->pixbuf;
|
||||||
|
|
||||||
pix_rect.x += cell_area->x;
|
pix_rect.x += cell_area->x;
|
||||||
pix_rect.y += cell_area->y;
|
pix_rect.y += cell_area->y;
|
||||||
|
@ -41,9 +41,14 @@ struct _GtkCellRendererPixbuf
|
|||||||
{
|
{
|
||||||
GtkCellRenderer parent;
|
GtkCellRenderer parent;
|
||||||
|
|
||||||
|
/*< private >*/
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
GdkPixbuf *pixbuf_expander_open;
|
GdkPixbuf *pixbuf_expander_open;
|
||||||
GdkPixbuf *pixbuf_expander_closed;
|
GdkPixbuf *pixbuf_expander_closed;
|
||||||
|
|
||||||
|
gchar *stock_id;
|
||||||
|
GtkIconSize stock_size;
|
||||||
|
gchar *stock_detail;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GtkCellRendererPixbufClass
|
struct _GtkCellRendererPixbufClass
|
||||||
|
Reference in New Issue
Block a user