mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-12-25 18:35:39 +00:00
e474eaca89
* glib/Object.cs: make static GLib.Object.LookupGType protected for now. * gtk/CellRenderer.custom: code to allow for subclassing and implementing a custom cell renderer. * gtk/Makefile.am: add custom to build. * gtk/glue/Makefile.am: add glue to build. * gtk/glue/cellrenderer.c: glue code to override get_size and render from cellrenderer. * sample/CustomCellRenderer.cs: new sample to show how to implement a custom cell renderer. * sample/Makefile.am: add CustomCellRenderer sample. svn path=/trunk/gtk-sharp/; revision=27426
51 lines
1.9 KiB
C
51 lines
1.9 KiB
C
/* cellrenderer.c : Glue for overriding pieces of GtkCellRenderer
|
|
*
|
|
* Author: Todd Berman (tberman@sevenl.net)
|
|
*
|
|
* Copyright (C) 2004 Todd Berman
|
|
*/
|
|
|
|
#include <gtk/gtkcellrenderer.h>
|
|
|
|
void gtksharp_cellrenderer_base_get_size (GtkCellRenderer *cell, GtkWidget *widget, GdkRectangle *cell_area, gint *x_offset, gint *y_offset, gint *width, gint *height);
|
|
|
|
void
|
|
gtksharp_cellrenderer_base_get_size (GtkCellRenderer *cell, GtkWidget *widget, GdkRectangle *cell_area, gint *x_offset, gint *y_offset, gint *width, gint *height)
|
|
{
|
|
GtkCellRendererClass *parent = g_type_class_peek_parent (G_OBJECT_GET_CLASS (cell));
|
|
if (parent->get_size)
|
|
(*parent->get_size) (cell, widget, cell_area, x_offset, y_offset, width, height);
|
|
}
|
|
|
|
void gtksharp_cellrenderer_override_get_size (GType gtype, gpointer cb);
|
|
|
|
void
|
|
gtksharp_cellrenderer_override_get_size (GType gtype, gpointer cb)
|
|
{
|
|
GtkCellRendererClass *klass = g_type_class_peek (gtype);
|
|
if (!klass)
|
|
klass = g_type_class_ref (gtype);
|
|
((GtkCellRendererClass *) klass)->get_size = cb;
|
|
}
|
|
|
|
void gtksharp_cellrenderer_base_render (GtkCellRenderer *cell, GdkDrawable *window, GtkWidget *widget, GdkRectangle *background_area, GdkRectangle *cell_area, GdkRectangle *expose_area, GtkCellRendererState flags);
|
|
|
|
void
|
|
gtksharp_cellrenderer_base_render (GtkCellRenderer *cell, GdkDrawable *window, GtkWidget *widget, GdkRectangle *background_area, GdkRectangle *cell_area, GdkRectangle *expose_area, GtkCellRendererState flags)
|
|
{
|
|
GtkCellRendererClass *parent = g_type_class_peek_parent (G_OBJECT_GET_CLASS (cell));
|
|
if (parent->render)
|
|
(*parent->render) (cell, window, widget, background_area, cell_area, expose_area, flags);
|
|
}
|
|
|
|
void gtksharp_cellrenderer_override_render (GType gtype, gpointer cb);
|
|
|
|
void
|
|
gtksharp_cellrenderer_override_render (GType gtype, gpointer cb)
|
|
{
|
|
GtkCellRendererClass *klass = g_type_class_peek (gtype);
|
|
if (!klass)
|
|
klass = g_type_class_ref (gtype);
|
|
((GtkCellRendererClass *) klass)->render = cb;
|
|
}
|